This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit b81a76f26100b8c3b1f51c530732a460981b586c Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Fri Jul 24 11:37:56 2020 +0200 [CAMEL-11807] Upgrade camel-spring-ws to junit5 --- components/camel-spring-ws/pom.xml | 6 +-- .../spring/ws/ConsumerBreadcrumbIdTest.java | 20 ++++----- ...ConsumerEndpointMappingByBeanNameRouteTest.java | 10 +++-- ...erEndpointMappingResponseHandlingRouteTest.java | 10 +++-- .../ws/ConsumerEndpointMappingRouteTest.java | 26 +++++++----- .../ws/ConsumerExceptionPropagationRouteTest.java | 20 ++++----- .../spring/ws/ConsumerMarshallingRouteTest.java | 18 +++++---- .../ws/MessageFilterResolvingDefaultsTest.java | 11 +++-- .../spring/ws/MessageFilterResolvingTest.java | 11 +++-- .../spring/ws/ProducerLocalRouteTest.java | 14 ++++--- .../spring/ws/ProducerRemoteRouteTest.java | 23 ++++++----- .../spring/ws/ProducerRemoteRouteTimeOutTest.java | 16 ++++---- .../camel/component/spring/ws/SoapHeaderTest.java | 12 +++--- .../spring/ws/SoapResponseAttachmentTest.java | 6 ++- .../ws/addressing/AbstractConsumerTests.java | 12 +++--- .../spring/ws/addressing/AbstractWSATests.java | 47 ++++------------------ .../ws/addressing/CamelDirectSenderTest.java | 10 +++-- .../ConsumerWSAEndpointMappingRouteTest.java | 20 +++++---- .../ConsumerWSANewChannelParamsActionTests.java | 2 + .../ConsumerWSANewChannelParamsToTests.java | 2 + .../ConsumerWSASameChannelParamsActionTests.java | 2 + .../ConsumerWSASameChannelParamsToTests.java | 2 + .../ws/addressing/ProducerParamsBasicTest.java | 14 ++++--- .../addressing/ProducerParamsPrecedenceTest.java | 20 ++++----- .../ws/filter/impl/BasicMessageFilterTest.java | 11 ++--- .../security/ProducerWss4JSecurityHeaderTest.java | 16 +++++--- .../camel/component/spring/ws/utils/TestUtil.java | 8 ++-- 27 files changed, 192 insertions(+), 177 deletions(-) diff --git a/components/camel-spring-ws/pom.xml b/components/camel-spring-ws/pom.xml index adff057..db44504 100644 --- a/components/camel-spring-ws/pom.xml +++ b/components/camel-spring-ws/pom.xml @@ -138,7 +138,7 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring</artifactId> + <artifactId>camel-test-spring-junit5</artifactId> <scope>test</scope> </dependency> <dependency> @@ -164,8 +164,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerBreadcrumbIdTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerBreadcrumbIdTest.java index 32f2d25..64a9f56 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerBreadcrumbIdTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerBreadcrumbIdTest.java @@ -24,19 +24,21 @@ import org.apache.camel.component.spring.ws.jaxb.QuoteRequest; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.spi.Registry; import org.apache.camel.support.SimpleRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.ws.client.core.WebServiceTemplate; -@Ignore("TODO: investigate for Camel 3.0") +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@Disabled("TODO: investigate for Camel 3.0") @ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@CamelSpringTest public class ConsumerBreadcrumbIdTest extends CamelTestSupport { @Autowired @@ -46,7 +48,7 @@ public class ConsumerBreadcrumbIdTest extends CamelTestSupport { private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); context.setTracing(true); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingByBeanNameRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingByBeanNameRouteTest.java index b45b1d9..a105fec 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingByBeanNameRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingByBeanNameRouteTest.java @@ -23,13 +23,15 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.camel.component.spring.ws.utils.TestUtil; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Before; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.client.core.WebServiceTemplate; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class ConsumerEndpointMappingByBeanNameRouteTest extends CamelSpringTestSupport { private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.stockquotes.edu/\"><symbol>GOOG</symbol></GetQuote>"; @@ -38,7 +40,7 @@ public class ConsumerEndpointMappingByBeanNameRouteTest extends CamelSpringTestS private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); webServiceTemplate = applicationContext.getBean("webServiceTemplate", WebServiceTemplate.class); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingResponseHandlingRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingResponseHandlingRouteTest.java index ddc113a..1543583 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingResponseHandlingRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingResponseHandlingRouteTest.java @@ -25,9 +25,9 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.camel.component.spring.ws.utils.TestUtil; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Before; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.client.core.WebServiceTemplate; @@ -35,6 +35,8 @@ import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.version.Addressing10; import org.springframework.ws.soap.client.core.SoapActionCallback; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class ConsumerEndpointMappingResponseHandlingRouteTest extends CamelSpringTestSupport { private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; @@ -45,7 +47,7 @@ public class ConsumerEndpointMappingResponseHandlingRouteTest extends CamelSprin private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); webServiceTemplate = applicationContext.getBean("webServiceTemplate", WebServiceTemplate.class); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingRouteTest.java index bce624b..9009af3 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerEndpointMappingRouteTest.java @@ -25,9 +25,9 @@ import javax.xml.transform.stream.StreamSource; import org.apache.camel.EndpointInject; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Before; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.client.WebServiceIOException; @@ -35,6 +35,8 @@ import org.springframework.ws.client.core.SourceExtractor; import org.springframework.ws.client.core.WebServiceTemplate; import org.springframework.ws.soap.client.core.SoapActionCallback; +import static org.junit.jupiter.api.Assertions.assertThrows; + public class ConsumerEndpointMappingRouteTest extends CamelSpringTestSupport { private static final SourceExtractor<Object> NOOP_SOURCE_EXTRACTOR = new SourceExtractor<Object>() { @@ -65,7 +67,7 @@ public class ConsumerEndpointMappingRouteTest extends CamelSpringTestSupport { private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); webServiceTemplate = applicationContext.getBean("webServiceTemplate", WebServiceTemplate.class); @@ -86,10 +88,12 @@ public class ConsumerEndpointMappingRouteTest extends CamelSpringTestSupport { resultEndpointSoapAction.assertIsSatisfied(); } - @Test(expected = WebServiceIOException.class) + @Test public void testWrongSoapAction() throws Exception { - webServiceTemplate.sendSourceAndReceive(getDefaultXmlRequestSource(), new SoapActionCallback("http://this-is-a-wrong-soap-action"), NOOP_SOURCE_EXTRACTOR); - resultEndpointSoapAction.assertIsNotSatisfied(); + assertThrows(WebServiceIOException.class, () -> { + webServiceTemplate.sendSourceAndReceive(getDefaultXmlRequestSource(), new SoapActionCallback("http://this-is-a-wrong-soap-action"), NOOP_SOURCE_EXTRACTOR); + resultEndpointSoapAction.assertIsNotSatisfied(); + }); } @Test @@ -127,10 +131,12 @@ public class ConsumerEndpointMappingRouteTest extends CamelSpringTestSupport { resultEndpointUriPath.assertIsSatisfied(); } - @Test(expected = WebServiceIOException.class) + @Test public void testWrongUri() throws Exception { - webServiceTemplate.sendSourceAndReceive("http://localhost/wrong", getDefaultXmlRequestSource(), NOOP_SOURCE_EXTRACTOR); - resultEndpointUri.assertIsNotSatisfied(); + assertThrows(WebServiceIOException.class, () -> { + webServiceTemplate.sendSourceAndReceive("http://localhost/wrong", getDefaultXmlRequestSource(), NOOP_SOURCE_EXTRACTOR); + resultEndpointUri.assertIsNotSatisfied(); + }); } @Override diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerExceptionPropagationRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerExceptionPropagationRouteTest.java index 25b7744..43081bb 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerExceptionPropagationRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerExceptionPropagationRouteTest.java @@ -26,22 +26,23 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.spring.ws.bean.CamelEndpointMapping; import org.apache.camel.spi.Registry; import org.apache.camel.support.SimpleRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.ws.test.server.MockWebServiceClient; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.springframework.ws.test.server.RequestCreators.withPayload; import static org.springframework.ws.test.server.ResponseMatchers.serverOrReceiverFault; @ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@CamelSpringTest public class ConsumerExceptionPropagationRouteTest extends CamelTestSupport { private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; @@ -54,11 +55,12 @@ public class ConsumerExceptionPropagationRouteTest extends CamelTestSupport { private MockWebServiceClient mockClient; - @Before + @BeforeEach public void createClient() { mockClient = MockWebServiceClient.createClient(applicationContext); } + @BeforeEach @Override public void setUp() throws Exception { super.setUp(); @@ -72,7 +74,7 @@ public class ConsumerExceptionPropagationRouteTest extends CamelTestSupport { return registry; } - @Ignore("For now getEndpointUri does not return the initial uri. Info like the endpoint scheme is lost") + @Disabled("For now getEndpointUri does not return the initial uri. Info like the endpoint scheme is lost") @Test public void testValidUri() throws Exception { String deprecate = "spring-ws:rootqname:{http://www.webserviceX.NET/}GetQuote?endpointMapping=#endpointMapping"; diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerMarshallingRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerMarshallingRouteTest.java index 014f523..715bff0 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerMarshallingRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ConsumerMarshallingRouteTest.java @@ -24,17 +24,21 @@ import org.apache.camel.component.spring.ws.jaxb.QuoteResponse; import org.apache.camel.model.dataformat.JaxbDataFormat; import org.apache.camel.spi.Registry; import org.apache.camel.support.SimpleRegistry; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.ws.client.core.WebServiceTemplate; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + @ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) +@CamelSpringTest public class ConsumerMarshallingRouteTest extends CamelTestSupport { @Autowired @@ -44,7 +48,7 @@ public class ConsumerMarshallingRouteTest extends CamelTestSupport { private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); context.setTracing(true); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingDefaultsTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingDefaultsTest.java index 57cce8b..3c42a94 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingDefaultsTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingDefaultsTest.java @@ -23,13 +23,12 @@ import javax.xml.namespace.QName; import net.javacrumbs.smock.springws.client.AbstractSmockClientTest; import org.apache.camel.ProducerTemplate; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.test.client.RequestMatcher; @@ -37,7 +36,7 @@ import org.springframework.ws.test.client.RequestMatcher; * Check if the MessageFilter is used and resolved from endpoint uri or global * context configuration. */ -@RunWith(SpringJUnit4ClassRunner.class) +@CamelSpringTest @ContextConfiguration(locations = {"classpath:org/apache/camel/component/spring/ws/DefaultMessageFilter-context.xml"}) public class MessageFilterResolvingDefaultsTest extends AbstractSmockClientTest { @@ -76,7 +75,7 @@ public class MessageFilterResolvingDefaultsTest extends AbstractSmockClientTest } @Override - @After + @AfterEach public void verify() { super.verify(); } diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingTest.java index 2e7445d..ba028ec 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/MessageFilterResolvingTest.java @@ -23,13 +23,12 @@ import javax.xml.namespace.QName; import net.javacrumbs.smock.springws.client.AbstractSmockClientTest; import org.apache.camel.ProducerTemplate; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.ws.WebServiceMessage; import org.springframework.ws.test.client.RequestMatcher; @@ -37,7 +36,7 @@ import org.springframework.ws.test.client.RequestMatcher; * Check if the MessageFilter is used and resolved from endpoint uri or global * context configuration. */ -@RunWith(SpringJUnit4ClassRunner.class) +@CamelSpringTest @ContextConfiguration(locations = {"classpath:org/apache/camel/component/spring/ws/MessageFilter-context.xml"}) public class MessageFilterResolvingTest extends AbstractSmockClientTest { @Autowired @@ -89,7 +88,7 @@ public class MessageFilterResolvingTest extends AbstractSmockClientTest { } @Override - @After + @AfterEach public void verify() { super.verify(); } diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java index b509ee3..f7cd94a 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java @@ -24,17 +24,19 @@ import org.apache.camel.Message; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.apache.camel.util.xml.StringSource; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +@CamelSpringTest @ContextConfiguration -public class ProducerLocalRouteTest extends AbstractJUnit4SpringContextTests { +public class ProducerLocalRouteTest { private final String stockQuoteWebserviceUri = "http://localhost/"; private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; @@ -129,6 +131,6 @@ public class ProducerLocalRouteTest extends AbstractJUnit4SpringContextTests { assertTrue(resultMessage.contains("Google Inc.")); Object bar = in.getHeader("foo"); - assertEquals("The header value should have been preserved", "bar", bar); + assertEquals("bar", bar, "The header value should have been preserved"); } } diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTest.java index 116e372..81d3fe6 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTest.java @@ -20,18 +20,21 @@ import javax.xml.transform.Source; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.apache.camel.util.xml.StringSource; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -@Ignore("Run manually, makes connection to external webservice") +@Disabled("Run manually, makes connection to external webservice") +@CamelSpringTest @ContextConfiguration -public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { +public class ProducerRemoteRouteTest { private final String stockQuoteWebserviceUri = "http://www.webservicex.net/stockquote.asmx"; private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; @@ -39,7 +42,7 @@ public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { @Produce private ProducerTemplate template; - @Test(timeout = 5000) + @Test @Timeout(5) public void consumeStockQuoteWebserviceWithDefaultTemplate() throws Exception { Object result = template.requestBody("direct:stockQuoteWebserviceWithDefaultTemplate", xmlRequestForGoogleStockQuote); @@ -47,7 +50,7 @@ public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { assertTrue(result instanceof Source); } - @Test(timeout = 5000) + @Test @Timeout(5) public void consumeStockQuoteWebservice() throws Exception { Object result = template.requestBody("direct:stockQuoteWebservice", xmlRequestForGoogleStockQuote); @@ -55,7 +58,7 @@ public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { assertTrue(result instanceof Source); } - @Test(timeout = 5000) + @Test @Timeout(5) public void consumeStockQuoteWebserviceWithCamelStringSourceInput() throws Exception { Object result = template.requestBody("direct:stockQuoteWebservice", new StringSource(xmlRequestForGoogleStockQuote)); @@ -63,7 +66,7 @@ public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { assertTrue(result instanceof Source); } - @Test(timeout = 5000) + @Test @Timeout(5) public void consumeStockQuoteWebserviceWithNonDefaultMessageFactory() throws Exception { Object result = template.requestBody("direct:stockQuoteWebserviceWithNonDefaultMessageFactory", xmlRequestForGoogleStockQuote); @@ -71,7 +74,7 @@ public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { assertTrue(result instanceof Source); } - @Test(timeout = 5000) + @Test @Timeout(5) public void consumeStockQuoteWebserviceAndConvertResult() throws Exception { Object result = template.requestBody("direct:stockQuoteWebserviceAsString", xmlRequestForGoogleStockQuote); @@ -81,7 +84,7 @@ public class ProducerRemoteRouteTest extends AbstractJUnit4SpringContextTests { assertTrue(resultMessage.contains("Google Inc.")); } - @Test(timeout = 5000) + @Test @Timeout(5) public void consumeStockQuoteWebserviceAndProvideEndpointUriByHeader() throws Exception { Object result = template.requestBodyAndHeader("direct:stockQuoteWebserviceWithoutDefaultUri", xmlRequestForGoogleStockQuote, SpringWebserviceConstants.SPRING_WS_ENDPOINT_URI, stockQuoteWebserviceUri); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java index cc389a5..656b39e 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java @@ -21,18 +21,20 @@ import java.net.SocketTimeoutException; import org.apache.camel.CamelExecutionException; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; -import org.junit.Ignore; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -@Ignore("Run manually, makes connection to external webservice") +@Disabled("Run manually, makes connection to external webservice") +@CamelSpringTest @ContextConfiguration -public class ProducerRemoteRouteTimeOutTest extends AbstractJUnit4SpringContextTests { +public class ProducerRemoteRouteTimeOutTest { private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java index 28ae07e..204e70b 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapHeaderTest.java @@ -20,15 +20,17 @@ import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.Test; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@CamelSpringTest @ContextConfiguration -public class SoapHeaderTest extends AbstractJUnit4SpringContextTests { +public class SoapHeaderTest { private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; private final String soapHeader = "<h:Header xmlns:h=\"http://www.webserviceX.NET/\"><h:MessageID>1234567890</h:MessageID><h:Nested><h:NestedID>1111</h:NestedID></h:Nested></h:Header>"; diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapResponseAttachmentTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapResponseAttachmentTest.java index 32264c5..8b91062 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapResponseAttachmentTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/SoapResponseAttachmentTest.java @@ -23,14 +23,16 @@ import org.apache.camel.Processor; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.attachment.AttachmentMessage; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTest; +import org.junit.jupiter.api.Test; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; import static org.junit.Assert.assertNotNull; +@CamelSpringTest @ContextConfiguration -public class SoapResponseAttachmentTest extends AbstractJUnit4SpringContextTests { +public class SoapResponseAttachmentTest { private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>"; private final String soapHeader = "<h:Header xmlns:h=\"http://www.webserviceX.NET/\"><h:MessageID>1234567890</h:MessageID><h:Nested><h:NestedID>1111</h:NestedID></h:Nested></h:Header>"; diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractConsumerTests.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractConsumerTests.java index b7e6bd6..37c24ee 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractConsumerTests.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractConsumerTests.java @@ -19,8 +19,8 @@ package org.apache.camel.component.spring.ws.addressing; import java.net.URI; import org.fest.assertions.Assertions; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.client.SoapFaultClientException; @@ -71,7 +71,7 @@ public abstract class AbstractConsumerTests extends AbstractWSATests { } @Test - @Ignore(value = "Not implemented yet") + @Disabled(value = "Not implemented yet") public void overrideHeaderAction4output() throws Exception { ActionCallback requestCallback = channelIn("http://override-ok.com"); @@ -81,7 +81,7 @@ public abstract class AbstractConsumerTests extends AbstractWSATests { } @Test - @Ignore(value = "Not implemented yet") + @Disabled(value = "Not implemented yet") public void overrideHeaderAction4fault() throws Exception { ActionCallback requestCallback = channelIn("http://override-fault.com"); try { @@ -93,7 +93,7 @@ public abstract class AbstractConsumerTests extends AbstractWSATests { } @Test - @Ignore(value = "Not implemented yet") + @Disabled(value = "Not implemented yet") public void headerAction4output() throws Exception { ActionCallback requestCallback = channelIn("http://headerOnly-ok.com"); @@ -103,7 +103,7 @@ public abstract class AbstractConsumerTests extends AbstractWSATests { } @Test - @Ignore(value = "Not implemented yet") + @Disabled(value = "Not implemented yet") public void headerAction4fault() throws Exception { ActionCallback requestCallback = channelIn("http://headerOnly-fault.com"); try { diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractWSATests.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractWSATests.java index 03ef559..19fd8ce 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractWSATests.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/AbstractWSATests.java @@ -26,9 +26,9 @@ import javax.xml.transform.stream.StreamSource; import org.apache.camel.component.spring.ws.utils.OutputChannelReceiver; import org.apache.camel.component.spring.ws.utils.TestUtil; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.After; -import org.junit.Before; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.springframework.ws.client.core.WebServiceTemplate; import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.addressing.client.ActionCallback; @@ -36,6 +36,9 @@ import org.springframework.ws.soap.addressing.core.EndpointReference; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; import org.springframework.ws.soap.addressing.version.Addressing10; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + /** * Provides abstract test for WS-Addressing */ @@ -51,7 +54,7 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { private String requestInputAction; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); // initialize beans for catching results @@ -69,18 +72,13 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { requestInputAction = null; } - @After + @AfterEach public void after() throws Exception { assertNotNull(result); } /** * Creates WS-Addressing Action and ReplyTo param for request - * - * @param action - * @param replyTo - * @return - * @throws URISyntaxException */ protected final ActionCallback actionAndReplyTo(String action, String replyTo) throws URISyntaxException { requestInputAction = action; @@ -93,11 +91,6 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { /** * Creates WS-Addressing Action param for request - * - * @param action - * @param replyTo - * @return - * @throws URISyntaxException */ protected final ActionCallback action(String action) throws URISyntaxException { return actionAndReplyTo(action, null); @@ -105,11 +98,6 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { /** * Creates WS-Addressing To and ReplyTo param for request - * - * @param action - * @param replyTo - * @return - * @throws URISyntaxException */ protected final ActionCallback toAndReplyTo(String to, String replyTo) throws URISyntaxException { requestInputAction = "http://doesn-not-matter.com"; @@ -122,11 +110,6 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { /** * Creates WS-Addressing To param for request - * - * @param action - * @param replyTo - * @return - * @throws URISyntaxException */ protected final ActionCallback to(String to) throws URISyntaxException { return toAndReplyTo(to, null); @@ -135,9 +118,6 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { /** * Construct a default action for the response message from the input * message using the default response action suffix. - * - * @return - * @throws URISyntaxException */ protected URI getDefaultResponseAction() throws URISyntaxException { return new URI(requestInputAction + "Response"); @@ -145,10 +125,7 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { /** * Only response is allow using a brand new channel - * - * @return */ - protected final MessageAddressingProperties newChannelParams() { assertNotNull(newReply); assertNotNull(newReply.getMessageContext()); @@ -163,8 +140,6 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { /** * Only response is allow using same channel - * - * @return */ protected final MessageAddressingProperties sameChannelParams() { // we expect the same channel reply @@ -185,18 +160,12 @@ public abstract class AbstractWSATests extends CamelSpringTestSupport { * Provides such an ActionCallback that sets the WS-Addressing param replyTo * or doesn't set WS-Addressing param replyTo. In other words it cause * response to be return using new or same channel as the request. - * - * @param action - * @return - * @throws URISyntaxException */ abstract ActionCallback channelIn(String action) throws URISyntaxException; /** * Provide corresponding results based on channel input. These two abstract * methods (channelIn and channelOut)are bind together tighly. - * - * @return */ abstract MessageAddressingProperties channelOut(); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/CamelDirectSenderTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/CamelDirectSenderTest.java index 166351c..99be246 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/CamelDirectSenderTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/CamelDirectSenderTest.java @@ -23,19 +23,23 @@ import org.apache.camel.EndpointInject; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.spring.ws.utils.OutputChannelReceiver; import org.apache.camel.component.spring.ws.utils.TestUtil; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.fest.assertions.Assertions; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +import static org.junit.jupiter.api.Assertions.assertNotNull; + /** * Provides abstract test for fault and output params for spring-ws:to: and * spring-ws:action: endpoints */ +@CamelSpringTest public class CamelDirectSenderTest extends AbstractWSATests { private OutputChannelReceiver customChannel; @@ -44,7 +48,7 @@ public class CamelDirectSenderTest extends AbstractWSATests { private MockEndpoint endpointCamelDirect; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); // initialize beans for catching results diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSAEndpointMappingRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSAEndpointMappingRouteTest.java index 73e637e..0815bc6 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSAEndpointMappingRouteTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSAEndpointMappingRouteTest.java @@ -24,9 +24,9 @@ import javax.xml.transform.stream.StreamSource; import org.apache.camel.EndpointInject; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.spring.ws.utils.TestUtil; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Before; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.client.WebServiceIOException; @@ -35,6 +35,8 @@ import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.version.Addressing10; import org.springframework.ws.soap.client.core.SoapActionCallback; +import static org.junit.jupiter.api.Assertions.assertThrows; + public class ConsumerWSAEndpointMappingRouteTest extends CamelSpringTestSupport { private final String xmlBody = "<GetQuote xmlns=\"http://www.stockquotes.edu/\"><symbol>GOOG</symbol></GetQuote>"; @@ -69,7 +71,7 @@ public class ConsumerWSAEndpointMappingRouteTest extends CamelSpringTestSupport private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); webServiceTemplate = applicationContext.getBean("webServiceTemplate", WebServiceTemplate.class); @@ -156,11 +158,13 @@ public class ConsumerWSAEndpointMappingRouteTest extends CamelSpringTestSupport resultOutputAndFault2.assertIsSatisfied(); } - @Test(expected = WebServiceIOException.class) + @Test public void testWrongWSAddressingAction() throws Exception { - StreamSource source = new StreamSource(new StringReader(xmlBody)); - webServiceTemplate.sendSourceAndReceive(source, new ActionCallback("http://this-is-a-wrong-ws-addressing-action"), TestUtil.NOOP_SOURCE_EXTRACTOR); - resultEndpointAction.assertIsSatisfied(); + assertThrows(WebServiceIOException.class, () -> { + StreamSource source = new StreamSource(new StringReader(xmlBody)); + webServiceTemplate.sendSourceAndReceive(source, new ActionCallback("http://this-is-a-wrong-ws-addressing-action"), TestUtil.NOOP_SOURCE_EXTRACTOR); + resultEndpointAction.assertIsSatisfied(); + }); } @Test diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsActionTests.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsActionTests.java index 4d519931..7416e14 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsActionTests.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsActionTests.java @@ -18,11 +18,13 @@ package org.apache.camel.component.spring.ws.addressing; import java.net.URISyntaxException; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +@CamelSpringTest public class ConsumerWSANewChannelParamsActionTests extends AbstractConsumerTests { @Override diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsToTests.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsToTests.java index 1250a7d..1d58825 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsToTests.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSANewChannelParamsToTests.java @@ -18,11 +18,13 @@ package org.apache.camel.component.spring.ws.addressing; import java.net.URISyntaxException; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +@CamelSpringTest public class ConsumerWSANewChannelParamsToTests extends AbstractConsumerTests { @Override diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsActionTests.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsActionTests.java index 4316c77..fd5ec6c 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsActionTests.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsActionTests.java @@ -18,11 +18,13 @@ package org.apache.camel.component.spring.ws.addressing; import java.net.URISyntaxException; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +@CamelSpringTest public class ConsumerWSASameChannelParamsActionTests extends AbstractConsumerTests { @Override diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsToTests.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsToTests.java index d54c032..d4b4725 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsToTests.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ConsumerWSASameChannelParamsToTests.java @@ -18,11 +18,13 @@ package org.apache.camel.component.spring.ws.addressing; import java.net.URISyntaxException; +import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.addressing.client.ActionCallback; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +@CamelSpringTest public class ConsumerWSASameChannelParamsToTests extends AbstractConsumerTests { @Override diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsBasicTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsBasicTest.java index 6214da4..0ef14b7 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsBasicTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsBasicTest.java @@ -22,16 +22,18 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.spring.ws.utils.OutputChannelReceiver; import org.apache.camel.component.spring.ws.utils.TestUtil; -import org.apache.camel.test.spring.CamelSpringTestSupport; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; import org.fest.assertions.Assertions; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class ProducerParamsBasicTest extends CamelSpringTestSupport { private static URI anonymousUri; @@ -44,14 +46,14 @@ public class ProducerParamsBasicTest extends CamelSpringTestSupport { private ProducerTemplate template; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); sender = getMandatoryBean(OutputChannelReceiver.class, "senderReceiver"); sender.clear(); } - @BeforeClass + @BeforeAll public static void setUpConstants() throws Exception { anonymousUri = new URI("http://www.w3.org/2005/08/addressing/anonymous"); } diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsPrecedenceTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsPrecedenceTest.java index 2be1934..10099bd 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsPrecedenceTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/addressing/ProducerParamsPrecedenceTest.java @@ -22,17 +22,19 @@ import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.spring.ws.utils.OutputChannelReceiver; import org.apache.camel.component.spring.ws.utils.TestUtil; -import org.apache.camel.test.spring.CamelSpringTestSupport; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; import org.fest.assertions.Assertions; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.addressing.core.MessageAddressingProperties; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class ProducerParamsPrecedenceTest extends CamelSpringTestSupport { private static URI anonymousUri; @@ -45,21 +47,21 @@ public class ProducerParamsPrecedenceTest extends CamelSpringTestSupport { private ProducerTemplate template; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); sender = getMandatoryBean(OutputChannelReceiver.class, "senderReceiver"); sender.clear(); } - @BeforeClass + @BeforeAll public static void setUpConstants() throws Exception { anonymousUri = new URI("http://www.w3.org/2005/08/addressing/anonymous"); } // TODO AZ @Test - @Ignore + @Disabled public void testWsAddressingAction() throws Exception { Object result = template.requestBody("direct:wsAddressingAction", xmlBody); assertNotNull(result); @@ -77,7 +79,7 @@ public class ProducerParamsPrecedenceTest extends CamelSpringTestSupport { // TODO AZ @Test - @Ignore + @Disabled public void testWsAddressingActionPrecendence() throws Exception { Object result = template.requestBody("direct:precedenceWsAddressingAction", xmlBody); assertNotNull(result); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilterTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilterTest.java index 2b81508..08bdb93 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilterTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/filter/impl/BasicMessageFilterTest.java @@ -21,24 +21,21 @@ import javax.xml.namespace.QName; import org.apache.camel.attachment.AttachmentMessage; import org.apache.camel.component.spring.ws.SpringWebserviceConstants; -import org.apache.camel.test.junit4.ExchangeTestSupport; +import org.apache.camel.test.junit5.ExchangeTestSupport; import org.fest.assertions.Assertions; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.ws.pox.dom.DomPoxMessage; import org.springframework.ws.pox.dom.DomPoxMessageFactory; import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.saaj.SaajSoapMessageFactory; -@RunWith(value = JUnit4.class) public class BasicMessageFilterTest extends ExchangeTestSupport { private BasicMessageFilter filter; private SoapMessage message; - @Before + @BeforeEach public void before() { filter = new BasicMessageFilter(); SaajSoapMessageFactory saajSoapMessageFactory = new SaajSoapMessageFactory(); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderTest.java index 492c162..7989f93 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderTest.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/security/ProducerWss4JSecurityHeaderTest.java @@ -20,17 +20,21 @@ import net.javacrumbs.calc.model.PlusRequest; import net.javacrumbs.calc.model.PlusResponse; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ws.client.core.WebServiceTemplate; import org.springframework.ws.client.support.interceptor.ClientInterceptor; import org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor; -@Ignore("run manually since it requires running sample" +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@Disabled("run manually since it requires running sample" + " secured ws on j2ee-compliant application server") public class ProducerWss4JSecurityHeaderTest extends CamelSpringTestSupport { @@ -40,7 +44,7 @@ public class ProducerWss4JSecurityHeaderTest extends CamelSpringTestSupport { private WebServiceTemplate webServiceTemplate; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); webServiceTemplate = applicationContext.getBean("webServiceTemplate", WebServiceTemplate.class); diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/utils/TestUtil.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/utils/TestUtil.java index 25742fd..2f4c621 100644 --- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/utils/TestUtil.java +++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/utils/TestUtil.java @@ -22,7 +22,6 @@ import java.util.Iterator; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; -import org.junit.Assert; import org.springframework.util.StringUtils; import org.springframework.ws.client.core.SourceExtractor; import org.springframework.ws.soap.SoapHeader; @@ -33,6 +32,8 @@ import org.springframework.ws.soap.addressing.version.Addressing10; import org.springframework.ws.soap.addressing.version.Addressing200408; import org.springframework.ws.soap.addressing.version.AddressingVersion; +import static org.junit.jupiter.api.Assertions.assertEquals; + public final class TestUtil { public static final SourceExtractor<Object> NOOP_SOURCE_EXTRACTOR = new SourceExtractor<Object>() { @@ -49,15 +50,12 @@ public final class TestUtil { * compare some text coming from 2 different OS. */ public static void assertEqualsIgnoreNewLinesSymbol(String expected, String actual) { - Assert.assertEquals(StringUtils.deleteAny(expected, "\n\r"), StringUtils.deleteAny(actual, "\n\r")); + assertEquals(StringUtils.deleteAny(expected, "\n\r"), StringUtils.deleteAny(actual, "\n\r")); } /** * Retrieve a WS-Addressing properties from the soapMessage - * - * @param messageContext - * @return */ public static MessageAddressingProperties getWSAProperties(SoapMessage soapMessage) { AddressingVersion[] versions = new AddressingVersion[] {new Addressing200408(), new Addressing10()};