import org.apache.archiva.rest.api.services.SearchService;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
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.commons.lang.SystemUtils;
import org.apache.cxf.common.util.Base64Utility;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.transport.servlet.CXFServlet;
+import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
public Server server = null;
- public Tomcat tomcat;
+ ServerConnector serverConnector;
public int port;
System.setProperty( "redback.admin.creation.file", "target/auto-admin-creation.properties" );
- tomcat = new Tomcat();
- tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) );
- tomcat.setPort( 0 );
+ server = new Server();
+ serverConnector = new ServerConnector( server, new HttpConnectionFactory() );
+ server.addConnector( serverConnector );
- 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();
+ ServletHolder servletHolder = new ServletHolder( new CXFServlet() );
+ ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
+ context.setResourceBase( SystemUtils.JAVA_IO_TMPDIR );
+ context.setSessionHandler( new SessionHandler() );
+ context.addServlet( servletHolder, "/" + getRestServicesPath() + "/*" );
+ context.setInitParameter( "contextConfigLocation", getSpringConfigLocation() );
+ context.addEventListener( new ContextLoaderListener() );
+ ServletHolder servletHolderRepo = new ServletHolder( new RepositoryServlet() );
+ context.addServlet( servletHolderRepo, "/repository/*" );
+ server.setHandler( context );
+ server.start();
+ port = serverConnector.getLocalPort();
log.info( "start server on port {}", this.port );
User user = new User();
{
this.server.stop();
}
- if (this.tomcat != null)
- {
- this.tomcat.stop();
- }
}
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
RoleManagementService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
// for debuging purpose
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
UserService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) );
- WebClient.client(service).header("Referer","http://localhost:"+port);
+ WebClient.client( service ).header( "Referer", "http://localhost:" + port );
// for debuging purpose
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
<version>1.7.1</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>${tomcat7Version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-juli</artifactId>
- <version>${tomcat7Version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-servlet-api</artifactId>
- <version>${tomcat7Version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- <version>${tomcat7Version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>${tomcat7Version}</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
<artifactId>spring-utils</artifactId>
<version>${redback.spring-utils.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.archiva.redback.components</groupId>
- <artifactId>spring-jdo2</artifactId>
- <version>2.2</version>
- <exclusions>
- <exclusion>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-jta</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>${tomcat7Version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-juli</artifactId>
+ <version>${tomcat7Version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>