Merge branch 'feature/jetty_9.4'

This commit is contained in:
olivier lamy 2017-05-18 13:53:17 +10:00
commit 84a1846854
21 changed files with 247 additions and 390 deletions

View File

@ -1,7 +1,5 @@
language: java
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
before_install: "mvn clean install -DskipTests=true -B -V -Pci-build"

View File

@ -106,10 +106,6 @@
<include>LICENSE</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/contexts</directory>
<outputDirectory>contexts</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
@ -19,226 +19,106 @@
~ under the License.
-->
<!-- =============================================================== -->
<!-- Configure the Jetty Server -->
<!-- -->
<!-- Documentation of this file format can be found at: -->
<!-- http://docs.codehaus.org/display/JETTY/jetty.xml -->
<!-- -->
<!-- =============================================================== -->
<!-- ============================================================================= -->
<!-- Configure the Jetty Server -->
<!-- -->
<!-- Documentation of this file format can be found at: -->
<!-- https://www.eclipse.org/jetty/documentation/9.4.x/reference-section.html -->
<!-- -->
<!-- ============================================================================= -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default bounded blocking threadpool
-->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">250</Set>
</New>
<!-- Optional Java 5 bounded threadpool with job queue
<New class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
<Set name="corePoolSize">250</Set>
<Set name="maximumPoolSize">250</Set>
</New>
-->
</Set>
<Arg name="threadpool">
<New id="threadpool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Arg name="minThreads" type="int">10</Arg>
<Arg name="maxThreads" type="int">200</Arg>
<Arg name="idleTimeout" type="int">60000</Arg>
<Set name="detailedDump">false</Set>
</New>
</Arg>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<!-- One of each type! -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.util.thread.ScheduledExecutorScheduler"/>
</Arg>
</Call>
<!-- Use this connector for many frequently idle connections
and for threadless continuations.
-->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host"/></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<!-- Use this connector if NIO is not available.
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.bio.SocketConnector">
<Set name="port">8081</Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
</New>
</Arg>
</Call>
-->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTPS SSL listener -->
<!-- see jetty-ssl.xml to add an ssl connector. use -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- =========================================================== -->
<!-- Set up global session ID manager -->
<!-- =========================================================== -->
<!--
<Set name="sessionIdManager">
<New class="org.mortbay.jetty.servlet.HashSessionIdManager">
<Set name="workerName">node1</Set>
</New>
</Set>
-->
<!-- =========================================================== -->
<!-- Set handler Collection Structure -->
<!-- =========================================================== -->
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Configure the context deployer -->
<!-- A context deployer will deploy contexts described in -->
<!-- configuration files discovered in a directory. -->
<!-- The configuration directory can be scanned for hot -->
<!-- deployments at the configured scanInterval. -->
<!-- -->
<!-- This deployer is configured to deploy contexts configured -->
<!-- in the $JETTY_HOME/contexts directory -->
<!-- -->
<!-- =========================================================== -->
<Call name="addLifeCycle">
<Arg>
<New class="org.eclipse.jetty.deploy.ContextDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">1</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure the webapp deployer. -->
<!-- A webapp deployer will deploy standard webapps discovered -->
<!-- in a directory at startup, without the need for additional -->
<!-- configuration files. It does not support hot deploy or -->
<!-- non standard contexts (see ContextDeployer above). -->
<!-- -->
<!-- This deployer is configured to deploy webapps from the -->
<!-- $JETTY_HOME/webapps directory -->
<!-- -->
<!-- Normally only one type of deployer need be used. -->
<!-- -->
<!-- =========================================================== -->
<Call name="addLifeCycle">
<Arg>
<New class="org.eclipse.jetty.deploy.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/apps</Set>
<Set name="parentLoaderPriority">false</Set>
<Set name="extract">true</Set>
<Set name="allowDuplicates">false</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- Request logs may be configured for the entire server here, -->
<!-- or they can be configured for a specific web app in a -->
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
<!-- for an example). -->
<!-- =========================================================== -->
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/request-yyyy_mm_dd.log</Set>
<Set name="filenameDateFormat">yyyyMMdd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">true</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
<!-- =========================================================== -->
<!-- JNDI java:comp/env -->
<!-- To use JNDI with Jetty, you will need to tell your -->
<!-- WebAppContext to process the naming related items in -->
<!-- web.xml. For an example of how to do that, see the test -->
<!-- webapp below. More information can be found at -->
<!-- http://docs.codehaus.org/display/JETTY/Jetty+Wiki -->
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<!-- =========================================================== -->
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
<Set name="outputBufferSize">32768</Set>
<Set name="requestHeaderSize">8192</Set>
<Set name="responseHeaderSize">8192</Set>
<Set name="headerCacheSize">512</Set>
</New>
<!-- Configuring <resource-ref> and <resource-env-ref>s -->
<!-- -->
<!-- The following are examples of setting up a resource that -->
<!-- can be referenced in a web.xml file as a <resource-ref> or -->
<!-- a <resource-env-ref>. The first argument is the name of the -->
<!-- resource relative to java:comp/env and must be the SAME as -->
<!-- the <res-ref-name> or <resource-env-ref-name> in web.xml. -->
<!-- The second argument is the construction of the resource -->
<!-- object. Any object at all can be configured. -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080" /></Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="appserver.base" default="./apps/archiva"/>/apps/archiva</Set>
<Set name="extractWAR">false</Set>
<Set name="copyWebDir">false</Set>
</New>
</Item>
<Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="setRequestLog">
<Arg>
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/request-yyyy_mm_dd.log</Set>
<Set name="filenameDateFormat">yyyyMMdd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">true</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Arg>
</Call>
<!-- These examples set up a javax.sql.DataSource around an -->
<!-- XADataSource that is provided by the Derby relational db. -->
<!-- The DataSource wrapper that is registered in JNDI is -->
<!-- provided by Atomikos, and works with the Atomikos -->
<!-- transaction manager configured further below. To use these -->
<!-- examples, download Atomikos http://www.atomikos.com and -->
<!-- Derby http://db.apache.org/derby -->
<!-- Configuring Transactions -->
<!-- -->
<!-- The following is a example of a setting up a JTA -->
<!-- transaction manager that can be referenced by looking up -->
<!-- java:comp/UserTransaction. Note that this is just an -->
<!-- example and if you uncomment it, you will need to download -->
<!-- the atomikos jar (see http://www.atomikos.com/download.html)-->
<!-- You can configure any transaction manager that implements -->
<!-- javax.transaction.UserTransaction. -->
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Call name="setAttribute">
@ -252,24 +132,11 @@
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configurations for WebAppContexts -->
<!-- Sequence of configurations to be applied to a webapp. -->
<!-- =========================================================== -->
<Array id="plusConfig" type="java.lang.String">
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.webapp.Configuration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
</Array>
<!-- ARCHIVA CONFIG -->
<New id="validation_mail" class="org.eclipse.jetty.plus.jndi.Resource">
@ -287,30 +154,6 @@
</Arg>
</New>
<!-- Users / Security Database -->
<!--
<New id="users" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/users</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName"><SystemProperty name="appserver.base" default=".."/>/data/databases/users</Set>
<Set name="user">sa</Set>
<Set name="createDatabase">create</Set>
</New>
</Arg>
</New>
<New id="usersShutdown" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/usersShutdown</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName"><SystemProperty name="appserver.base" default=".."/>/data/databases/users</Set>
<Set name="user">sa</Set>
<Set name="shutdownDatabase">shutdown</Set>
</New>
</Arg>
</New>
-->
<New id="users" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/users</Arg>
<Arg>
@ -341,14 +184,4 @@
</New>
<!--
<New id="ArchivaWebAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
<Arg><Ref id="Handlers"/></Arg>
<Arg><SystemProperty name="jetty.home" default="."/>/apps/archiva</Arg>
<Arg>/</Arg>
<Set name="extractWAR">false</Set>
<Set name="throwUnavailableOnStartupException">true</Set>
</New>
-->
</Configure>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
@ -20,12 +18,24 @@
~ under the License.
-->
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/apps/archiva</Set>
<configuration>
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/>
</Console>
</appenders>
<loggers>
<logger name="org.springframework" level="error"/>
<!--
<logger name="org.apache.http" level="debug"/>
-->
<root level="info">
<appender-ref ref="console"/>
</root>
</loggers>
</configuration>
<Set name="extractWAR">false</Set>
<Set name="copyWebDir">false</Set>
</Configure>

View File

@ -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" );

View File

@ -18,11 +18,11 @@ package org.apache.archiva.scheduler.indexing;
* under the License.
*/
import junit.framework.TestCase;
import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
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.BooleanQuery;
import org.apache.maven.index.FlatSearchRequest;
@ -30,12 +30,12 @@ import org.apache.maven.index.FlatSearchResponse;
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;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -50,7 +50,8 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Olivier Lamy
@ -61,6 +62,7 @@ public class DownloadRemoteIndexTaskTest
{
private Server server;
private ServerConnector serverConnector;
private int port;
@ -81,12 +83,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 );
}

