camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch master updated: CAMEL-11944: Ensure HBaseConfiguration ClassLoader is set correctly
Date Wed, 25 Oct 2017 12:00:18 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new 293bbc3  CAMEL-11944: Ensure HBaseConfiguration ClassLoader is set correctly
293bbc3 is described below

commit 293bbc3bd38153564b6fbc89188c2519db65e5aa
Author: James Netherton <jamesnetherton@gmail.com>
AuthorDate: Wed Oct 25 07:49:13 2017 +0100

    CAMEL-11944: Ensure HBaseConfiguration ClassLoader is set correctly
---
 .../main/java/org/apache/camel/component/hbase/HBaseComponent.java | 7 +++++--
 .../java/org/apache/camel/component/hbase/HBaseComponentTest.java  | 6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseComponent.java
b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseComponent.java
index d690092..10ada08 100644
--- a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseComponent.java
+++ b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseComponent.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.hbase;
 import java.util.Map;
 import java.util.concurrent.Executors;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.spi.Metadata;
@@ -44,13 +45,15 @@ public class HBaseComponent extends UriEndpointComponent {
         super(HBaseEndpoint.class);
     }
 
+    public HBaseComponent(CamelContext context) {
+        super(context, HBaseEndpoint.class);
+    }
+
     @Override
     protected void doStart() throws Exception {
         if (configuration == null) {
             configuration = HBaseConfiguration.create();
-        }
 
-        if (configuration.getClassLoader() == null) {
             ClassLoader applicationContextClassLoader = getCamelContext().getApplicationContextClassLoader();
             if (applicationContextClassLoader != null) {
                 configuration.setClassLoader(applicationContextClassLoader);
diff --git a/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/HBaseComponentTest.java
b/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/HBaseComponentTest.java
index 5cfed5e..697bdaf 100644
--- a/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/HBaseComponentTest.java
+++ b/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/HBaseComponentTest.java
@@ -34,7 +34,7 @@ public class HBaseComponentTest {
         CamelContext camelContext = new DefaultCamelContext();
         camelContext.setApplicationContextClassLoader(expectedClassLoader);
 
-        HBaseComponent component = new HBaseComponent();
+        HBaseComponent component = new HBaseComponent(new DefaultCamelContext());
         component.doStart();
         component.doStop();
 
@@ -49,7 +49,7 @@ public class HBaseComponentTest {
         Configuration configuration = HBaseConfiguration.create();
         configuration.setClassLoader(expectedClassLoader);
 
-        HBaseComponent component = new HBaseComponent();
+        HBaseComponent component = new HBaseComponent(new DefaultCamelContext());
         component.setConfiguration(configuration);
         try {
             component.doStart();
@@ -66,7 +66,7 @@ public class HBaseComponentTest {
     public void testHBaseConfigurationClassLoaderSetToDefault() throws Exception {
         ClassLoader expectedClassLoader = HBaseConfiguration.class.getClassLoader();
 
-        HBaseComponent component = new HBaseComponent();
+        HBaseComponent component = new HBaseComponent(new DefaultCamelContext());
         component.doStart();
         component.doStop();
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Mime
View raw message