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 33733a6040818347f8f463b0e8bff9211ad6a20e
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Jul 29 16:21:09 2019 +0200

    Camel-Opentracing: Use BindToRegistry annotation wherever possible
---
 .../OpentracingSpanCollectorInRegistryTest.java            | 10 +++-------
 .../agent/InstallOpenTracingTracerRuleTest.java            | 14 +++-----------
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git 
a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpentracingSpanCollectorInRegistryTest.java
 
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpentracingSpanCollectorInRegistryTest.java
index 72da1e5..401a78e 100644
--- 
a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpentracingSpanCollectorInRegistryTest.java
+++ 
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpentracingSpanCollectorInRegistryTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.opentracing;
 import io.opentracing.noop.NoopTracer;
 import io.opentracing.noop.NoopTracerFactory;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
@@ -27,6 +28,8 @@ import org.junit.Test;
 public class OpentracingSpanCollectorInRegistryTest extends CamelTestSupport {
 
     private OpenTracingTracer openTracing;
+    @BindToRegistry("tracer")
+    private NoopTracer c = NoopTracerFactory.create();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
@@ -38,13 +41,6 @@ public class OpentracingSpanCollectorInRegistryTest extends 
CamelTestSupport {
         return context;
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("tracer", NoopTracerFactory.create());
-        return registry;
-    }
-
     @Test
     public void testZipkinConfiguration() throws Exception {
         assertNotNull(openTracing.getTracer());
diff --git 
a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/agent/InstallOpenTracingTracerRuleTest.java
 
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/agent/InstallOpenTracingTracerRuleTest.java
index 91a316a..58cc290 100644
--- 
a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/agent/InstallOpenTracingTracerRuleTest.java
+++ 
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/agent/InstallOpenTracingTracerRuleTest.java
@@ -23,6 +23,7 @@ import io.opentracing.mock.MockTracer;
 import io.opentracing.mock.MockTracer.Propagator;
 import io.opentracing.tag.Tags;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
@@ -37,6 +38,7 @@ import org.junit.Test;
 @Ignore
 public class InstallOpenTracingTracerRuleTest extends CamelTestSupport {
 
+    @BindToRegistry("tracer")
     private static MockTracer tracer = new MockTracer(Propagator.TEXT_MAP);
 
     @EndpointInject("mock:result")
@@ -55,16 +57,6 @@ public class InstallOpenTracingTracerRuleTest extends 
CamelTestSupport {
     }
 
     @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-
-        // Add the mock tracer to the registry
-        registry.bind("tracer", tracer);
-
-        return registry;
-    }
-
-    @Override
     public boolean isDumpRouteCoverage() {
         return true;
     }
@@ -75,7 +67,7 @@ public class InstallOpenTracingTracerRuleTest extends 
CamelTestSupport {
 
         resultEndpoint.expectedBodiesReceived(expectedBody);
 
-        template.sendBodyAndHeader(expectedBody,  "foo",  "bar");
+        template.sendBodyAndHeader(expectedBody, "foo", "bar");
 
         resultEndpoint.assertIsSatisfied();
 

Reply via email to