diff --git a/.travis.yml b/.travis.yml index ea38ef36..488d5807 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: java jdk: - - openjdk7 - - oraclejdk7 + - oraclejdk8 script: "mvn clean install" diff --git a/pom.xml b/pom.xml index 3a181d68..8921f5a1 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ 4.2.1.RELEASE 1.7.12 - 2.3 + 2.8.2 UTF-8 true diff --git a/redback-integrations/redback-rest/redback-rest-services/pom.xml b/redback-integrations/redback-rest/redback-rest-services/pom.xml index 14358266..d04b7c2b 100644 --- a/redback-integrations/redback-rest/redback-rest-services/pom.xml +++ b/redback-integrations/redback-rest/redback-rest-services/pom.xml @@ -33,6 +33,7 @@ 7.0.57 + 9.4.5.v20170502 1000000 @@ -138,34 +139,14 @@ - org.apache.tomcat.embed - tomcat-embed-core - ${tomcatVersion} - test + org.eclipse.jetty + jetty-server + ${jetty.version} - org.apache.tomcat - tomcat-juli - ${tomcatVersion} - test - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - ${tomcatVersion} - test - - - org.apache.tomcat - tomcat-servlet-api - ${tomcatVersion} - provided - - - org.apache.tomcat - tomcat-jsp-api - ${tomcatVersion} - provided + org.eclipse.jetty + jetty-servlet + ${jetty.version} diff --git a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java index 4b565a2c..4421abec 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java +++ b/redback-integrations/redback-rest/redback-rest-services/src/test/java/org/apache/archiva/redback/rest/services/AbstractRestServicesTest.java @@ -27,21 +27,24 @@ import org.apache.archiva.redback.rest.api.services.LdapGroupMappingService; import org.apache.archiva.redback.rest.api.services.LoginService; import org.apache.archiva.redback.rest.api.services.RoleManagementService; import org.apache.archiva.redback.rest.api.services.UserService; -import org.apache.catalina.Context; -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; import org.junit.runners.JUnit4; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.bridge.SLF4JBridgeHandler; import org.springframework.web.context.ContextLoaderListener; import javax.ws.rs.core.MediaType; @@ -56,8 +59,8 @@ public abstract class AbstractRestServicesTest { protected Logger log = LoggerFactory.getLogger( getClass() ); - private Tomcat tomcat; - + Server server; + ServerConnector serverConnector; public int port; public String authorizationHeader = getAdminAuthzHeader(); @@ -98,30 +101,27 @@ public abstract class AbstractRestServicesTest public void startServer() throws Exception { + server = new Server(); + serverConnector = new ServerConnector( server, new HttpConnectionFactory()); + server.addConnector(serverConnector); - SLF4JBridgeHandler.removeHandlersForRootLogger(); + 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()); - SLF4JBridgeHandler.install(); + server.setHandler( context ); + server.start(); - tomcat = new Tomcat(); - tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) ); - tomcat.setPort( 0 ); + if (log.isDebugEnabled()) + { + log.debug( "jetty dump: {}", server.dump() ); + } - Context context = tomcat.addContext( "", System.getProperty( "java.io.tmpdir" ) ); - - ApplicationParameter applicationParameter = new ApplicationParameter(); - applicationParameter.setName( "contextConfigLocation" ); - applicationParameter.setValue( getSpringConfigLocation() ); - context.addApplicationParameter( applicationParameter ); - - context.addApplicationListener( ContextLoaderListener.class.getName() ); - - Tomcat.addServlet( context, "cxf", new CXFServlet() ); - context.addServletMapping( "/" + getRestServicesPath() + "/*", "cxf" ); - - tomcat.start(); - - this.port = tomcat.getConnector().getLocalPort(); + this.port = serverConnector.getLocalPort(); log.info( "start server on port {}", this.port ); @@ -143,16 +143,16 @@ public abstract class AbstractRestServicesTest { return JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/fakeCreateAdminService/", - FakeCreateAdminService.class, Collections.singletonList( new com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider() ) ); + FakeCreateAdminService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); } @After public void stopServer() throws Exception { - if ( this.tomcat != null ) + if ( this.server != null ) { - this.tomcat.stop(); + this.server.stop(); } } diff --git a/redback-integrations/redback-rest/redback-rest-services/src/test/resources/log4j2-test.xml b/redback-integrations/redback-rest/redback-rest-services/src/test/resources/log4j2-test.xml index e058bdb7..5f8bb09f 100644 --- a/redback-integrations/redback-rest/redback-rest-services/src/test/resources/log4j2-test.xml +++ b/redback-integrations/redback-rest/redback-rest-services/src/test/resources/log4j2-test.xml @@ -31,7 +31,7 @@ - +