Solved a failing unittest
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/36be62ed Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/36be62ed Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/36be62ed Branch: refs/heads/master Commit: 36be62ed3b7aad95888b0604f2b420ba1561734c Parents: 30a4e16 Author: Arno Noordover <a...@noordover.net> Authored: Fri May 27 19:36:33 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat May 28 15:55:54 2016 +0200 ---------------------------------------------------------------------- .../camel/component/cxf/CxfEndpointTest.java | 49 +++++++++----------- .../src/test/resources/log4j.properties | 2 +- 2 files changed, 24 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/36be62ed/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java index 485ba3a..32dd03d 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java @@ -24,7 +24,6 @@ import org.apache.camel.component.cxf.CxfEndpoint.CamelCxfClientImpl; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.SimpleRegistry; import org.apache.camel.spring.SpringCamelContext; -import org.apache.camel.util.jsse.SSLContextParameters; import org.apache.cxf.BusFactory; import org.apache.cxf.bus.extension.ExtensionManagerBus; import org.apache.cxf.endpoint.Client; @@ -37,43 +36,43 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; /** * A unit test for spring configured cxf endpoint. - * - * @version + * + * @version */ public class CxfEndpointTest extends Assert { - private int port1 = CXFTestSupport.getPort1(); - private int port2 = CXFTestSupport.getPort2(); + private int port1 = CXFTestSupport.getPort1(); + private int port2 = CXFTestSupport.getPort2(); private String routerEndpointURI = "cxf://http://localhost:" + port1 + "/CxfEndpointTest/router" - + "?serviceClass=org.apache.camel.component.cxf.HelloService" - + "&dataFormat=POJO"; + + "?serviceClass=org.apache.camel.component.cxf.HelloService" + + "&dataFormat=POJO"; private String wsdlEndpointURI = "cxf://http://localhost:" + port2 + "/CxfEndpointTest/helloworld" - + "?wsdlURL=classpath:person.wsdl" - + "&serviceName={http://camel.apache.org/wsdl-first}PersonService" - + "&portName={http://camel.apache.org/wsdl-first}soap" - + "&dataFormat=PAYLOAD"; + + "?wsdlURL=classpath:person.wsdl" + + "&serviceName={http://camel.apache.org/wsdl-first}PersonService" + + "&portName={http://camel.apache.org/wsdl-first}soap" + + "&dataFormat=PAYLOAD"; @Test public void testSettingContinucationTimout() throws Exception { CamelContext context = new DefaultCamelContext(); CxfEndpoint endpoint = context.getEndpoint(routerEndpointURI + "&continuationTimeout=800000", - CxfEndpoint.class); + CxfEndpoint.class); assertEquals("Get a wrong continucationTimeout value", 800000, endpoint.getContinuationTimeout()); } - + @Test public void testSpringCxfEndpoint() throws Exception { ClassPathXmlApplicationContext ctx = - new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/CxfEndpointBeans.xml"}); + new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/CxfEndpointBeans.xml"}); CxfComponent cxfComponent = new CxfComponent(new SpringCamelContext(ctx)); CxfSpringEndpoint endpoint = (CxfSpringEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint"); assertEquals("Got the wrong endpoint address", endpoint.getAddress(), - "http://localhost:" + port2 + "/CxfEndpointTest/helloworld"); + "http://localhost:" + port2 + "/CxfEndpointTest/helloworld"); assertEquals("Got the wrong endpont service class", - endpoint.getServiceClass().getCanonicalName(), - "org.apache.camel.component.cxf.HelloService"); + endpoint.getServiceClass().getCanonicalName(), + "org.apache.camel.component.cxf.HelloService"); } @Test @@ -81,7 +80,7 @@ public class CxfEndpointTest extends Assert { ExtensionManagerBus bus = (ExtensionManagerBus) BusFactory.newInstance().createBus(); bus.setId("oldCXF"); BusFactory.setThreadDefaultBus(bus); - + ExtensionManagerBus newBus = (ExtensionManagerBus) BusFactory.newInstance().createBus(); newBus.setId("newCXF"); CxfComponent cxfComponent = new CxfComponent(new DefaultCamelContext()); @@ -89,25 +88,23 @@ public class CxfEndpointTest extends Assert { endpoint.setBus(newBus); CamelCxfClientImpl client = (CamelCxfClientImpl)endpoint.createClient(); assertEquals("CamelCxfClientImpl should has the same bus with CxfEndpoint", newBus, client.getBus()); - + endpoint = (CxfEndpoint)cxfComponent.createEndpoint(wsdlEndpointURI); endpoint.setBus(newBus); client = (CamelCxfClientImpl)endpoint.createClient(); assertEquals("CamelCxfClientImpl should has the same bus with CxfEndpoint", newBus, client.getBus()); } - + @Test public void testCxfEndpointConfigurer() throws Exception { SimpleRegistry registry = new SimpleRegistry(); CxfEndpointConfigurer configurer = EasyMock.createMock(CxfEndpointConfigurer.class); - SSLContextParameters sslContextParameters = EasyMock.createMock(SSLContextParameters.class); Processor processor = EasyMock.createMock(Processor.class); registry.put("myConfigurer", configurer); - registry.put("sslContextParameters", sslContextParameters); CamelContext camelContext = new DefaultCamelContext(registry); CxfComponent cxfComponent = new CxfComponent(camelContext); - CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint(routerEndpointURI + "&cxfEndpointConfigurer=#myConfigurer&sslContextParameters=sslContextParameters"); - + CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint(routerEndpointURI + "&cxfEndpointConfigurer=#myConfigurer"); + configurer.configure(EasyMock.isA(AbstractWSDLBasedEndpointFactory.class)); EasyMock.expectLastCall(); configurer.configureServer(EasyMock.isA(Server.class)); @@ -115,7 +112,7 @@ public class CxfEndpointTest extends Assert { EasyMock.replay(configurer); endpoint.createConsumer(processor); EasyMock.verify(configurer); - + EasyMock.reset(configurer); configurer.configure(EasyMock.isA(AbstractWSDLBasedEndpointFactory.class)); EasyMock.expectLastCall(); @@ -125,7 +122,7 @@ public class CxfEndpointTest extends Assert { Producer producer = endpoint.createProducer(); producer.start(); EasyMock.verify(configurer); - + } } http://git-wip-us.apache.org/repos/asf/camel/blob/36be62ed/components/camel-cxf/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/resources/log4j.properties b/components/camel-cxf/src/test/resources/log4j.properties index 3d39228..aa9e83b 100644 --- a/components/camel-cxf/src/test/resources/log4j.properties +++ b/components/camel-cxf/src/test/resources/log4j.properties @@ -18,7 +18,7 @@ # # The logging properties used during tests.. # -log4j.rootLogger=DEBUG, file +log4j.rootLogger=INFO, file log4j.logger.org.apache.activemq.spring=WARN #log4j.logger.org.apache.camel.component=TRACE