aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-09-28 21:35:11 +0000
committerOlivier Lamy <olamy@apache.org>2011-09-28 21:35:11 +0000
commit45ff9153bf1c6a6483ac5ce171ab24f6e0bd3c1e (patch)
tree522791d98171ac5758440aee015965d35f431cd3
parentbcf81e82acfb418d865d87553ea883d30391bffd (diff)
downloadarchiva-45ff9153bf1c6a6483ac5ce171ab24f6e0bd3c1e.tar.gz
archiva-45ff9153bf1c6a6483ac5ce171ab24f6e0bd3c1e.zip
add maven property to be able to override archiva url for rest services test for manual testing on an existing archiva instance
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1177070 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java36
2 files changed, 22 insertions, 16 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
index b146cb807..6fbabbb46 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
@@ -30,6 +30,7 @@
<properties>
<jettyVersion>7.4.5.v20110725</jettyVersion>
+ <archiva.baseRestUrl></archiva.baseRestUrl>
</properties>
<dependencies>
@@ -253,6 +254,7 @@
<plexus.home>${project.build.outputDirectory}</plexus.home>
<appserver.base>${basedir}/target/appserver-base</appserver.base>
<java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir>
+ <archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
index a1b2214dc..e14236c98 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
@@ -20,6 +20,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.common.utils.FileUtil;
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.archiva.rest.api.services.NetworkProxyService;
@@ -29,9 +30,9 @@ import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.apache.archiva.rest.api.services.RepositoryGroupService;
import org.apache.archiva.rest.api.services.SearchService;
+import org.apache.commons.lang.StringUtils;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.archiva.common.utils.FileUtil;
import org.codehaus.redback.rest.services.AbstractRestServicesTest;
import javax.ws.rs.core.MediaType;
@@ -53,7 +54,6 @@ public abstract class AbstractArchivaRestTest
//public String authzHeader =
// "Basic " + org.apache.cxf.common.util.Base64Utility.encode( ( "login" + ":password" ).getBytes() );
-
// END SNIPPET: authz-header
@Override
@@ -76,7 +76,7 @@ public abstract class AbstractArchivaRestTest
protected RepositoriesService getRepositoriesService( String authzHeader )
{
RepositoriesService service =
- JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
+ JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
RepositoriesService.class );
if ( authzHeader != null )
@@ -91,7 +91,7 @@ public abstract class AbstractArchivaRestTest
protected ManagedRepositoriesService getManagedRepositoriesService( String authzHeader )
{
ManagedRepositoriesService service =
- JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
+ JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ManagedRepositoriesService.class );
if ( authzHeader != null )
@@ -105,30 +105,28 @@ public abstract class AbstractArchivaRestTest
protected PingService getPingService()
{
- return JAXRSClientFactory.create(
- "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", PingService.class );
+ return JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
+ PingService.class );
}
protected RemoteRepositoriesService getRemoteRepositoriesService()
{
- return JAXRSClientFactory.create(
- "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
- RemoteRepositoriesService.class );
+ return JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
+ RemoteRepositoriesService.class );
}
protected RepositoryGroupService getRepositoryGroupService()
{
- return JAXRSClientFactory.create(
- "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
- RepositoryGroupService.class );
+ return JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
+ RepositoryGroupService.class );
}
protected ProxyConnectorService getProxyConnectorService()
{
ProxyConnectorService service =
- JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
+ JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ProxyConnectorService.class );
WebClient.client( service ).header( "Authorization", authorizationHeader );
@@ -139,7 +137,7 @@ public abstract class AbstractArchivaRestTest
protected NetworkProxyService getNetworkProxyService()
{
NetworkProxyService service =
- JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
+ JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
NetworkProxyService.class );
WebClient.client( service ).header( "Authorization", authorizationHeader );
@@ -150,7 +148,7 @@ public abstract class AbstractArchivaRestTest
protected ArchivaAdministrationService getArchivaAdministrationService()
{
ArchivaAdministrationService service =
- JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
+ JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ArchivaAdministrationService.class );
WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
@@ -165,7 +163,7 @@ public abstract class AbstractArchivaRestTest
{
// START SNIPPET: cxf-searchservice-creation
SearchService service =
- JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
+ JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
SearchService.class );
if ( authzHeader != null )
@@ -185,4 +183,10 @@ public abstract class AbstractArchivaRestTest
false, 2, 3, true, false );
}
+
+ protected String getBaseUrl()
+ {
+ String baseUrlSysProps = System.getProperty( "archiva.baseRestUrl" );
+ return StringUtils.isBlank( baseUrlSysProps ) ? "http://localhost:" + port : baseUrlSysProps;
+ }
}