View File

@ -19,7 +19,7 @@
-->
<configuration status="debug">
<configuration>
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/>
@ -29,7 +29,7 @@
<logger name="org.springframework" level="error"/>
<logger name="org.apache.archiva.scheduler.indexing" level="debug"/>
<logger name="org.apache.archiva.scheduler.indexing" level="info"/>
<!--
<logger name="org.apache.http" level="debug"/>
-->

View File

@ -384,24 +384,14 @@
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<scope>test</scope>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-juli</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
<scope>test</scope>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>xerces</groupId>

View File

@ -18,26 +18,25 @@ package org.apache.archiva.rest.services;
* under the License.
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import org.apache.archiva.rest.api.services.PluginsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author Eric Barboni
* @since 1.4.0
*/
@Service("pluginsService#rest")
@Service( "pluginsService#rest" )
public class DefaultPluginsServices
implements PluginsService
{
@ -46,7 +45,7 @@ public class DefaultPluginsServices
private List<String> adminFeatures = new ArrayList<>();
private ApplicationContext appCont;
private ApplicationContext applicationContext;
private Logger log = LoggerFactory.getLogger( getClass() );
@ -56,11 +55,14 @@ public class DefaultPluginsServices
public DefaultPluginsServices( ApplicationContext applicationContext )
throws IOException
{
this.appCont = applicationContext;
log.debug( "init DefaultPluginsServices" );
this.applicationContext = applicationContext;
// rebuild
feed( repositoryType, "repository" );
feed( adminFeatures, "features" );
repositoryType = feed( "repository" );
log.debug( "feed {}:{}", "repository" , repositoryType);
adminFeatures = feed( "features" );
log.debug( "feed {}:{}", "features", adminFeatures );
StringBuilder sb = new StringBuilder();
for ( String repoType : repositoryType )
{
@ -81,27 +83,29 @@ public class DefaultPluginsServices
}
}
private void feed( List<String> repository, String key )
private List<String> feed( String key )
throws IOException
{
log.info( "Feeding: {}", key );
repository.clear();
Resource[] xmlResources;
xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" );
Resource[] xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" );
if (xmlResources == null)
{
return Collections.emptyList();
}
List<String> repository = new ArrayList<>( xmlResources.length );
for ( Resource rc : xmlResources )
{
String tmp = rc.getURL().toString();
tmp = tmp.substring( tmp.lastIndexOf( key ) + key.length() + 1, tmp.length() - 8 );
repository.add( "archiva/admin/" + key + "/" + tmp + "/main" );
}
return repository;
}
@Override
public String getAdminPlugins()
throws ArchivaRestServiceException
{
return adminPlugins;
return adminPlugins;
}
}

