From d13a6a799e293ab063918478d1ac323d7e9820e1 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 15 Sep 2011 11:25:04 +0000 Subject: [PATCH] rest services path for test is configurable so align to the one defined in web.xml git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171060 13f79535-47bb-0310-9956-ffa450edef68 --- .../services/AbstractArchivaRestTest.java | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) 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 39fa6ae76..48ec6c6fb 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 @@ -51,15 +51,21 @@ public abstract class AbstractArchivaRestTest return "classpath*:META-INF/spring-context.xml,classpath:META-INF/spring-context-test.xml"; } + protected String getRestServicesPath() + { + return "restServices"; + } + protected RepositoriesService getRepositoriesService() { return getRepositoriesService( null ); } + protected RepositoriesService getRepositoriesService( String authzHeader ) { RepositoriesService service = - JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", + JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", RepositoriesService.class ); if ( authzHeader != null ) @@ -74,7 +80,7 @@ public abstract class AbstractArchivaRestTest protected ManagedRepositoriesService getManagedRepositoriesService( String authzHeader ) { ManagedRepositoriesService service = - JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", + JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", ManagedRepositoriesService.class ); if ( authzHeader != null ) @@ -88,28 +94,30 @@ public abstract class AbstractArchivaRestTest protected PingService getPingService() { - return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", - PingService.class ); + return JAXRSClientFactory.create( + "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", PingService.class ); } protected RemoteRepositoriesService getRemoteRepositoriesService() { - return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", - RemoteRepositoriesService.class ); + return JAXRSClientFactory.create( + "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", + RemoteRepositoriesService.class ); } protected RepositoryGroupService getRepositoryGroupService() { - return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", - RepositoryGroupService.class ); + return JAXRSClientFactory.create( + "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", + RepositoryGroupService.class ); } protected ProxyConnectorService getProxyConnectorService() { ProxyConnectorService service = - JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", + JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", ProxyConnectorService.class ); WebClient.client( service ).header( "Authorization", authorizationHeader ); @@ -120,7 +128,7 @@ public abstract class AbstractArchivaRestTest protected NetworkProxyService getNetworkProxyService() { NetworkProxyService service = - JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", + JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", NetworkProxyService.class ); WebClient.client( service ).header( "Authorization", authorizationHeader ); @@ -131,7 +139,7 @@ public abstract class AbstractArchivaRestTest protected ArchivaAdministrationService getArchivaAdministrationService() { ArchivaAdministrationService service = - JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", + JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", ArchivaAdministrationService.class ); WebClient.client( service ).header( "Authorization", authorizationHeader ); @@ -142,7 +150,8 @@ public abstract class AbstractArchivaRestTest protected SearchService getSearchService( String authzHeader ) { SearchService service = - JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/", SearchService.class ); + JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/", + SearchService.class ); if ( authzHeader != null ) {