You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2019/06/13 16:27:36 UTC
[camel] branch master updated: [CAMEL-13644]CxfConsumer - Should
not create server in constructor
This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new a1709db [CAMEL-13644]CxfConsumer - Should not create server in constructor
a1709db is described below
commit a1709db960d387efc2028502c1e69c3d6bcedeaa
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Thu Jun 13 12:27:05 2019 -0400
[CAMEL-13644]CxfConsumer - Should not create server in constructor
---
.../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 83ea4ea..9381557 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
@@ -63,7 +63,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 f305dab..d499155 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
@@ -17,6 +17,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;
@@ -106,7 +107,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 83d1f4f..f5a7291 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;
@@ -100,7 +101,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 {
@@ -108,6 +109,7 @@ public class CxfEndpointUtilsTest extends Assert {
}
});
+ cxfConsumer.start();
fail("Should have thrown exception");
} catch (IllegalArgumentException exception) {
assertNotNull("Should get a CamelException here", exception);