summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2017-01-30 22:41:55 +0100
committerMartin Stockhammer <martin_s@apache.org>2017-01-30 22:41:55 +0100
commit65e04d66ce60621663effbcc35cd48c7e3da7ceb (patch)
tree5be3142a9af3083edcb09d5fc4063b06acae713a
parent367997a308c7405f340c244bee2f8fa898f77c95 (diff)
downloadarchiva-65e04d66ce60621663effbcc35cd48c7e3da7ceb.tar.gz
archiva-65e04d66ce60621663effbcc35cd48c7e3da7ceb.zip
Adding Referer Header to REST tests
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java16
2 files changed, 18 insertions, 0 deletions
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
index fce64f4e2..d4dd7b2fb 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
@@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
+import org.apache.cxf.jaxrs.client.WebClient;
import org.junit.Before;
import org.junit.Test;
@@ -84,6 +85,7 @@ public class RuntimeInfoServiceTest
RuntimeInfoService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ WebClient.client(service).header("Referer","http://localhost");
ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" );
assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() );
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
index 227da18bc..f04148cbd 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
@@ -173,6 +173,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -185,6 +187,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -197,6 +201,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -210,6 +216,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -222,6 +230,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -234,6 +244,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -252,6 +264,8 @@ public abstract class AbstractDownloadTest
RoleManagementService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
// for debuging purpose
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
@@ -268,6 +282,8 @@ public abstract class AbstractDownloadTest
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
UserService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
// for debuging purpose
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );