SWS-1027 - Fix log-based errors
This commit is contained in:
22
circle.yml
22
circle.yml
@@ -18,6 +18,15 @@ jobs:
|
||||
name: Java 8 - Test Spring.NEXT
|
||||
command: ./mvnw -Pspringnext clean test
|
||||
|
||||
java_8_test_spring_buildsnapshot:
|
||||
docker:
|
||||
- image: circleci/openjdk:8u141
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Java 8 - Test Spring.NEXT
|
||||
command: ./mvnw -Pspring-buildsnapshot clean test
|
||||
|
||||
java_10_test_current:
|
||||
docker:
|
||||
- image: circleci/openjdk:10.0.1-jdk-node-browsers
|
||||
@@ -36,6 +45,15 @@ jobs:
|
||||
name: Java 10 - Test Spring.NEXT
|
||||
command: ./mvnw -Pspringnext clean test
|
||||
|
||||
java_10_test_spring_buildsnapshot:
|
||||
docker:
|
||||
- image: circleci/openjdk:10.0.1-jdk-node-browsers
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Java 10 - Test Spring.NEXT
|
||||
command: ./mvnw -Pspring-buildsnapshot clean test
|
||||
|
||||
deploy:
|
||||
docker:
|
||||
- image: circleci/openjdk:8u141
|
||||
@@ -52,12 +70,16 @@ workflows:
|
||||
- java_10_test_current
|
||||
- java_8_test_spring_next
|
||||
- java_10_test_spring_next
|
||||
- java_8_test_spring_buildsnapshot
|
||||
- java_10_test_spring_buildsnapshot
|
||||
- deploy:
|
||||
requires:
|
||||
- java_8_test_current
|
||||
- java_10_test_current
|
||||
- java_8_test_spring_next
|
||||
- java_10_test_spring_next
|
||||
- java_8_test_spring_buildsnapshot
|
||||
- java_10_test_spring_buildsnapshot
|
||||
|
||||
general:
|
||||
branches:
|
||||
|
||||
46
pom.xml
46
pom.xml
@@ -93,7 +93,7 @@
|
||||
<commons-io.version>2.5</commons-io.version>
|
||||
<commons-logging.version>1.2</commons-logging.version>
|
||||
<dom4j.version>1.6.1</dom4j.version>
|
||||
<easymock.version>3.1</easymock.version>
|
||||
<easymock.version>3.6</easymock.version>
|
||||
<ehcache.version>2.10.4</ehcache.version>
|
||||
<httpclient.version>4.5.3</httpclient.version>
|
||||
<javax-mail.version>1.6.0</javax-mail.version>
|
||||
@@ -104,6 +104,7 @@
|
||||
<jms.version>2.0.1</jms.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<log4j2.version>2.11.0</log4j2.version>
|
||||
<mock-javamail.version>1.9</mock-javamail.version>
|
||||
<saaj-impl.version>1.3.28</saaj-impl.version>
|
||||
<smack.version>4.2.1</smack.version>
|
||||
@@ -121,11 +122,6 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>${commons-logging.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
@@ -187,7 +183,7 @@
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>springnext</id>
|
||||
<id>spring-buildsnapshot</id>
|
||||
<properties>
|
||||
<aspectj.version>1.9.0.RC2</aspectj.version>
|
||||
<spring.version>5.0.8.BUILD-SNAPSHOT</spring.version>
|
||||
@@ -221,6 +217,42 @@
|
||||
</repositories>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>springnext</id>
|
||||
<properties>
|
||||
<aspectj.version>1.9.0.RC2</aspectj.version>
|
||||
<spring.version>5.1.0.BUILD-SNAPSHOT</spring.version>
|
||||
<spring-security.version>5.0.7.BUILD-SNAPSHOT</spring-security.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-release</id>
|
||||
<name>Spring Releases</name>
|
||||
<url>https://repo.spring.io/release</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
|
||||
|
||||
<profile>
|
||||
<id>distribute</id>
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<version>3.0.2.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -157,9 +156,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -488,7 +488,7 @@ public class WebServiceTemplateTest {
|
||||
connectionMock.send(isA(WebServiceMessage.class));
|
||||
expect(connectionMock.hasError()).andReturn(false);
|
||||
expect(connectionMock.receive(messageFactory)).andReturn(null);
|
||||
expect(connectionMock.getUri()).andReturn(new URI("http://example.com"));
|
||||
// expect(connectionMock.getUri()).andReturn(new URI("http://example.com"));
|
||||
connectionMock.close();
|
||||
|
||||
replay(connectionMock, extractorMock, providerMock);
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.server.endpoint.interceptor;
|
||||
|
||||
import org.apache.log4j.AppenderSkeleton;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.apache.log4j.spi.LoggingEvent;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.ws.MockWebServiceMessage;
|
||||
import org.springframework.ws.MockWebServiceMessageFactory;
|
||||
import org.springframework.ws.context.DefaultMessageContext;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
|
||||
@Ignore
|
||||
public class PayloadLoggingInterceptorTest {
|
||||
|
||||
private PayloadLoggingInterceptor interceptor;
|
||||
|
||||
private CountingAppender appender;
|
||||
|
||||
private MessageContext messageContext;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
interceptor = new PayloadLoggingInterceptor();
|
||||
appender = new CountingAppender();
|
||||
BasicConfigurator.configure(appender);
|
||||
Logger.getRootLogger().setLevel(Level.DEBUG);
|
||||
MockWebServiceMessage request = new MockWebServiceMessage("<request/>");
|
||||
messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
|
||||
appender.reset();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
BasicConfigurator.resetConfiguration();
|
||||
ClassPathResource resource = new ClassPathResource("log4j.properties");
|
||||
PropertyConfigurator.configure(resource.getURL());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleRequestDisabled() throws Exception {
|
||||
interceptor.setLogRequest(false);
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleRequest(messageContext, null);
|
||||
Assert.assertEquals("PayloadLoggingInterceptor logged when disabled", appender.getCount(), eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleRequestEnabled() throws Exception {
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleRequest(messageContext, null);
|
||||
Assert.assertTrue("PayloadLoggingInterceptor did not log", appender.getCount() > eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleResponseDisabled() throws Exception {
|
||||
MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
|
||||
response.setPayload("<response/>");
|
||||
interceptor.setLogResponse(false);
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleResponse(messageContext, null);
|
||||
Assert.assertEquals("PayloadLoggingInterceptor logged when disabled", appender.getCount(), eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleResponseEnabled() throws Exception {
|
||||
MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
|
||||
response.setPayload("<response/>");
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleResponse(messageContext, null);
|
||||
Assert.assertTrue("PayloadLoggingInterceptor did not log", appender.getCount() > eventCount);
|
||||
}
|
||||
|
||||
private static class CountingAppender extends AppenderSkeleton {
|
||||
|
||||
private int count;
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void append(LoggingEvent loggingEvent) {
|
||||
count++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresLayout() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.soap.server.endpoint.interceptor;
|
||||
|
||||
import org.apache.log4j.AppenderSkeleton;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.apache.log4j.spi.LoggingEvent;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.ws.context.DefaultMessageContext;
|
||||
import org.springframework.ws.context.MessageContext;
|
||||
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
|
||||
|
||||
@Ignore
|
||||
public class SoapEnvelopeLoggingInterceptorTest {
|
||||
|
||||
private SoapEnvelopeLoggingInterceptor interceptor;
|
||||
|
||||
private CountingAppender appender;
|
||||
|
||||
private MessageContext messageContext;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
interceptor = new SoapEnvelopeLoggingInterceptor();
|
||||
appender = new SoapEnvelopeLoggingInterceptorTest.CountingAppender();
|
||||
BasicConfigurator.configure(appender);
|
||||
Logger.getRootLogger().setLevel(Level.DEBUG);
|
||||
SaajSoapMessageFactory factory = new SaajSoapMessageFactory();
|
||||
factory.afterPropertiesSet();
|
||||
messageContext = new DefaultMessageContext(factory);
|
||||
appender.reset();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
BasicConfigurator.resetConfiguration();
|
||||
ClassPathResource resource = new ClassPathResource("log4j.properties");
|
||||
PropertyConfigurator.configure(resource.getURL());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleRequestDisabled() throws Exception {
|
||||
interceptor.setLogRequest(false);
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleRequest(messageContext, null);
|
||||
Assert.assertEquals("interceptor logged when disabled", appender.getCount(), eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleRequestEnabled() throws Exception {
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleRequest(messageContext, null);
|
||||
Assert.assertTrue("interceptor did not log", appender.getCount() > eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleResponseDisabled() throws Exception {
|
||||
messageContext.getResponse();
|
||||
interceptor.setLogResponse(false);
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleResponse(messageContext, null);
|
||||
Assert.assertEquals("interceptor logged when disabled", appender.getCount(), eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleResponseEnabled() throws Exception {
|
||||
messageContext.getResponse();
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleResponse(messageContext, null);
|
||||
Assert.assertTrue("interceptor did not log", appender.getCount() > eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleFaultDisabled() throws Exception {
|
||||
messageContext.getResponse();
|
||||
interceptor.setLogFault(false);
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleFault(messageContext, null);
|
||||
Assert.assertEquals("interceptor logged when disabled", appender.getCount(), eventCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleFaultEnabled() throws Exception {
|
||||
messageContext.getResponse();
|
||||
int eventCount = appender.getCount();
|
||||
interceptor.handleResponse(messageContext, null);
|
||||
Assert.assertTrue("interceptor did not log", appender.getCount() > eventCount);
|
||||
}
|
||||
|
||||
private static class CountingAppender extends AppenderSkeleton {
|
||||
|
||||
private int count;
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void append(LoggingEvent loggingEvent) {
|
||||
count++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresLayout() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.ws.transport.support;
|
||||
|
||||
import java.net.URI;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -45,6 +44,7 @@ public class WebServiceMessageReceiverObjectSupportTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
receiverSupport = new MyReceiverSupport();
|
||||
messageFactory = new MockWebServiceMessageFactory();
|
||||
receiverSupport.setMessageFactory(messageFactory);
|
||||
@@ -54,7 +54,7 @@ public class WebServiceMessageReceiverObjectSupportTest {
|
||||
|
||||
@Test
|
||||
public void handleConnectionResponse() throws Exception {
|
||||
expect(connectionMock.getUri()).andReturn(new URI("http://example.com"));
|
||||
|
||||
expect(connectionMock.receive(messageFactory)).andReturn(request);
|
||||
connectionMock.setFaultCode(null);
|
||||
connectionMock.send(isA(WebServiceMessage.class));
|
||||
@@ -80,7 +80,6 @@ public class WebServiceMessageReceiverObjectSupportTest {
|
||||
public void handleConnectionFaultResponse() throws Exception {
|
||||
final QName faultCode = SoapVersion.SOAP_11.getClientOrSenderFaultName();
|
||||
|
||||
expect(connectionMock.getUri()).andReturn(new URI("http://example.com"));
|
||||
expect(connectionMock.receive(messageFactory)).andReturn(request);
|
||||
connectionMock.setFaultCode(faultCode);
|
||||
connectionMock.send(isA(WebServiceMessage.class));
|
||||
@@ -106,7 +105,7 @@ public class WebServiceMessageReceiverObjectSupportTest {
|
||||
|
||||
@Test
|
||||
public void handleConnectionNoResponse() throws Exception {
|
||||
expect(connectionMock.getUri()).andReturn(new URI("http://example.com"));
|
||||
|
||||
expect(connectionMock.receive(messageFactory)).andReturn(request);
|
||||
connectionMock.close();
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<version>3.0.2.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-security</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<version>3.0.2.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-support</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<version>3.0.2.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-test</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<version>3.0.2.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-xml</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user