Quantcast

[1/2] camel git commit: Source check

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[1/2] camel git commit: Source check

nferraro
Repository: camel
Updated Branches:
  refs/heads/master e74975e8f -> e6131db33


Source check


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

Branch: refs/heads/master
Commit: 2b267a6b24ecbe1bbdc0f7163802a8d5b0ad8a9b
Parents: e74975e
Author: Nicola Ferraro <[hidden email]>
Authored: Wed Mar 15 14:06:11 2017 +0100
Committer: Nicola Ferraro <[hidden email]>
Committed: Wed Mar 15 14:06:11 2017 +0100

----------------------------------------------------------------------
 .../camel/maven/packaging/PrepareCatalogMojo.java     |  2 --
 .../camel/maven/packaging/PrepareReadmeMojo.java      |  4 +++-
 .../packaging/SpringBootAutoConfigurationMojo.java    | 14 +++++++-------
 3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2b267a6b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
index 67fca07..d652efb 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.nio.channels.FileChannel;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -35,7 +34,6 @@ import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;

http://git-wip-us.apache.org/repos/asf/camel/blob/2b267a6b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
index 326653b..f14fa72 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
@@ -28,7 +28,10 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
+import static java.util.stream.Collectors.toSet;
+
 import edu.emory.mathcs.backport.java.util.Collections;
+
 import org.apache.camel.maven.packaging.model.ComponentModel;
 import org.apache.camel.maven.packaging.model.DataFormatModel;
 import org.apache.camel.maven.packaging.model.EipModel;
@@ -41,7 +44,6 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.mvel2.templates.TemplateRuntime;
 
-import static java.util.stream.Collectors.toSet;
 import static org.apache.camel.maven.packaging.PackageHelper.loadText;
 import static org.apache.camel.maven.packaging.PackageHelper.writeText;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2b267a6b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index 2b46547..23bad4c 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -105,13 +105,6 @@ import static org.apache.camel.maven.packaging.PackageHelper.loadText;
 public class SpringBootAutoConfigurationMojo extends AbstractMojo {
 
     /**
-     * The output directory for generated component schema file
-     *
-     * @parameter default-value="${project.build.directory}/classes"
-     */
-    protected File classesDir;
-
-    /**
      * Useful to move configuration towards starters.
      * Warning: the spring.factories files sometimes are used also on the main artifacts.
      * Make sure it is not the case before enabling this property.
@@ -148,6 +141,13 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
     private static final String[] IGNORE_MODULES = {/* Non-standard -> */ "camel-grape", "camel-connector"};
 
     /**
+     * The output directory for generated component schema file
+     *
+     * @parameter default-value="${project.build.directory}/classes"
+     */
+    protected File classesDir;
+
+    /**
      * The maven project.
      *
      * @parameter property="project"

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[2/2] camel git commit: CAMEL-10920: lookup tracer from the registry before using the global tracer

nferraro
CAMEL-10920: lookup tracer from the registry before using the global tracer


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

Branch: refs/heads/master
Commit: e6131db33a67fcfbfafe7d08265d7fde0ab8405e
Parents: 2b267a6
Author: Nicola Ferraro <[hidden email]>
Authored: Wed Mar 15 14:40:21 2017 +0100
Committer: Nicola Ferraro <[hidden email]>
Committed: Wed Mar 15 14:40:21 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/opentracing.adoc              |  5 +-
 .../camel/opentracing/OpenTracingTracer.java    | 11 +++-
 .../OpentracingSpanCollectorInRegistryTest.java | 54 ++++++++++++++++++++
 3 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e6131db3/components/camel-opentracing/src/main/docs/opentracing.adoc
----------------------------------------------------------------------
diff --git a/components/camel-opentracing/src/main/docs/opentracing.adoc b/components/camel-opentracing/src/main/docs/opentracing.adoc
index 7778660..3db0b46 100644
--- a/components/camel-opentracing/src/main/docs/opentracing.adoc
+++ b/components/camel-opentracing/src/main/docs/opentracing.adoc
@@ -24,9 +24,10 @@ To enable camel-opentracing you need to configure first
 [source,java]
 --------------------------------------------------------------------------------------------------
 OpenTracingTracer ottracer = new OpenTracingTracer();
-// by default uses the Global Tracer, but can override with specific OpenTracing implementation
+// By default it uses the Global Tracer, but you can override it with a specific OpenTracing implementation.
+// As an alternative, you can also set a tracer in the registry and it it will be looked up.
 ottracer.setTracer(...);
-// and then set the CamelContext
+// And then set the CamelContext
 ottracer.setCamelContext(camelContext);
 --------------------------------------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e6131db3/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 6f709f2..9f45aa2 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
@@ -21,6 +21,7 @@ import java.util.EventObject;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.ServiceLoader;
+import java.util.Set;
 
 import io.opentracing.Span;
 import io.opentracing.Tracer;
@@ -66,7 +67,7 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
 
     private final OpenTracingEventNotifier eventNotifier = new OpenTracingEventNotifier();
     private final SpanManager spanManager = DefaultSpanManager.getInstance();
-    private Tracer tracer = GlobalTracer.get();
+    private Tracer tracer;
     private CamelContext camelContext;
 
     static {
@@ -134,6 +135,14 @@ public class OpenTracingTracer extends ServiceSupport implements RoutePolicyFact
         }
 
         if (tracer == null) {
+            Set<Tracer> tracers = camelContext.getRegistry().findByType(Tracer.class);
+            if (tracers.size() == 1) {
+                tracer = tracers.iterator().next();
+            }
+        }
+
+        if (tracer == null) {
+            // fallback to the global tracer if no tracers are configured
             tracer = GlobalTracer.get();
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e6131db3/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpentracingSpanCollectorInRegistryTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..e2c8f18
--- /dev/null
+++ b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/OpentracingSpanCollectorInRegistryTest.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.opentracing;
+
+import io.opentracing.NoopTracer;
+import io.opentracing.NoopTracerFactory;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class OpentracingSpanCollectorInRegistryTest extends CamelTestSupport {
+
+    private OpenTracingTracer openTracing;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+
+        openTracing = new OpenTracingTracer();
+        openTracing.init(context);
+
+        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());
+        assertTrue(openTracing.getTracer() instanceof NoopTracer);
+    }
+
+}

Loading...