diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/log4j2-test.xml new file mode 100644 index 000000000..282cfa5d9 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/log4j2-test.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index f0ca4f596..d85d5016e 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -38,8 +38,10 @@ import org.apache.archiva.policies.SnapshotsPolicy; import org.apache.archiva.repository.ManagedRepositoryContent; import org.assertj.core.api.Assertions; import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.AbstractHandler; import org.junit.After; import org.junit.Before; @@ -164,11 +166,13 @@ public class HttpProxyTransferTest } }; - server = new Server( 0 ); + server = new Server( ); + ServerConnector serverConnector = new ServerConnector( server, new HttpConnectionFactory()); + server.addConnector( serverConnector ); server.setHandler( handler ); server.start(); - int port = server.getConnectors()[0].getLocalPort(); + int port = serverConnector.getLocalPort(); NetworkProxyConfiguration proxyConfig = new NetworkProxyConfiguration(); proxyConfig.setHost( "localhost" ); diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java index 6a1210d1a..09fdf5a31 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java @@ -31,7 +31,9 @@ import org.apache.maven.index.MAVEN; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.expr.StringSearchExpression; import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -61,6 +63,7 @@ public class DownloadRemoteIndexTaskTest { private Server server; + private ServerConnector serverConnector; private int port; @@ -81,12 +84,12 @@ public class DownloadRemoteIndexTaskTest public void initialize() throws Exception { - server = new Server( 0 ); + server = new Server( ); + serverConnector = new ServerConnector( server, new HttpConnectionFactory()); + server.addConnector( serverConnector ); createContext( server, new File( "src/test/" ) ); - this.server.start(); - Connector connector = this.server.getConnectors()[0]; - this.port = connector.getLocalPort(); + this.port = serverConnector.getLocalPort(); log.info( "start server on port {}", this.port ); nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml index 6e3ef0ff3..c7f86dd6b 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml @@ -19,7 +19,7 @@ --> - + @@ -29,7 +29,7 @@ - + diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index f77fbc188..88420e281 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -37,7 +37,6 @@ --> jdbc:hsqldb:mem:redback-test org.hsqldb.jdbcDriver - 9.4.5.v20170502 @@ -387,12 +386,12 @@ org.eclipse.jetty jetty-server - ${jetty.version} + ${jettyVersion} org.eclipse.jetty jetty-servlet - ${jetty.version} + ${jettyVersion} xerces diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml index 4d7c9ab07..1c258ef1e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml @@ -30,7 +30,7 @@ - + diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml index e3b113a37..a173f6aa8 100644 --- a/archiva-modules/archiva-web/archiva-web-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml @@ -235,6 +235,11 @@ org.springframework spring-web + + javax.mail + mail + provided + junit junit diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java index b009e8c71..eae41013f 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java @@ -25,7 +25,9 @@ import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.apache.maven.wagon.providers.http.HttpWagon; import org.apache.maven.wagon.repository.Repository; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.junit.After; @@ -96,7 +98,9 @@ public class DownloadArtifactsTest // repo handler - this.repoServer = new Server( 0 ); + this.repoServer = new Server( ); + ServerConnector repoServerConnector = new ServerConnector( this.repoServer, new HttpConnectionFactory()); + this.repoServer.addConnector( repoServerConnector ); ServletHolder shRepo = new ServletHolder( RepoServlet.class ); ServletContextHandler contextRepo = new ServletContextHandler(); @@ -105,12 +109,16 @@ public class DownloadArtifactsTest contextRepo.addServlet( shRepo, "/*" ); repoServer.setHandler( contextRepo ); + repoServer.start(); - this.repoServerPort = repoServer.getConnectors()[0].getLocalPort(); + this.repoServerPort = repoServerConnector.getLocalPort(); //redirect handler - this.redirectServer = new Server( 0 ); + this.redirectServer = new Server( ); + ServerConnector redirectServerConnector = new ServerConnector( this.redirectServer, new HttpConnectionFactory()); + this.redirectServer.addConnector( redirectServerConnector ); + ServletHolder shRedirect = new ServletHolder( RedirectServlet.class ); ServletContextHandler contextRedirect = new ServletContextHandler(); contextRedirect.setAttribute( "redirectToPort", Integer.toString( this.repoServerPort ) ); @@ -120,7 +128,7 @@ public class DownloadArtifactsTest redirectServer.setHandler( contextRedirect ); redirectServer.start(); - this.redirectPort = redirectServer.getConnectors()[0].getLocalPort(); + this.redirectPort = redirectServerConnector.getLocalPort(); log.info( "redirect server port {}", redirectPort ); } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java index fabe56808..369bb10f8 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java @@ -24,7 +24,9 @@ import org.apache.archiva.rest.api.services.RemoteRepositoriesService; import org.apache.commons.io.FileUtils; import org.apache.cxf.jaxrs.client.WebClient; import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; @@ -71,6 +73,9 @@ public class RemoteRepositoryConnectivityCheckTest Server repoServer = buildStaticServer( new File( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" ) ); + + ServerConnector serverConnector = new ServerConnector( repoServer, new HttpConnectionFactory()); + repoServer.addConnector( serverConnector ); repoServer.start(); RemoteRepositoriesService service = getRemoteRepositoriesService(); @@ -80,7 +85,7 @@ public class RemoteRepositoryConnectivityCheckTest try { - int repoServerPort = repoServer.getConnectors()[0].getLocalPort(); + int repoServerPort = serverConnector.getLocalPort(); RemoteRepository repo = getRemoteRepository(); @@ -104,6 +109,8 @@ public class RemoteRepositoryConnectivityCheckTest File tmpDir = Files.createTempDirectory( "test" ).toFile(); Server repoServer = buildStaticServer( tmpDir ); + ServerConnector serverConnector = new ServerConnector( repoServer, new HttpConnectionFactory()); + repoServer.addConnector( serverConnector ); repoServer.start(); RemoteRepositoriesService service = getRemoteRepositoriesService(); @@ -113,7 +120,7 @@ public class RemoteRepositoryConnectivityCheckTest try { - int repoServerPort = repoServer.getConnectors()[0].getLocalPort(); + int repoServerPort = serverConnector.getLocalPort(); RemoteRepository repo = getRemoteRepository(); @@ -160,7 +167,7 @@ public class RemoteRepositoryConnectivityCheckTest protected Server buildStaticServer( File path ) { - Server repoServer = new Server( 0 ); + Server repoServer = new Server( ); ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setDirectoriesListed( true ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml index b80c0b0fa..11ff56844 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml @@ -28,15 +28,15 @@ - + - - - - - - + + + + + + diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 6e7bf6f8d..6c4f3f9b0 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -159,6 +159,11 @@ xmlunit test + + javax.mail + mail + provided + org.eclipse.jetty jetty-server diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java index 0c0a7183c..42146c031 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java @@ -28,7 +28,9 @@ import org.apache.archiva.policies.ChecksumPolicy; import org.apache.archiva.policies.ReleasesPolicy; import org.apache.archiva.policies.SnapshotsPolicy; import org.apache.commons.io.FileUtils; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; @@ -137,7 +139,9 @@ public abstract class AbstractRepositoryServletProxiedTestCase repo.root.mkdirs(); } - repo.server = new Server( 0 ); + repo.server = new Server( ); + ServerConnector serverConnector = new ServerConnector( repo.server, new HttpConnectionFactory()); + repo.server.addConnector( serverConnector ); ContextHandlerCollection contexts = new ContextHandlerCollection(); repo.server.setHandler( contexts ); @@ -154,7 +158,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase repo.server.start(); - int port = repo.server.getConnectors()[0].getLocalPort(); + int port = serverConnector.getLocalPort(); repo.url = "http://localhost:" + port + repo.context; log.info( "Remote HTTP Server started on {}", repo.url ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java index b657c082b..30a1049d6 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java @@ -20,46 +20,30 @@ package org.apache.archiva.webdav; */ import junit.framework.TestCase; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.archiva.redback.users.User; -import org.apache.jackrabbit.webdav.DavSessionProvider; -import org.apache.jackrabbit.webdav.WebdavRequest; -import org.apache.jackrabbit.webdav.WebdavRequestImpl; -import org.apache.archiva.security.ServletAuthenticator; import org.apache.archiva.redback.authentication.AuthenticationDataSource; +import org.apache.archiva.redback.authentication.AuthenticationException; import org.apache.archiva.redback.authentication.AuthenticationResult; import org.apache.archiva.redback.authorization.AuthorizationException; import org.apache.archiva.redback.authorization.UnauthorizedException; -import org.apache.archiva.redback.system.SecuritySession; import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator; - -import javax.servlet.AsyncContext; -import javax.servlet.DispatcherType; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.http.Part; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Map; +import org.apache.archiva.redback.policy.AccountLockedException; +import org.apache.archiva.redback.policy.MustChangePasswordException; +import org.apache.archiva.redback.system.SecuritySession; +import org.apache.archiva.redback.users.User; +import org.apache.archiva.security.ServletAuthenticator; import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; +import org.apache.jackrabbit.webdav.DavSessionProvider; +import org.apache.jackrabbit.webdav.WebdavRequest; +import org.apache.jackrabbit.webdav.WebdavRequestImpl; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.mock.web.MockHttpServletRequest; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; @RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ArchivaDavSessionProviderTest @@ -76,7 +60,7 @@ public class ArchivaDavSessionProviderTest { super.setUp(); sessionProvider = new ArchivaDavSessionProvider( new ServletAuthenticatorMock(), new HttpAuthenticatorMock() ); - request = new WebdavRequestImpl( new HttpServletRequestMock(), null ); + request = new WebdavRequestImpl( new MockHttpServletRequest(), null ); } @Test @@ -101,10 +85,30 @@ public class ArchivaDavSessionProviderTest } @SuppressWarnings( "unchecked" ) + /* private class HttpServletRequestMock implements HttpServletRequest { + @Override + public long getContentLengthLong() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + @Override + public String changeSessionId() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + @Override + public T upgrade( Class handlerClass ) + throws IOException, ServletException + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + @Override public boolean authenticate( HttpServletResponse httpServletResponse ) throws IOException, ServletException @@ -513,6 +517,7 @@ public class ArchivaDavSessionProviderTest } } + */ private class ServletAuthenticatorMock implements ServletAuthenticator { diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml b/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml index 1ce090b03..84243affe 100644 --- a/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml +++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml @@ -19,7 +19,7 @@ --> - + @@ -31,7 +31,6 @@ - diff --git a/pom.xml b/pom.xml index 53b389a32..ee9719659 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ 4.5.2 4.4.4 1.4 - 8.1.14.v20131031 + 9.4.5.v20170502 16.0.1