Quantcast

camel git commit: Fixed camel-salesforce verify connectivity when using refresh token.

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

camel git commit: Fixed camel-salesforce verify connectivity when using refresh token.

davsclaus-2
Repository: camel
Updated Branches:
  refs/heads/master b7b26ed62 -> 1735a5b7d


Fixed camel-salesforce verify connectivity when using refresh token.


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

Branch: refs/heads/master
Commit: 1735a5b7d0adc18e68d50839dfa24a8dfc13c6b0
Parents: b7b26ed
Author: Claus Ibsen <[hidden email]>
Authored: Mon Mar 20 14:01:00 2017 +0100
Committer: Claus Ibsen <[hidden email]>
Committed: Mon Mar 20 14:01:00 2017 +0100

----------------------------------------------------------------------
 .../salesforce/SalesforceComponentVerifier.java |   9 +-
 .../salesforce/SalesforceLoginConfig.java       |   4 +-
 .../connector/DefaultConnectorComponent.java    |   3 +-
 .../SalesforceComponentConfiguration.java       | 208 +++++++++----------
 4 files changed, 114 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1735a5b7/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifier.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifier.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifier.java
index 7d6df25..dea18ca 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifier.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifier.java
@@ -54,9 +54,12 @@ public class SalesforceComponentVerifier extends DefaultComponentVerifier {
         // options are not properly marked as mandatory in the catalog.
         ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS)
             .error(ResultErrorHelper.requiresOption("clientId", parameters))
-            .error(ResultErrorHelper.requiresOption("clientSecret", parameters))
-            .error(ResultErrorHelper.requiresOption("userName", parameters))
-            .error(ResultErrorHelper.requiresOption("password", parameters));
+            .error(ResultErrorHelper.requiresOption("clientSecret", parameters));
+
+            // TODO: either refreshToken or userName and password
+            //.error(ResultErrorHelper.requiresOption("refreshToken", parameters))
+            //.error(ResultErrorHelper.requiresOption("userName", parameters))
+            //.error(ResultErrorHelper.requiresOption("password", parameters));
 
         // Validate using the catalog
         super.verifyParametersAgainstCatalog(builder, parameters);

