make test logging working
This commit is contained in:
parent
8bdcfbb8a0
commit
0e1a45a716
7
pom.xml
7
pom.xml
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<springVersion>4.1.4.RELEASE</springVersion>
|
<springVersion>4.1.4.RELEASE</springVersion>
|
||||||
<slf4jVersion>1.7.7</slf4jVersion>
|
<slf4jVersion>1.7.10</slf4jVersion>
|
||||||
<log4j2Version>2.1</log4j2Version>
|
<log4j2Version>2.1</log4j2Version>
|
||||||
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -663,7 +663,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.11</version>
|
<version>4.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xmlunit</groupId>
|
<groupId>xmlunit</groupId>
|
||||||
|
@ -673,7 +673,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
<artifactId>assertj-core</artifactId>
|
<artifactId>assertj-core</artifactId>
|
||||||
<version>1.6.0</version>
|
<version>1.7.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
@ -739,6 +739,7 @@
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>-Xmx256m -Xms256m</argLine>
|
<argLine>-Xmx256m -Xms256m</argLine>
|
||||||
|
<runOrder>alphabetical</runOrder>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -175,6 +175,19 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
<version>${log4j2Version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jul-to-slf4j</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
|
@ -237,7 +250,7 @@
|
||||||
org.apache.archiva.redback.users;version=${project.version},
|
org.apache.archiva.redback.users;version=${project.version},
|
||||||
org.apache.commons.io;version="[1.4,2)",
|
org.apache.commons.io;version="[1.4,2)",
|
||||||
org.apache.commons.lang;version="[2.6,3)",
|
org.apache.commons.lang;version="[2.6,3)",
|
||||||
org.apache.cxf*;version="[3.0.3)",
|
org.apache.cxf*;version="[3.0.3,4)",
|
||||||
com.fasterxml.jackson.databind;version="[2.2,3)",
|
com.fasterxml.jackson.databind;version="[2.2,3)",
|
||||||
org.codehaus.plexus.util;version="[3,4)",
|
org.codehaus.plexus.util;version="[3,4)",
|
||||||
org.springframework*;version="[3,4)",
|
org.springframework*;version="[3,4)",
|
||||||
|
|
|
@ -37,7 +37,7 @@ import java.lang.reflect.Method;
|
||||||
public abstract class AbstractInterceptor
|
public abstract class AbstractInterceptor
|
||||||
{
|
{
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
private final Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
@Context
|
@Context
|
||||||
private HttpServletRequest httpServletRequest;
|
private HttpServletRequest httpServletRequest;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class AuthenticationInterceptor
|
||||||
@Named(value = "httpAuthenticator#basic")
|
@Named(value = "httpAuthenticator#basic")
|
||||||
private HttpBasicAuthentication httpAuthenticator;
|
private HttpBasicAuthentication httpAuthenticator;
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
private final Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
public void filter( ContainerRequestContext containerRequestContext )
|
public void filter( ContainerRequestContext containerRequestContext )
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,8 @@ import org.apache.cxf.message.Message;
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 1.3
|
* @since 1.3
|
||||||
*/
|
*/
|
||||||
public class DebugJAXRSInInterceptor extends JAXRSInInterceptor
|
public class DebugJAXRSInInterceptor
|
||||||
|
extends JAXRSInInterceptor
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage( Message message )
|
public void handleMessage( Message message )
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class PermissionsInterceptor
|
||||||
@Named( value = "httpAuthenticator#basic" )
|
@Named( value = "httpAuthenticator#basic" )
|
||||||
private HttpBasicAuthentication httpAuthenticator;
|
private HttpBasicAuthentication httpAuthenticator;
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
private final Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
public void filter( ContainerRequestContext containerRequestContext )
|
public void filter( ContainerRequestContext containerRequestContext )
|
||||||
{
|
{
|
||||||
|
@ -151,6 +151,7 @@ public class PermissionsInterceptor
|
||||||
{
|
{
|
||||||
log.debug( "user {} not authenticated", securitySession.getUser().getUsername() );
|
log.debug( "user {} not authenticated", securitySession.getUser().getUsername() );
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,17 +32,19 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.ext.Provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Olivier Lamy
|
* @author Olivier Lamy
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
@Service( "threadLocalUserCleaner#rest" )
|
@Service( "threadLocalUserCleaner#rest" )
|
||||||
|
@Provider
|
||||||
public class ThreadLocalUserCleaner
|
public class ThreadLocalUserCleaner
|
||||||
extends AbstractPhaseInterceptor<Message>
|
extends AbstractPhaseInterceptor<Message>
|
||||||
implements PhaseInterceptor<Message>
|
implements PhaseInterceptor<Message>
|
||||||
{
|
{
|
||||||
private Logger log = LoggerFactory.getLogger( getClass() );
|
private final Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
public ThreadLocalUserCleaner( String phase )
|
public ThreadLocalUserCleaner( String phase )
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.JUnit4;
|
import org.junit.runners.JUnit4;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.bridge.SLF4JBridgeHandler;
|
||||||
import org.springframework.web.context.ContextLoaderListener;
|
import org.springframework.web.context.ContextLoaderListener;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
@ -98,6 +99,10 @@ public abstract class AbstractRestServicesTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
|
SLF4JBridgeHandler.removeHandlersForRootLogger();
|
||||||
|
|
||||||
|
SLF4JBridgeHandler.install();
|
||||||
|
|
||||||
tomcat = new Tomcat();
|
tomcat = new Tomcat();
|
||||||
tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) );
|
tomcat.setBaseDir( System.getProperty( "java.io.tmpdir" ) );
|
||||||
tomcat.setPort( 0 );
|
tomcat.setPort( 0 );
|
||||||
|
|
|
@ -17,24 +17,26 @@
|
||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
|
<configuration> <!-- status="debug" -->
|
||||||
|
|
||||||
|
|
||||||
<configuration status="debug">
|
|
||||||
<appenders>
|
<appenders>
|
||||||
<Console name="console" target="SYSTEM_OUT">
|
<Console name="console" target="SYSTEM_OUT">
|
||||||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
<PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" />
|
||||||
</Console>
|
</Console>
|
||||||
</appenders>
|
</appenders>
|
||||||
|
|
||||||
<loggers>
|
<loggers>
|
||||||
|
|
||||||
<logger name="org.springframework" level="info"/>
|
<logger name="org.springframework" level="info"/>
|
||||||
|
|
||||||
<logger name="org.apache.cxf" level="info"/>
|
<logger name="org.apache.cxf" level="info"/>
|
||||||
|
<logger name="org.springframework" level="error"/>
|
||||||
|
<logger name="org.apache.archiva.redback.components.cache" level="error"/>
|
||||||
|
<logger name="org.apache.archiva.redback.rest.services.interceptors" level="debug"/>
|
||||||
|
<logger name="JPOX" level="ERROR"/>
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="console"/>
|
<appender-ref ref="console"/>
|
||||||
</root>
|
</root>
|
||||||
</loggers>
|
</loggers>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue