camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [7/8] camel git commit: Fixed CS. This closes #1467
Date Fri, 17 Feb 2017 12:15:31 GMT
Fixed CS. This closes #1467


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dbb27d02
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dbb27d02
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dbb27d02

Branch: refs/heads/master
Commit: dbb27d0282bab674d6fcc80a515ccf5984c46d51
Parents: a011087
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Feb 17 12:58:41 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Feb 17 12:58:41 2017 +0100

----------------------------------------------------------------------
 components/camel-opentracing/pom.xml            |  2 +-
 .../opentracing/CamelHeadersExtractAdapter.java |  6 +--
 .../camel/opentracing/OpenTracingTracer.java    | 53 +++++++++-----------
 .../apache/camel/opentracing/SpanDecorator.java | 24 ++++-----
 .../decorators/AbstractHttpSpanDecorator.java   |  9 ++--
 .../decorators/AbstractSpanDecorator.java       | 10 ++--
 .../decorators/JettySpanDecorator.java          |  2 +-
 .../apache/camel/opentracing/ABCRouteTest.java  | 43 ++++++++--------
 .../CamelOpenTracingTestSupport.java            | 33 ++++++------
 .../ClientRecipientListRouteTest.java           | 45 ++++++++---------
 .../camel/opentracing/MulticastRouteTest.java   | 47 +++++++++--------
 .../opentracing/OpenTracingSimpleRouteTest.java |  8 +--
 .../camel/opentracing/RouteConcurrentTest.java  | 23 ++++-----
 .../opentracing/TestSEDASpanDecorator.java      |  3 +-
 .../camel/opentracing/TwoServiceTest.java       | 27 +++++-----
 .../src/test/resources/log4j2.properties        | 27 +++++-----
 16 files changed, 173 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/pom.xml b/components/camel-opentracing/pom.xml
index 6f0f550..3f664d8 100644
--- a/components/camel-opentracing/pom.xml
+++ b/components/camel-opentracing/pom.xml
@@ -34,7 +34,7 @@
   <properties>
     <!-- use by camel-catalog -->
     <firstVersion>2.19.0</firstVersion>
-    <label>monitoring,microservice,opentracing</label>
+    <label>monitoring,microservice</label>
 
     <camel.osgi.export.pkg>org.apache.camel.opentracing.*</camel.osgi.export.pkg>
   </properties>

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/CamelHeadersExtractAdapter.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/CamelHeadersExtractAdapter.java
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/CamelHeadersExtractAdapter.java
index cb8a9cb..c0a8ff0 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/CamelHeadersExtractAdapter.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/CamelHeadersExtractAdapter.java
@@ -25,11 +25,11 @@ import io.opentracing.propagation.TextMap;
 public final class CamelHeadersExtractAdapter implements TextMap {
     private final Map<String, String> map = new HashMap<String, String>();
 
-    public CamelHeadersExtractAdapter(final Map<String,Object> map) {
+    public CamelHeadersExtractAdapter(final Map<String, Object> map) {
         // Extract string valued map entries
         map.entrySet().stream().filter(e -> e.getValue() instanceof String).forEach(e
->
-                this.map.put(e.getKey(),(String)e.getValue()));
-     }
+            this.map.put(e.getKey(), (String) e.getValue()));
+    }
 
     @Override
     public Iterator<Map.Entry<String, String>> iterator() {

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
index 406a491..165978c 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
@@ -22,6 +22,14 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.ServiceLoader;
 
+import io.opentracing.Span;
+import io.opentracing.Tracer;
+import io.opentracing.Tracer.SpanBuilder;
+import io.opentracing.contrib.global.GlobalTracer;
+import io.opentracing.contrib.spanmanager.DefaultSpanManager;
+import io.opentracing.contrib.spanmanager.SpanManager;
+import io.opentracing.propagation.Format;
+import io.opentracing.tag.Tags;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
@@ -42,15 +50,6 @@ import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.opentracing.Span;
-import io.opentracing.Tracer;
-import io.opentracing.Tracer.SpanBuilder;
-import io.opentracing.contrib.global.GlobalTracer;
-import io.opentracing.contrib.spanmanager.DefaultSpanManager;
-import io.opentracing.contrib.spanmanager.SpanManager;
-import io.opentracing.propagation.Format;
-import io.opentracing.tag.Tags;
-
 /**
  * To use OpenTracing with Camel then setup this {@link OpenTracingTracer} in your Camel
application.
  * <p/>
@@ -63,14 +62,12 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenTracingTracer.class);
 
-    private final OpenTracingEventNotifier eventNotifier = new OpenTracingEventNotifier();
-
-    private CamelContext camelContext;
+    private static Map<String, SpanDecorator> decorators = new HashMap<>();
 
+    private final OpenTracingEventNotifier eventNotifier = new OpenTracingEventNotifier();
+    private final SpanManager spanManager = DefaultSpanManager.getInstance();
     private Tracer tracer = GlobalTracer.get();
-    private SpanManager spanManager = DefaultSpanManager.getInstance();
-
-    private static Map<String, SpanDecorator> decorators = new HashMap<>();
+    private CamelContext camelContext;
 
     static {
         ServiceLoader.load(SpanDecorator.class).forEach(d -> decorators.put(d.getComponent(),
d));
@@ -109,11 +106,11 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
     }
 
     public Tracer getTracer() {
-    	return tracer;
+        return tracer;
     }
 
     public void setTracer(Tracer tracer) {
-    	this.tracer = tracer;
+        this.tracer = tracer;
     }
 
     @Override
@@ -138,7 +135,7 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
         camelContext.getManagementStrategy().removeEventNotifier(eventNotifier);
         ServiceHelper.stopService(eventNotifier);
 
-         // remove route policy
+        // remove route policy
         camelContext.getRoutePolicyFactories().remove(this);
     }
 
@@ -159,7 +156,7 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
                 SpanManager.ManagedSpan parent = spanManager.current();
                 SpanDecorator sd = getSpanDecorator(ese.getEndpoint());
                 SpanBuilder spanBuilder = tracer.buildSpan(sd.getOperationName(ese.getExchange(),
ese.getEndpoint()))
-                		.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
+                    .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
                 // Temporary workaround to avoid adding 'null' span as a parent
                 if (parent != null && parent.getSpan() != null) {
                     spanBuilder.asChildOf(parent.getSpan());
@@ -167,7 +164,7 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
                 Span span = spanBuilder.start();
                 sd.pre(span, ese.getExchange(), ese.getEndpoint());
                 tracer.inject(span.context(), Format.Builtin.TEXT_MAP,
-                        new CamelHeadersInjectAdapter(ese.getExchange().getIn().getHeaders()));
+                    new CamelHeadersInjectAdapter(ese.getExchange().getIn().getHeaders()));
                 spanManager.manage(span);
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("OpenTracing: start client span=" + span);
@@ -177,9 +174,9 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("OpenTracing: start client span=" + managedSpan.getSpan());
                 }
-                SpanDecorator sd = getSpanDecorator(((ExchangeSentEvent)event).getEndpoint());
-                sd.post(managedSpan.getSpan(), ((ExchangeSentEvent)event).getExchange(),
-                        ((ExchangeSentEvent)event).getEndpoint());
+                SpanDecorator sd = getSpanDecorator(((ExchangeSentEvent) event).getEndpoint());
+                sd.post(managedSpan.getSpan(), ((ExchangeSentEvent) event).getExchange(),
+                    ((ExchangeSentEvent) event).getEndpoint());
                 managedSpan.getSpan().finish();
                 managedSpan.release();
             }
@@ -188,7 +185,7 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
         @Override
         public boolean isEnabled(EventObject event) {
             return event instanceof ExchangeSendingEvent
-                    || event instanceof ExchangeSentEvent;
+                || event instanceof ExchangeSentEvent;
         }
 
         @Override
@@ -206,10 +203,10 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
         public void onExchangeBegin(Route route, Exchange exchange) {
             SpanDecorator sd = getSpanDecorator(route.getEndpoint());
             Span span = tracer.buildSpan(sd.getOperationName(exchange, route.getEndpoint()))
-                    .asChildOf(tracer.extract(Format.Builtin.TEXT_MAP,
-                            new CamelHeadersExtractAdapter(exchange.getIn().getHeaders())))
-            		.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER)
-            		.start();
+                .asChildOf(tracer.extract(Format.Builtin.TEXT_MAP,
+                    new CamelHeadersExtractAdapter(exchange.getIn().getHeaders())))
+                .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER)
+                .start();
             sd.pre(span, exchange, route.getEndpoint());
             spanManager.manage(span);
             if (LOG.isTraceEnabled()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/SpanDecorator.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/SpanDecorator.java
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/SpanDecorator.java
index 5c4bdf4..1ffeac2 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/SpanDecorator.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/SpanDecorator.java
@@ -16,21 +16,28 @@
  */
 package org.apache.camel.opentracing;
 
+import io.opentracing.Span;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.opentracing.decorators.AbstractSpanDecorator;
 
-import io.opentracing.Span;
-
 /**
  * This interface represents a decorator specific to the component/endpoint
  * being instrumented.
- *
  */
 public interface SpanDecorator {
 
     /* Prefix for camel component tag */
-    public static final String CAMEL_COMPONENT = "camel-";
+    String CAMEL_COMPONENT = "camel-";
+
+    SpanDecorator DEFAULT = new AbstractSpanDecorator() {
+
+        @Override
+        public String getComponent() {
+            return null;
+        }
+
+    };
 
     /**
      * The camel component associated with the decorator.
@@ -69,13 +76,4 @@ public interface SpanDecorator {
      */
     void post(Span span, Exchange exchange, Endpoint endpoint);
 
-    SpanDecorator DEFAULT = new AbstractSpanDecorator() {
-
-        @Override
-        public String getComponent() {
-            return null;
-        }
-        
-    };
-
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
index dcd40ff..bccfade 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
@@ -16,11 +16,10 @@
  */
 package org.apache.camel.opentracing.decorators;
 
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-
 import io.opentracing.Span;
 import io.opentracing.tag.Tags;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
 
 public abstract class AbstractHttpSpanDecorator extends AbstractSpanDecorator {
 
@@ -35,9 +34,9 @@ public abstract class AbstractHttpSpanDecorator extends AbstractSpanDecorator
{
         super.post(span, exchange, endpoint);
 
         if (exchange.hasOut()) {
-            Object responseCode=exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE);
+            Object responseCode = exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE);
             if (responseCode instanceof Integer) {
-                span.setTag(Tags.HTTP_STATUS.getKey(), (Integer)responseCode);
+                span.setTag(Tags.HTTP_STATUS.getKey(), (Integer) responseCode);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
index f32a287..51da0df 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
@@ -20,16 +20,14 @@ import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 
+import io.opentracing.Span;
+import io.opentracing.tag.Tags;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.opentracing.SpanDecorator;
 
-import io.opentracing.Span;
-import io.opentracing.tag.Tags;
-
 /**
  * An abstract base implementation of the {@link SpanDecorator} interface.
- *
  */
 public abstract class AbstractSpanDecorator implements SpanDecorator {
 
@@ -39,7 +37,7 @@ public abstract class AbstractSpanDecorator implements SpanDecorator {
     }
 
     @Override
-    public void pre(Span span, Exchange exchange, Endpoint endpoint) {     
+    public void pre(Span span, Exchange exchange, Endpoint endpoint) {
         span.setTag(Tags.COMPONENT.getKey(), CAMEL_COMPONENT + URI.create(endpoint.getEndpointUri()).getScheme());
     }
 
@@ -48,7 +46,7 @@ public abstract class AbstractSpanDecorator implements SpanDecorator {
         if (exchange.isFailed()) {
             span.setTag(Tags.ERROR.getKey(), true);
             if (exchange.getException() != null) {
-                Map<String,String> logEvent = new HashMap<>();
+                Map<String, String> logEvent = new HashMap<>();
                 logEvent.put("event", "error");
                 logEvent.put("error.kind", "Exception");
                 logEvent.put("message", exchange.getException().getMessage());

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/JettySpanDecorator.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/JettySpanDecorator.java
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/JettySpanDecorator.java
index 8137100..f16669b 100644
--- a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/JettySpanDecorator.java
+++ b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/JettySpanDecorator.java
@@ -30,7 +30,7 @@ public class JettySpanDecorator extends AbstractHttpSpanDecorator {
 
     @Override
     public String getOperationName(Exchange exchange, Endpoint endpoint) {
-        return URI.create(endpoint.getEndpointUri().substring(getComponent().length()+1)).getPath();
+        return URI.create(endpoint.getEndpointUri().substring(getComponent().length() + 1)).getPath();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ABCRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ABCRouteTest.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ABCRouteTest.java
index dc172c6..d67ba9c 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ABCRouteTest.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ABCRouteTest.java
@@ -16,31 +16,30 @@
  */
 package org.apache.camel.opentracing;
 
+import io.opentracing.tag.Tags;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
-import io.opentracing.tag.Tags;
-
 public class ABCRouteTest extends CamelOpenTracingTestSupport {
 
     private static SpanTestData[] testdata = {
-            new SpanTestData().setLabel("seda:b server").setUri("seda://b")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
-            new SpanTestData().setLabel("seda:b client").setUri("seda://b")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
-            new SpanTestData().setLabel("seda:c server").setUri("seda://c")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
-            new SpanTestData().setLabel("seda:c client").setUri("seda://c")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
-            new SpanTestData().setLabel("seda:a server").setUri("seda://a")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(5),
-            new SpanTestData().setLabel("seda:a client").setUri("seda://a")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
-            new SpanTestData().setLabel("direct:start server").setUri("direct://start")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(7),
-            new SpanTestData().setLabel("direct:start client").setUri("direct://start")
-                    .setKind(Tags.SPAN_KIND_CLIENT)
+        new SpanTestData().setLabel("seda:b server").setUri("seda://b")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
+        new SpanTestData().setLabel("seda:b client").setUri("seda://b")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
+        new SpanTestData().setLabel("seda:c server").setUri("seda://c")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
+        new SpanTestData().setLabel("seda:c client").setUri("seda://c")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
+        new SpanTestData().setLabel("seda:a server").setUri("seda://a")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(5),
+        new SpanTestData().setLabel("seda:a client").setUri("seda://a")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
+        new SpanTestData().setLabel("direct:start server").setUri("direct://start")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(7),
+        new SpanTestData().setLabel("direct:start client").setUri("direct://start")
+            .setKind(Tags.SPAN_KIND_CLIENT)
     };
 
     public ABCRouteTest() {
@@ -69,12 +68,12 @@ public class ABCRouteTest extends CamelOpenTracingTestSupport {
                     .log("End of routing");
 
                 from("seda:b").routeId("b")
-                        .log("routing at ${routeId}")
-                        .delay(simple("${random(1000,2000)}"));
+                    .log("routing at ${routeId}")
+                    .delay(simple("${random(1000,2000)}"));
 
                 from("seda:c").routeId("c")
-                        .log("routing at ${routeId}")
-                        .delay(simple("${random(0,100)}"));
+                    .log("routing at ${routeId}")
+                    .delay(simple("${random(0,100)}"));
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/CamelOpenTracingTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/CamelOpenTracingTestSupport.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/CamelOpenTracingTestSupport.java
index b1f6043..6b41b40 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/CamelOpenTracingTestSupport.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/CamelOpenTracingTestSupport.java
@@ -22,13 +22,12 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.test.junit4.CamelTestSupport;
-
 import io.opentracing.Span;
 import io.opentracing.mock.MockTracer;
 import io.opentracing.mock.MockTracer.Propagator;
 import io.opentracing.tag.Tags;
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
 
 public class CamelOpenTracingTestSupport extends CamelTestSupport {
 
@@ -50,10 +49,10 @@ public class CamelOpenTracingTestSupport extends CamelTestSupport {
         CamelContext context = super.createCamelContext();
 
         tracer = new MockTracer(Propagator.TEXT_MAP);
-        
+
         OpenTracingTracer ottracer = new OpenTracingTracer();
         ottracer.setTracer(tracer);
-        
+
         ottracer.init(context);
 
         return context;
@@ -65,18 +64,18 @@ public class CamelOpenTracingTestSupport extends CamelTestSupport {
 
     protected void verify() {
         assertEquals("Incorrect number of spans", testdata.length, tracer.finishedSpans().size());
-        
-        for (int i=0; i < testdata.length; i++) {
+
+        for (int i = 0; i < testdata.length; i++) {
             if (i > 0) {
                 assertEquals(testdata[i].getLabel(), tracer.finishedSpans().get(0).context().traceId(),
-                    tracer.finishedSpans().get(i).context().traceId());   
+                    tracer.finishedSpans().get(i).context().traceId());
             }
 
-            String component = (String)tracer.finishedSpans().get(i).tags().get(Tags.COMPONENT.getKey());
+            String component = (String) tracer.finishedSpans().get(i).tags().get(Tags.COMPONENT.getKey());
             assertNotNull(component);
             assertEquals(testdata[i].getLabel(),
-                    SpanDecorator.CAMEL_COMPONENT + URI.create((String)testdata[i].getUri()).getScheme(),
-                    component);
+                SpanDecorator.CAMEL_COMPONENT + URI.create((String) testdata[i].getUri()).getScheme(),
+                component);
 
             // If span associated with TestSEDASpanDecorator, check that 'testop' and pre/post
tags have been defined
             if ("camel-seda".equals(component)) {
@@ -88,22 +87,22 @@ public class CamelOpenTracingTestSupport extends CamelTestSupport {
             }
 
             assertEquals(testdata[i].getLabel(), testdata[i].getKind(),
-                    tracer.finishedSpans().get(i).tags().get(Tags.SPAN_KIND.getKey()));
+                tracer.finishedSpans().get(i).tags().get(Tags.SPAN_KIND.getKey()));
 
             if (testdata[i].getParentId() != -1) {
                 assertEquals(testdata[i].getLabel(),
-                        tracer.finishedSpans().get(testdata[i].getParentId()).context().spanId(),
-                        tracer.finishedSpans().get(i).parentId());
+                    tracer.finishedSpans().get(testdata[i].getParentId()).context().spanId(),
+                    tracer.finishedSpans().get(i).parentId());
             }
 
         }
     }
 
     protected void verifyTraceSpanNumbers(int numOfTraces, int numSpansPerTrace) {
-        Map<Long,List<Span>> traces = new HashMap<Long,List<Span>>();
+        Map<Long, List<Span>> traces = new HashMap<Long, List<Span>>();
 
         // Sort spans into separate traces
-        for (int i=0; i < getTracer().finishedSpans().size(); i++) {
+        for (int i = 0; i < getTracer().finishedSpans().size(); i++) {
             List<Span> spans = traces.get(getTracer().finishedSpans().get(i).context().traceId());
             if (spans == null) {
                 spans = new ArrayList<Span>();
@@ -114,7 +113,7 @@ public class CamelOpenTracingTestSupport extends CamelTestSupport {
 
         assertEquals(numOfTraces, traces.size());
 
-        for (Map.Entry<Long,List<Span>> spans : traces.entrySet()) {
+        for (Map.Entry<Long, List<Span>> spans : traces.entrySet()) {
             assertEquals(numSpansPerTrace, spans.getValue().size());
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ClientRecipientListRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ClientRecipientListRouteTest.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ClientRecipientListRouteTest.java
index f9849b2..12aaea5 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ClientRecipientListRouteTest.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/ClientRecipientListRouteTest.java
@@ -16,31 +16,30 @@
  */
 package org.apache.camel.opentracing;
 
+import io.opentracing.tag.Tags;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
-import io.opentracing.tag.Tags;
-
 public class ClientRecipientListRouteTest extends CamelOpenTracingTestSupport {
 
     private static SpanTestData[] testdata = {
-            new SpanTestData().setLabel("seda:a server").setUri("seda://a")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
-            new SpanTestData().setLabel("seda:a client").setUri("seda://a")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
-            new SpanTestData().setLabel("seda:b server").setUri("seda://b")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
-            new SpanTestData().setLabel("seda:b client").setUri("seda://b")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
-            new SpanTestData().setLabel("seda:c server").setUri("seda://c")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(5),
-            new SpanTestData().setLabel("seda:c client").setUri("seda://c")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
-            new SpanTestData().setLabel("direct:start server").setUri("direct://start")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(7),
-            new SpanTestData().setLabel("direct:start client").setUri("direct://start")
-                    .setKind(Tags.SPAN_KIND_CLIENT)
+        new SpanTestData().setLabel("seda:a server").setUri("seda://a")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
+        new SpanTestData().setLabel("seda:a client").setUri("seda://a")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
+        new SpanTestData().setLabel("seda:b server").setUri("seda://b")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
+        new SpanTestData().setLabel("seda:b client").setUri("seda://b")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
+        new SpanTestData().setLabel("seda:c server").setUri("seda://c")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(5),
+        new SpanTestData().setLabel("seda:c client").setUri("seda://c")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
+        new SpanTestData().setLabel("direct:start server").setUri("direct://start")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(7),
+        new SpanTestData().setLabel("direct:start client").setUri("direct://start")
+            .setKind(Tags.SPAN_KIND_CLIENT)
     };
 
     public ClientRecipientListRouteTest() {
@@ -65,13 +64,13 @@ public class ClientRecipientListRouteTest extends CamelOpenTracingTestSupport
{
                     .log("routing at ${routeId}");
 
                 from("seda:b").routeId("b")
-                        .log("routing at ${routeId}")
-                        .delay(simple("${random(1000,2000)}"));
+                    .log("routing at ${routeId}")
+                    .delay(simple("${random(1000,2000)}"));
 
                 from("seda:c").routeId("c")
-                        .log("routing at ${routeId}")
-                        .delay(simple("${random(0,100)}"));
-           }
+                    .log("routing at ${routeId}")
+                    .delay(simple("${random(0,100)}"));
+            }
         };
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MulticastRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MulticastRouteTest.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MulticastRouteTest.java
index c24fab6..a301d35 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MulticastRouteTest.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MulticastRouteTest.java
@@ -16,31 +16,30 @@
  */
 package org.apache.camel.opentracing;
 
+import io.opentracing.tag.Tags;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
-import io.opentracing.tag.Tags;
-
 public class MulticastRouteTest extends CamelOpenTracingTestSupport {
 
     private static SpanTestData[] testdata = {
-            new SpanTestData().setLabel("seda:b server").setUri("seda://b")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
-            new SpanTestData().setLabel("seda:b client").setUri("seda://b")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
-            new SpanTestData().setLabel("seda:c server").setUri("seda://c")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
-            new SpanTestData().setLabel("seda:c client").setUri("seda://c")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
-            new SpanTestData().setLabel("seda:a server").setUri("seda://a")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(5),
-            new SpanTestData().setLabel("seda:a client").setUri("seda://a")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
-            new SpanTestData().setLabel("direct:start server").setUri("direct://start")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(7),
-            new SpanTestData().setLabel("direct:start client").setUri("direct://start")
-                    .setKind(Tags.SPAN_KIND_CLIENT)
+        new SpanTestData().setLabel("seda:b server").setUri("seda://b")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
+        new SpanTestData().setLabel("seda:b client").setUri("seda://b")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
+        new SpanTestData().setLabel("seda:c server").setUri("seda://c")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
+        new SpanTestData().setLabel("seda:c client").setUri("seda://c")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(4),
+        new SpanTestData().setLabel("seda:a server").setUri("seda://a")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(5),
+        new SpanTestData().setLabel("seda:a client").setUri("seda://a")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(6),
+        new SpanTestData().setLabel("direct:start server").setUri("direct://start")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(7),
+        new SpanTestData().setLabel("direct:start client").setUri("direct://start")
+            .setKind(Tags.SPAN_KIND_CLIENT)
     };
 
     public MulticastRouteTest() {
@@ -64,18 +63,18 @@ public class MulticastRouteTest extends CamelOpenTracingTestSupport {
                 from("seda:a").routeId("a")
                     .log("routing at ${routeId}")
                     .multicast()
-                        .to("seda:b")
-                        .to("seda:c")
+                    .to("seda:b")
+                    .to("seda:c")
                     .end()
                     .log("End of routing");
 
                 from("seda:b").routeId("b")
-                        .log("routing at ${routeId}")
-                        .delay(simple("${random(1000,2000)}"));
+                    .log("routing at ${routeId}")
+                    .delay(simple("${random(1000,2000)}"));
 
                 from("seda:c").routeId("c")
-                        .log("routing at ${routeId}")
-                        .delay(simple("${random(0,100)}"));
+                    .log("routing at ${routeId}")
+                    .delay(simple("${random(0,100)}"));
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpenTracingSimpleRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpenTracingSimpleRouteTest.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpenTracingSimpleRouteTest.java
index a844c1a..56b35a3 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpenTracingSimpleRouteTest.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpenTracingSimpleRouteTest.java
@@ -18,14 +18,13 @@ package org.apache.camel.opentracing;
 
 import java.util.concurrent.TimeUnit;
 
+import io.opentracing.mock.MockTracer;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import io.opentracing.mock.MockTracer;
-
 public class OpenTracingSimpleRouteTest extends CamelSpringTestSupport {
 
     @Override
@@ -33,7 +32,8 @@ public class OpenTracingSimpleRouteTest extends CamelSpringTestSupport {
         return new ClassPathXmlApplicationContext("org/apache/camel/opentracing/OpenTracingSimpleRouteTest.xml");
     }
 
-    @Test @org.junit.Ignore
+    @Test
+    @org.junit.Ignore
     public void testRoute() throws Exception {
         NotifyBuilder notify = new NotifyBuilder(context).whenDone(5).create();
 
@@ -43,7 +43,7 @@ public class OpenTracingSimpleRouteTest extends CamelSpringTestSupport {
 
         assertTrue(notify.matches(30, TimeUnit.SECONDS));
 
-        MockTracer tracer = (MockTracer)context().getRegistry().lookupByName("mockTracer");
+        MockTracer tracer = (MockTracer) context().getRegistry().lookupByName("mockTracer");
 
         // Four spans per invocation, one for client, two for dude route (server and client
to), one for car route
         assertEquals(20, tracer.finishedSpans().size());

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/RouteConcurrentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/RouteConcurrentTest.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/RouteConcurrentTest.java
index 6d13a8d..8471f3e 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/RouteConcurrentTest.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/RouteConcurrentTest.java
@@ -18,24 +18,23 @@ package org.apache.camel.opentracing;
 
 import java.util.concurrent.TimeUnit;
 
+import io.opentracing.tag.Tags;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
-import io.opentracing.tag.Tags;
-
 public class RouteConcurrentTest extends CamelOpenTracingTestSupport {
 
     private static SpanTestData[] testdata = {
-            new SpanTestData().setLabel("seda:foo client").setUri("seda://foo")
-                    .setKind(Tags.SPAN_KIND_CLIENT),
-            new SpanTestData().setLabel("seda:bar client").setUri("seda://bar")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(2),
-            new SpanTestData().setLabel("seda:foo server").setUri("seda://foo?concurrentConsumers=5")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(0),
-            new SpanTestData().setLabel("seda:bar server").setUri("seda://bar?concurrentConsumers=5")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(1)
+        new SpanTestData().setLabel("seda:foo client").setUri("seda://foo")
+            .setKind(Tags.SPAN_KIND_CLIENT),
+        new SpanTestData().setLabel("seda:bar client").setUri("seda://bar")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(2),
+        new SpanTestData().setLabel("seda:foo server").setUri("seda://foo?concurrentConsumers=5")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(0),
+        new SpanTestData().setLabel("seda:bar server").setUri("seda://bar?concurrentConsumers=5")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(1)
     };
 
     public RouteConcurrentTest() {
@@ -63,7 +62,7 @@ public class RouteConcurrentTest extends CamelOpenTracingTestSupport {
 
         assertTrue(notify.matches(30, TimeUnit.SECONDS));
 
-        verifyTraceSpanNumbers(5,  testdata.length);
+        verifyTraceSpanNumbers(5, testdata.length);
     }
 
     @Override
@@ -79,7 +78,7 @@ public class RouteConcurrentTest extends CamelOpenTracingTestSupport {
                 from("seda:bar?concurrentConsumers=5").routeId("bar")
                     .log("routing at ${routeId}")
                     .delay(simple("${random(0,500)}"));
-           }
+            }
         };
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TestSEDASpanDecorator.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TestSEDASpanDecorator.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TestSEDASpanDecorator.java
index f7e3bd4..9b13b73 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TestSEDASpanDecorator.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TestSEDASpanDecorator.java
@@ -16,12 +16,11 @@
  */
 package org.apache.camel.opentracing;
 
+import io.opentracing.Span;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.opentracing.decorators.AbstractSpanDecorator;
 
-import io.opentracing.Span;
-
 public class TestSEDASpanDecorator extends AbstractSpanDecorator {
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TwoServiceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TwoServiceTest.java
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TwoServiceTest.java
index 45a8a33..4425102 100644
--- a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TwoServiceTest.java
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/TwoServiceTest.java
@@ -16,23 +16,22 @@
  */
 package org.apache.camel.opentracing;
 
+import io.opentracing.tag.Tags;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
-import io.opentracing.tag.Tags;
-
 public class TwoServiceTest extends CamelOpenTracingTestSupport {
 
     private static SpanTestData[] testdata = {
-            new SpanTestData().setLabel("ServiceB server").setUri("direct://ServiceB")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
-            new SpanTestData().setLabel("ServiceB client").setUri("direct://ServiceB")
-                    .setKind(Tags.SPAN_KIND_CLIENT).setParentId(2),
-            new SpanTestData().setLabel("ServiceA server").setUri("direct://ServiceA")
-                    .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
-            new SpanTestData().setLabel("ServiceA client").setUri("direct://ServiceA")
-                    .setKind(Tags.SPAN_KIND_CLIENT)
+        new SpanTestData().setLabel("ServiceB server").setUri("direct://ServiceB")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(1),
+        new SpanTestData().setLabel("ServiceB client").setUri("direct://ServiceB")
+            .setKind(Tags.SPAN_KIND_CLIENT).setParentId(2),
+        new SpanTestData().setLabel("ServiceA server").setUri("direct://ServiceA")
+            .setKind(Tags.SPAN_KIND_SERVER).setParentId(3),
+        new SpanTestData().setLabel("ServiceA client").setUri("direct://ServiceA")
+            .setKind(Tags.SPAN_KIND_CLIENT)
     };
 
     public TwoServiceTest() {
@@ -52,13 +51,13 @@ public class TwoServiceTest extends CamelOpenTracingTestSupport {
             @Override
             public void configure() throws Exception {
                 from("direct:ServiceA")
-		            .log("ServiceA has been called")
+                    .log("ServiceA has been called")
                     .delay(simple("${random(1000,2000)}"))
-		            .to("direct:ServiceB");
+                    .to("direct:ServiceB");
 
                 from("direct:ServiceB")
-		            .log("ServiceB has been called")
-		            .delay(simple("${random(0,500)}"));
+                    .log("ServiceB has been called")
+                    .delay(simple("${random(0,500)}"));
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/dbb27d02/components/camel-opentracing/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/test/resources/log4j2.properties b/components/camel-opentracing/src/test/resources/log4j2.properties
index 1ceb5bb..09fdd69 100644
--- a/components/camel-opentracing/src/test/resources/log4j2.properties
+++ b/components/camel-opentracing/src/test/resources/log4j2.properties
@@ -14,17 +14,16 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-
-appender.file.type = File
-appender.file.name = file
-appender.file.fileName = target/camel-opentracing-test.log
-appender.file.layout.type = PatternLayout
-appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
-appender.out.type = Console
-appender.out.name = out
-appender.out.layout.type = PatternLayout
-appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
-logger.opentracing.name = org.apache.camel.opentracing
-logger.opentracing.level = INFO
-rootLogger.level = INFO
-rootLogger.appenderRef.file.ref = file
+appender.file.type=File
+appender.file.name=file
+appender.file.fileName=target/camel-opentracing-test.log
+appender.file.layout.type=PatternLayout
+appender.file.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type=Console
+appender.out.name=out
+appender.out.layout.type=PatternLayout
+appender.out.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+logger.opentracing.name=org.apache.camel.opentracing
+logger.opentracing.level=INFO
+rootLogger.level=INFO
+rootLogger.appenderRef.file.ref=file


Mime
View raw message