http://git-wip-us.apache.org/repos/asf/camel/blob/1735a5b7/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java
index d703d9f..30c0a99 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java
@@ -176,9 +176,9 @@ public class SalesforceLoginConfig {
         ObjectHelper.notNull(loginUrl, "loginUrl");
         ObjectHelper.notNull(clientId, "clientId");
 
-        final boolean hasRefreshToken = ObjectHelper.isEmpty(refreshToken);
+        final boolean hasRefreshToken = ObjectHelper.isNotEmpty(refreshToken);
 
-        if (hasRefreshToken && keystore == null) {
+        if (!hasRefreshToken && keystore == null) {
             ObjectHelper.notNull(userName, "userName (username/password authentication)");
             ObjectHelper.notNull(password, "password (username/password authentication)");
             ObjectHelper.notNull(clientSecret, "clientSecret (username/password authentication)");

http://git-wip-us.apache.org/repos/asf/camel/blob/1735a5b7/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
----------------------------------------------------------------------
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
index 153f24a..71c71f6 100644
--- a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/DefaultConnectorComponent.java
@@ -121,7 +121,8 @@ public abstract class DefaultConnectorComponent extends DefaultComponent impleme
     @Override
     public ComponentVerifier getVerifier() {
         final String scheme = model.getBaseScheme();
-        final Component component = getCamelContext().getComponent(scheme);
+        // only get or create component but do NOT start it as component
+        final Component component = getCamelContext().getComponent(scheme, true, false);
 
         if (component instanceof VerifiableComponent) {
             return (scope, map) -> {

http://git-wip-us.apache.org/repos/asf/camel/blob/1735a5b7/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
index c70fb66..364e405 100644
--- a/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentConfiguration.java
@@ -354,6 +354,110 @@ public class SalesforceComponentConfiguration {
         this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
     }
 
+    public static class SalesforceLoginConfigNestedConfiguration {
+        public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.salesforce.SalesforceLoginConfig.class;
+        /**
+         * Salesforce login URL, defaults to https://login.salesforce.com
+         */
+        private String loginUrl;
+        /**
+         * Salesforce connected application Consumer Key
+         */
+        private String clientId;
+        /**
+         * Salesforce connected application Consumer Secret
+         */
+        private String clientSecret;
+        /**
+         * Keystore parameters for keystore containing certificate and private
+         * key needed for OAuth 2.0 JWT Bearer Token Flow.
+         */
+        @NestedConfigurationProperty
+        private KeyStoreParameters keystore;
+        /**
+         * Salesforce connected application Consumer token
+         */
+        private String refreshToken;
+        /**
+         * Salesforce account user name
+         */
+        private String userName;
+        /**
+         * Salesforce account password
+         */
+        private String password;
+        /**
+         * Flag to enable/disable lazy OAuth, default is false. When enabled,
+         * OAuth token retrieval or generation is not done until the first API
+         * call
+         */
+        private Boolean lazyLogin;
+
+        public String getLoginUrl() {
+            return loginUrl;
+        }
+
+        public void setLoginUrl(String loginUrl) {
+            this.loginUrl = loginUrl;
+        }
+
+        public String getClientId() {
+            return clientId;
+        }
+
+        public void setClientId(String clientId) {
+            this.clientId = clientId;
+        }
+
+        public String getClientSecret() {
+            return clientSecret;
+        }
+
+        public void setClientSecret(String clientSecret) {
+            this.clientSecret = clientSecret;
+        }
+
+        public KeyStoreParameters getKeystore() {
+            return keystore;
+        }
+
+        public void setKeystore(KeyStoreParameters keystore) {
+            this.keystore = keystore;
+        }
+
+        public String getRefreshToken() {
+            return refreshToken;
+        }
+
+        public void setRefreshToken(String refreshToken) {
+            this.refreshToken = refreshToken;
+        }
+
+        public String getUserName() {
+            return userName;
+        }
+
+        public void setUserName(String userName) {
+            this.userName = userName;
+        }
+
+        public String getPassword() {
+            return password;
+        }
+
+        public void setPassword(String password) {
+            this.password = password;
+        }
+
+        public Boolean getLazyLogin() {
+            return lazyLogin;
+        }
+
+        public void setLazyLogin(Boolean lazyLogin) {
+            this.lazyLogin = lazyLogin;
+        }
+    }
+
     public static class SalesforceEndpointConfigNestedConfiguration {
         public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.salesforce.SalesforceEndpointConfig.class;
         /**
@@ -930,108 +1034,4 @@ public class SalesforceComponentConfiguration {
             this.approvalSkipEntryCriteria = approvalSkipEntryCriteria;
         }
     }
-
-    public static class SalesforceLoginConfigNestedConfiguration {
-        public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.salesforce.SalesforceLoginConfig.class;
-        /**
-         * Salesforce login URL, defaults to https://login.salesforce.com
-         */
-        private String loginUrl;
-        /**
-         * Salesforce connected application Consumer Key
-         */
-        private String clientId;
-        /**
-         * Salesforce connected application Consumer Secret
-         */
-        private String clientSecret;
-        /**
-         * Keystore parameters for keystore containing certificate and private
-         * key needed for OAuth 2.0 JWT Bearer Token Flow.
-         */
-        @NestedConfigurationProperty
-        private KeyStoreParameters keystore;
-        /**
-         * Salesforce connected application Consumer token
-         */
-        private String refreshToken;
-        /**
-         * Salesforce account user name
-         */
-        private String userName;
-        /**
-         * Salesforce account password
-         */
-        private String password;
-        /**
-         * Flag to enable/disable lazy OAuth, default is false. When enabled,
-         * OAuth token retrieval or generation is not done until the first API
-         * call
-         */
-        private Boolean lazyLogin;
-
-        public String getLoginUrl() {
-            return loginUrl;
-        }
-
-        public void setLoginUrl(String loginUrl) {
-            this.loginUrl = loginUrl;
-        }
-
-        public String getClientId() {
-            return clientId;
-        }
-
-        public void setClientId(String clientId) {
-            this.clientId = clientId;
-        }
-
-        public String getClientSecret() {
-            return clientSecret;
-        }
-
-        public void setClientSecret(String clientSecret) {
-            this.clientSecret = clientSecret;
-        }
-
-        public KeyStoreParameters getKeystore() {
-            return keystore;
-        }
-
-        public void setKeystore(KeyStoreParameters keystore) {
-            this.keystore = keystore;
-        }
-
-        public String getRefreshToken() {
-            return refreshToken;
-        }
-
-        public void setRefreshToken(String refreshToken) {
-            this.refreshToken = refreshToken;
-        }
-
-        public String getUserName() {
-            return userName;
-        }
-
-        public void setUserName(String userName) {
-            this.userName = userName;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-
-        public Boolean getLazyLogin() {
-            return lazyLogin;
-        }
-
-        public void setLazyLogin(Boolean lazyLogin) {
-            this.lazyLogin = lazyLogin;
-        }
-    }
 }
\ No newline at end of file

Loading...