This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1641265e649d42ff3b54e5d29fad2d31ff1be6f8
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Tue Jul 23 09:17:32 2019 +0200

    Camel-CXF: Use BindToRegistry where possible
---
 .../camel/component/cxf/CxfProducerSessionTest.java       | 15 +++++++--------
 .../cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java | 11 ++++-------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerSessionTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerSessionTest.java
index ad9fe43..9278d91 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerSessionTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerSessionTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.cxf;
 import java.util.Collections;
 import java.util.Map;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.http.common.cookie.ExchangeCookieHandler;
@@ -39,6 +40,12 @@ public class CxfProducerSessionTest extends CamelTestSupport 
{
     private static final String REQUEST_MESSAGE_EXPRESSION = "<ns1:echo 
xmlns:ns1=\"http://cxf.component.camel.apache.org/\";><arg0>${in.body}</arg0></ns1:echo>";
     private static final Map<String, String> NAMESPACES = 
Collections.singletonMap("ns1", "http://cxf.component.camel.apache.org/";);
     private static final String PARAMETER_XPATH = 
"/ns1:echoResponse/return/text()";
+    
+    @BindToRegistry("instanceCookieHandler")
+    private InstanceCookieHandler ich = new InstanceCookieHandler();
+    
+    @BindToRegistry("exchangeCookieHandler")
+    private ExchangeCookieHandler ech = new ExchangeCookieHandler();
 
     private String url = "cxf://" + SIMPLE_SERVER_ADDRESS + 
"?serviceClass=org.apache.camel.component.cxf.EchoService&dataFormat=PAYLOAD&synchronous=true";
 
@@ -145,12 +152,4 @@ public class CxfProducerSessionTest extends 
CamelTestSupport {
             }
         };
     }
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry jndiRegistry = super.createRegistry();
-        jndiRegistry.bind("instanceCookieHandler", new 
InstanceCookieHandler());
-        jndiRegistry.bind("exchangeCookieHandler", new 
ExchangeCookieHandler());
-        return jndiRegistry;
-    }
 }
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
index cc62870..ddaf5ad 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java
@@ -22,6 +22,7 @@ import java.util.Map;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.MultivaluedMap;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.builder.RouteBuilder;
@@ -43,6 +44,9 @@ public class CxfRsBindingConfigurationSelectionTest extends 
CamelTestSupport {
     private static final String CXF_RS_ENDPOINT_URI_DEFAULT = 
String.format("cxfrs://http://localhost:%s/CxfRsConsumerTest/rest?bindingStyle=Default&";,
 CXFTestSupport.getPort3()) + RESOURCE_CLASS;
     private static final String CXF_RS_ENDPOINT_URI_NONE = 
String.format("cxfrs://http://localhost:%s/CxfRsConsumerTest/rest?";, 
CXFTestSupport.getPort4()) + RESOURCE_CLASS;
     
+    @BindToRegistry("binding")
+    private DummyCxfRsBindingImplementation dummyCxfRsBindingImplementation = 
new DummyCxfRsBindingImplementation();
+    
     @Test
     public void testCxfRsBindingConfiguration() {
         // check binding styles
@@ -61,13 +65,6 @@ public class CxfRsBindingConfigurationSelectionTest extends 
CamelTestSupport {
     private CxfRsEndpoint endpointForRouteId(String routeId) {
         return (CxfRsEndpoint) 
context.getRoute(routeId).getConsumer().getEndpoint();
     }
-    
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry answer = super.createRegistry();
-        answer.bind("binding", new DummyCxfRsBindingImplementation());
-        return answer;
-    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {

Reply via email to