mirror of https://github.com/apache/archiva.git
[MRM-1828] upgrade to jetty 9.x
This commit is contained in:
parent
64187aa84a
commit
a7a2c9130e
|
@ -39,6 +39,7 @@ import org.apache.archiva.repository.ManagedRepositoryContent;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.server.ServerConnector;
|
||||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -167,7 +168,7 @@ public class HttpProxyTransferTest
|
||||||
server.setHandler( handler );
|
server.setHandler( handler );
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
int port = server.getConnectors()[0].getLocalPort();
|
int port = ServerConnector.class.cast( server.getConnectors()[0] ).getLocalPort();
|
||||||
|
|
||||||
NetworkProxyConfiguration proxyConfig = new NetworkProxyConfiguration();
|
NetworkProxyConfiguration proxyConfig = new NetworkProxyConfiguration();
|
||||||
proxyConfig.setHost( "localhost" );
|
proxyConfig.setHost( "localhost" );
|
||||||
|
|
|
@ -18,11 +18,11 @@ package org.apache.archiva.scheduler.indexing;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.apache.archiva.admin.model.beans.RemoteRepository;
|
import org.apache.archiva.admin.model.beans.RemoteRepository;
|
||||||
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
|
||||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||||
import org.apache.archiva.common.utils.FileUtil;
|
import org.apache.archiva.common.utils.FileUtil;
|
||||||
|
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
||||||
import org.apache.lucene.search.BooleanClause;
|
import org.apache.lucene.search.BooleanClause;
|
||||||
import org.apache.lucene.search.BooleanQuery;
|
import org.apache.lucene.search.BooleanQuery;
|
||||||
import org.apache.maven.index.FlatSearchRequest;
|
import org.apache.maven.index.FlatSearchRequest;
|
||||||
|
@ -32,10 +32,10 @@ import org.apache.maven.index.NexusIndexer;
|
||||||
import org.apache.maven.index.expr.StringSearchExpression;
|
import org.apache.maven.index.expr.StringSearchExpression;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.server.ServerConnector;
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -50,13 +50,14 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
*/
|
*/
|
||||||
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
|
@RunWith(ArchivaSpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" })
|
||||||
public class DownloadRemoteIndexTaskTest
|
public class DownloadRemoteIndexTaskTest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public class DownloadRemoteIndexTaskTest
|
||||||
|
|
||||||
this.server.start();
|
this.server.start();
|
||||||
Connector connector = this.server.getConnectors()[0];
|
Connector connector = this.server.getConnectors()[0];
|
||||||
this.port = connector.getLocalPort();
|
this.port = ServerConnector.class.cast( connector ).getLocalPort();
|
||||||
log.info( "start server on port {}", this.port );
|
log.info( "start server on port {}", this.port );
|
||||||
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,6 +403,12 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.mail</groupId>
|
||||||
|
<artifactId>mail</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -21,11 +21,13 @@ package org.apache.archiva.remotedownload;
|
||||||
import org.apache.archiva.admin.model.beans.RemoteRepository;
|
import org.apache.archiva.admin.model.beans.RemoteRepository;
|
||||||
import org.apache.archiva.redback.rest.api.services.RoleManagementService;
|
import org.apache.archiva.redback.rest.api.services.RoleManagementService;
|
||||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||||
|
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
|
||||||
import org.apache.commons.compress.utils.IOUtils;
|
import org.apache.commons.compress.utils.IOUtils;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.maven.wagon.providers.http.HttpWagon;
|
import org.apache.maven.wagon.providers.http.HttpWagon;
|
||||||
import org.apache.maven.wagon.repository.Repository;
|
import org.apache.maven.wagon.repository.Repository;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.server.ServerConnector;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -47,12 +49,11 @@ import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
*/
|
*/
|
||||||
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
|
@RunWith(ArchivaBlockJUnit4ClassRunner.class)
|
||||||
public class DownloadArtifactsTest
|
public class DownloadArtifactsTest
|
||||||
extends AbstractDownloadTest
|
extends AbstractDownloadTest
|
||||||
{
|
{
|
||||||
|
@ -85,8 +86,9 @@ public class DownloadArtifactsTest
|
||||||
protected String getSpringConfigLocation()
|
protected String getSpringConfigLocation()
|
||||||
{
|
{
|
||||||
return "classpath*:META-INF/spring-context.xml classpath*:spring-context-test-common.xml classpath*:spring-context-artifacts-download.xml";
|
return "classpath*:META-INF/spring-context.xml classpath*:spring-context-test-common.xml classpath*:spring-context-artifacts-download.xml";
|
||||||
} @Override
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void startServer()
|
public void startServer()
|
||||||
|
@ -106,7 +108,7 @@ public class DownloadArtifactsTest
|
||||||
|
|
||||||
repoServer.setHandler( contextRepo );
|
repoServer.setHandler( contextRepo );
|
||||||
repoServer.start();
|
repoServer.start();
|
||||||
this.repoServerPort = repoServer.getConnectors()[0].getLocalPort();
|
this.repoServerPort = ServerConnector.class.cast( repoServer.getConnectors()[0] ).getLocalPort();
|
||||||
|
|
||||||
//redirect handler
|
//redirect handler
|
||||||
|
|
||||||
|
@ -120,7 +122,7 @@ public class DownloadArtifactsTest
|
||||||
|
|
||||||
redirectServer.setHandler( contextRedirect );
|
redirectServer.setHandler( contextRedirect );
|
||||||
redirectServer.start();
|
redirectServer.start();
|
||||||
this.redirectPort = redirectServer.getConnectors()[0].getLocalPort();
|
this.redirectPort = ServerConnector.class.cast( redirectServer.getConnectors()[0] ).getLocalPort();
|
||||||
log.info( "redirect server port {}", redirectPort );
|
log.info( "redirect server port {}", redirectPort );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -182,8 +184,6 @@ public class DownloadArtifactsTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class RedirectServlet
|
public static class RedirectServlet
|
||||||
extends HttpServlet
|
extends HttpServlet
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.cxf.jaxrs.client.WebClient;
|
import org.apache.cxf.jaxrs.client.WebClient;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.Server;
|
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.DefaultHandler;
|
||||||
import org.eclipse.jetty.server.handler.HandlerList;
|
import org.eclipse.jetty.server.handler.HandlerList;
|
||||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||||
|
@ -80,7 +81,7 @@ public class RemoteRepositoryConnectivityCheckTest
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
int repoServerPort = repoServer.getConnectors()[0].getLocalPort();
|
int repoServerPort = ServerConnector.class.cast( repoServer.getConnectors()[0] ).getLocalPort();
|
||||||
|
|
||||||
RemoteRepository repo = getRemoteRepository();
|
RemoteRepository repo = getRemoteRepository();
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ public class RemoteRepositoryConnectivityCheckTest
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
int repoServerPort = repoServer.getConnectors()[0].getLocalPort();
|
int repoServerPort = ServerConnector.class.cast( repoServer.getConnectors()[0] ).getLocalPort();
|
||||||
|
|
||||||
RemoteRepository repo = getRemoteRepository();
|
RemoteRepository repo = getRemoteRepository();
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.archiva.policies.ReleasesPolicy;
|
||||||
import org.apache.archiva.policies.SnapshotsPolicy;
|
import org.apache.archiva.policies.SnapshotsPolicy;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.server.ServerConnector;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
@ -152,7 +153,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase
|
||||||
|
|
||||||
repo.server.start();
|
repo.server.start();
|
||||||
|
|
||||||
int port = repo.server.getConnectors()[0].getLocalPort();
|
int port = ServerConnector.class.cast( repo.server.getConnectors()[0] ).getLocalPort();
|
||||||
repo.url = "http://localhost:" + port + repo.context;
|
repo.url = "http://localhost:" + port + repo.context;
|
||||||
log.info( "Remote HTTP Server started on {}", repo.url );
|
log.info( "Remote HTTP Server started on {}", repo.url );
|
||||||
|
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -89,7 +89,7 @@
|
||||||
<httpclient.version>4.3.1</httpclient.version>
|
<httpclient.version>4.3.1</httpclient.version>
|
||||||
<httpclient.core.version>4.3</httpclient.core.version>
|
<httpclient.core.version>4.3</httpclient.core.version>
|
||||||
<javaxMailVersion>1.4</javaxMailVersion>
|
<javaxMailVersion>1.4</javaxMailVersion>
|
||||||
<jettyVersion>8.1.14.v20131031</jettyVersion>
|
<jettyVersion>9.1.4.v20140401</jettyVersion>
|
||||||
|
|
||||||
<!-- restore when we will be able to use a derby in memory database -->
|
<!-- restore when we will be able to use a derby in memory database -->
|
||||||
<redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl>
|
<redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl>
|
||||||
|
|
Loading…
Reference in New Issue