View File

@ -19,7 +19,7 @@
-->
<configuration status="debug">
<configuration> <!-- status="debug" -->
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%L] [%t] %-5level %logger{3} - %msg%n}" />
@ -27,13 +27,10 @@
</appenders>
<loggers>
<logger name="org.codehaus.redback.rest.services" level="error"/>
<logger name="org.apache.archiva.redback.rest.services" level="error"/>
<logger name="JPOX" level="error"/>
<logger name="org.apache.archiva.rest.services" level="info"/>
<logger name="org.springframework" level="error"/>
<logger name="org.apache.commons.configuration" level="error"/>
<root level="info">

View File

@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -185,11 +185,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>audit</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
@ -234,12 +229,17 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -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 );
}

View File

@ -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 );

View File

@ -28,15 +28,15 @@
<loggers>
<logger name="org.springframework" level="error"/>
<logger name="org.apache.archiva" level="error"/>
<logger name="org.apache.archiva.web" level="info"/>
<logger name="org.apache.commons.configuration" level="error"/>
<logger name="org.apache.archiva.scheduler.indexing" level="debug"/>
<logger name="org.apache.archiva.remotedownload" level="debug"/>
<logger name="org.apache.archiva.scheduler.indexing" level="info"/>
<logger name="org.apache.archiva.remotedownload" level="info"/>
<logger name="org.apache.jackrabbit" level="error"/>
<logger name="org.quartz" level="error"/>
<logger name="JPOX.RDBMS" level="error"/>
<logger name="JPOX" level="error"/>
<root level="info">
<appender-ref ref="console"/>
</root>

View File

@ -51,7 +51,7 @@
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
<param-value>false</param-value>
</init-param>
</filter>

View File

@ -159,6 +159,11 @@
<artifactId>xmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>

View File

@ -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 );

View File

@ -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 extends HttpUpgradeHandler> T upgrade( Class<T> 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
{

View File

@ -19,7 +19,7 @@
-->
<configuration status="debug">
<configuration>
<appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
@ -31,7 +31,6 @@
<logger name="org.springframework" level="error"/>
<root level="info">
<appender-ref ref="console"/>
</root>

View File

@ -86,7 +86,7 @@
<httpclient.version>4.5.2</httpclient.version>
<httpclient.core.version>4.4.4</httpclient.core.version>
<javaxMailVersion>1.4</javaxMailVersion>
<jettyVersion>8.1.14.v20131031</jettyVersion>
<jettyVersion>9.4.5.v20170502</jettyVersion>
<guava.version>16.0.1</guava.version>
<!-- restore when we will be able to use a derby in memory database -->
@ -1200,15 +1200,10 @@
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>