diff options
author | Olivier Lamy <olamy@apache.org> | 2013-12-03 05:46:50 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-12-03 05:46:50 +0000 |
commit | 38ac0b9c6abdaf4cf411eacebabccc4a73970a8d (patch) | |
tree | 95f3b0f39f229002f8e97d0aa565f4393d8487d5 /archiva-modules/archiva-web/archiva-web-common | |
parent | e61ed9f123360d4f126a0e3ef073c0eaef190079 (diff) | |
download | archiva-38ac0b9c6abdaf4cf411eacebabccc4a73970a8d.tar.gz archiva-38ac0b9c6abdaf4cf411eacebabccc4a73970a8d.zip |
use tomcat here
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1547292 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-web-common')
-rw-r--r-- | archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
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 881377931..bd0e48a46 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 @@ -27,6 +27,10 @@ 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.archiva.webdav.RepositoryServlet; +import org.apache.catalina.Context; +import org.apache.catalina.deploy.ApplicationListener; +import org.apache.catalina.deploy.ApplicationParameter; +import org.apache.catalina.startup.Tomcat; import org.apache.commons.lang.StringUtils; import org.apache.cxf.common.util.Base64Utility; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; @@ -68,6 +72,8 @@ public abstract class AbstractDownloadTest public Server server = null; + public Tomcat tomcat; + public int port; public static String encode( String uid, String password ) @@ -101,6 +107,8 @@ public abstract class AbstractDownloadTest { System.setProperty( "redback.admin.creation.file", "target/auto-admin-creation.properties" ); + + /* this.server = new Server( 0 ); ServletContextHandler context = new ServletContextHandler(); @@ -128,6 +136,31 @@ public abstract class AbstractDownloadTest this.server.start(); Connector connector = this.server.getConnectors()[0]; this.port = connector.getLocalPort(); + */ + tomcat = new Tomcat(); + tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) ); + tomcat.setPort( 0 ); + + Context context = tomcat.addContext( "", System.getProperty( "java.io.tmpdir" ) ); + + ApplicationParameter applicationParameter = new ApplicationParameter(); + applicationParameter.setName( "contextConfigLocation" ); + applicationParameter.setValue( getSpringConfigLocation() ); + context.addApplicationParameter( applicationParameter ); + + context.addApplicationListener( new ApplicationListener( ContextLoaderListener.class.getName(), false ) ); + + tomcat.addServlet( context, "cxf", new CXFServlet() ); + context.addServletMapping( "/" + getRestServicesPath() + "/*" , "cxf" ); + + tomcat.addServlet( context, "archivarepo", new RepositoryServlet() ); + context.addServletMapping( "/repository/*" , "archivarepo" ); + + tomcat.start(); + + port = tomcat.getConnector().getLocalPort(); + + log.info( "start server on port {}", this.port ); User user = new User(); @@ -152,6 +185,10 @@ public abstract class AbstractDownloadTest { this.server.stop(); } + if (this.tomcat != null) + { + this.tomcat.stop(); + } } |