You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/12/11 09:58:10 UTC

[camel] branch master updated: CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - pulsar component

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

davsclaus 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 97ce74f  CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - pulsar component
97ce74f is described below

commit 97ce74f77b63bd9c9ad9cc0fc388be613a4ce336
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 11 10:57:47 2019 +0100

    CAMEL-14284: Configuring endpoint should set properties on endpoint and not configuration object - pulsar component
---
 .../java/org/apache/camel/component/pulsar/PulsarComponent.java  | 9 ++-------
 .../org/apache/camel/component/pulsar/PulsarComponentTest.java   | 8 ++++----
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java
index 08e6f65..89a18a3 100644
--- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java
+++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java
@@ -50,15 +50,10 @@ public class PulsarComponent extends DefaultComponent {
     @Override
     protected Endpoint createEndpoint(final String uri, final String path, final Map<String, Object> parameters) throws Exception {
         final PulsarConfiguration configuration = new PulsarConfiguration();
-
         configuration.setAllowManualAcknowledgement(isAllowManualAcknowledgement());
 
-        setProperties(configuration, parameters);
-        if (autoConfiguration != null) {
-            setProperties(autoConfiguration, parameters);
-            if (autoConfiguration.isAutoConfigurable()) {
-                autoConfiguration.ensureNameSpaceAndTenant(path);
-            }
+        if (autoConfiguration != null &&autoConfiguration.isAutoConfigurable()) {
+            autoConfiguration.ensureNameSpaceAndTenant(path);
         }
 
         PulsarEndpoint answer = new PulsarEndpoint(uri, this);
diff --git a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java
index 78f9baa..352eaa5 100644
--- a/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java
+++ b/components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/PulsarComponentTest.java
@@ -40,7 +40,7 @@ public class PulsarComponentTest extends CamelTestSupport {
 
     @Test
     public void testPulsarEndpointConfiguration() throws Exception {
-        PulsarComponent component = new PulsarComponent(context);
+        PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
         component.setAutoConfiguration(autoConfiguration);
 
         PulsarEndpoint endpoint = (PulsarEndpoint)component
@@ -51,7 +51,7 @@ public class PulsarComponentTest extends CamelTestSupport {
 
     @Test
     public void testPulsarEndpointDefaultConfiguration() throws Exception {
-        PulsarComponent component = new PulsarComponent(context);
+        PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
 
         PulsarEndpoint endpoint = (PulsarEndpoint)component.createEndpoint("pulsar://persistent/test/foobar/BatchCreated");
 
@@ -69,7 +69,7 @@ public class PulsarComponentTest extends CamelTestSupport {
     @Test
     public void testProducerAutoConfigures() throws Exception {
         when(autoConfiguration.isAutoConfigurable()).thenReturn(true);
-        PulsarComponent component = new PulsarComponent(context);
+        PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
         component.setAutoConfiguration(autoConfiguration);
 
         component.createEndpoint("pulsar://persistent/test/foobar/BatchCreated?numberOfConsumers=10&subscriptionName=batch-created-subscription&subscriptionType=Shared");
@@ -79,7 +79,7 @@ public class PulsarComponentTest extends CamelTestSupport {
 
     @Test
     public void testPulsarEndpointAllowManualAcknowledgementDefaultTrue() throws Exception {
-        PulsarComponent component = new PulsarComponent(context);
+        PulsarComponent component = context.getComponent("pulsar", PulsarComponent.class);
         component.setAllowManualAcknowledgement(true);
 
         // allowManualAcknowledgement is absent as a query parameter.