archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1177070 - in /archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services: pom.xml src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
Date Wed, 28 Sep 2011 21:35:11 GMT
Author: olamy
Date: Wed Sep 28 21:35:11 2011
New Revision: 1177070

URL: http://svn.apache.org/viewvc?rev=1177070&view=rev
Log:
add maven property to be able to override archiva url for rest services test for manual testing
on an existing archiva instance

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml?rev=1177070&r1=1177069&r2=1177070&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml Wed
Sep 28 21:35:11 2011
@@ -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>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java?rev=1177070&r1=1177069&r2=1177070&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
Wed Sep 28 21:35:11 2011
@@ -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.servi
 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 AbstractArchivaRes
     //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 AbstractArchivaRes
     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 AbstractArchivaRes
     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 AbstractArchivaRes
 
     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 AbstractArchivaRes
     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 AbstractArchivaRes
     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 AbstractArchivaRes
     {
         // 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 AbstractArchivaRes
                                       false, 2, 3, true, false );
 
     }
+
+    protected String getBaseUrl()
+    {
+        String baseUrlSysProps = System.getProperty( "archiva.baseRestUrl" );
+        return StringUtils.isBlank( baseUrlSysProps ) ? "http://localhost:" + port : baseUrlSysProps;
+    }
 }



Mime
View raw message