This is an automated email from the ASF dual-hosted git repository. ffang pushed a commit to branch camel-2.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.x by this push: new 348a01f [CAMEL-13644]CxfConsumer - Should not create server in constructor 348a01f is described below commit 348a01f6acdd347f812f726fcaad6f8ff422a101 Author: Freeman Fang <freeman.f...@gmail.com> AuthorDate: Thu Jun 13 12:27:05 2019 -0400 [CAMEL-13644]CxfConsumer - Should not create server in constructor (cherry picked from commit a1709db960d387efc2028502c1e69c3d6bcedeaa) --- .../src/main/java/org/apache/camel/component/cxf/CxfConsumer.java | 1 - .../test/java/org/apache/camel/component/cxf/CxfEndpointTest.java | 5 ++++- .../org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java index ff6741b..9baf7d4 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java @@ -67,7 +67,6 @@ public class CxfConsumer extends DefaultConsumer implements Suspendable { public CxfConsumer(final CxfEndpoint endpoint, Processor processor) throws Exception { super(endpoint, processor); cxfEndpoint = endpoint; - server = createServer(); } protected Server createServer() throws Exception { 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 394ff63..43cdb46 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 @@ -18,6 +18,7 @@ package org.apache.camel.component.cxf; import org.apache.camel.CamelContext; +import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.cxf.CxfEndpoint.CamelCxfClientImpl; @@ -109,7 +110,9 @@ public class CxfEndpointTest extends Assert { CxfComponent cxfComponent = new CxfComponent(camelContext); CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint(routerEndpointURI + "&cxfEndpointConfigurer=#myConfigurer"); - endpoint.createConsumer(processor); + Consumer consumer = endpoint.createConsumer(processor); + consumer.start(); + verify(configurer).configure(isA(AbstractWSDLBasedEndpointFactory.class)); verify(configurer).configureServer(isA(Server.class)); diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java index a587619..666e11f 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java @@ -19,6 +19,7 @@ package org.apache.camel.component.cxf.util; import javax.xml.namespace.QName; import org.apache.camel.CamelContext; +import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.component.cxf.CxfComponent; @@ -106,7 +107,7 @@ public class CxfEndpointUtilsTest extends Assert { public void testCheckServiceClassConsumer() throws Exception { CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI()); try { - endpoint.createConsumer(new Processor() { + Consumer cxfConsumer = endpoint.createConsumer(new Processor() { @Override public void process(Exchange exchange) throws Exception { @@ -114,6 +115,7 @@ public class CxfEndpointUtilsTest extends Assert { } }); + cxfConsumer.start(); fail("Should have thrown exception"); } catch (IllegalArgumentException exception) { assertNotNull("Should get a CamelException here", exception);