You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2019/02/20 03:52:26 UTC

[camel] branch master updated: camel-twilio - Make sure account sid is set when the component starts

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

tsato 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 13afcbc  camel-twilio - Make sure account sid is set when the component starts
13afcbc is described below

commit 13afcbc8c496aefa1fb336689a051597b387daf9
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Wed Feb 20 12:50:00 2019 +0900

    camel-twilio - Make sure account sid is set when the component starts
---
 .../main/java/org/apache/camel/component/twilio/TwilioComponent.java | 5 ++++-
 .../org/apache/camel/component/twilio/AbstractTwilioTestSupport.java | 5 +----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioComponent.java b/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioComponent.java
index a928db6..9adb7eb 100644
--- a/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioComponent.java
+++ b/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioComponent.java
@@ -76,6 +76,9 @@ public class TwilioComponent extends AbstractApiComponent<TwilioApiName, TwilioC
             if (ObjectHelper.isEmpty(username) && ObjectHelper.isEmpty(password)) {
                 throw new IllegalStateException("Unable to initialise Twilio, Twilio component configuration is missing");
             }
+            if (ObjectHelper.isEmpty(accountSid)) {
+                accountSid = username;
+            }
 
             restClient = new TwilioRestClient.Builder(username, password)
                 .accountSid(accountSid)
@@ -134,7 +137,7 @@ public class TwilioComponent extends AbstractApiComponent<TwilioApiName, TwilioC
     }
 
     public String getAccountSid() {
-        return accountSid == null ? username : accountSid;
+        return accountSid;
     }
 
     /**
diff --git a/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java b/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java
index 77d84aa..eea026d 100644
--- a/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java
+++ b/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java
@@ -52,12 +52,9 @@ public class AbstractTwilioTestSupport extends CamelTestSupport {
             options.put(entry.getKey().toString(), entry.getValue());
         }
 
-        final TwilioConfiguration configuration = new TwilioConfiguration();
-        IntrospectionSupport.setProperties(configuration, options);
-
         // add TwilioComponent to Camel context
         final TwilioComponent component = new TwilioComponent(context);
-        component.setConfiguration(configuration);
+        IntrospectionSupport.setProperties(component, options);
         context.addComponent("twilio", component);
 
         return context;