camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject [camel] branch master updated: CAMEL-11992: connectors : alias scheme is not used by the connector component
Date Fri, 03 Nov 2017 22:41:38 GMT
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli 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 410cb46  CAMEL-11992: connectors : alias scheme is not used by the connector component
410cb46 is described below

commit 410cb46585ea18c2332f4a5d5e04f4417efc2ca9
Author: lburgazzoli <lburgazzoli@gmail.com>
AuthorDate: Fri Nov 3 23:41:10 2017 +0100

    CAMEL-11992: connectors : alias scheme is not used by the connector component
---
 .../src/main/java/__name__Component.java           |  4 ++
 .../connector/SpringBootAutoConfigurationMojo.java |  2 +-
 .../component/connector/ConnectorComponent.java    |  7 ++-
 .../connector/DefaultConnectorComponent.java       | 39 ++++++++++++---
 .../connector/SchedulerTimerConnectorEndpoint.java |  2 +-
 .../main/java/org/foo/connector/BarComponent.java  |  4 ++
 .../main/java/org/foo/connector/FooComponent.java  |  7 +++
 .../src/main/resources/camel-connector.json        |  2 +-
 .../java/org/foo/connector/PetStoreComponent.java  |  4 ++
 .../PetStoreConnectorAutoConfiguration.java        |  2 +-
 .../src/main/resources/camel-connector.json        |  2 +-
 .../contact/SalesforceUpsertContactComponent.java  |  4 ++
 ...rceUpsertContactConnectorAutoConfiguration.java |  3 +-
 .../src/main/resources/camel-connector.json        |  2 +-
 .../java/org/foo/find/TwitterFindComponent.java    |  4 ++
 .../TwitterFindConnectorAutoConfiguration.java     |  3 +-
 .../TwitterFindConnectorConfigurationCommon.java   | 25 +++++-----
 .../src/main/resources/camel-connector-schema.json | 29 ++++++-----
 .../src/main/resources/camel-connector.json        |  7 ++-
 .../find/springboot/TwitterFindConnectorTest.java  | 58 +++++++++++++++++-----
 .../src/test/resources/application.properties      | 22 ++++++--
 .../src/test/resources/logback.xml                 |  1 +
 .../org/foo/mention/TwitterMentionComponent.java   |  4 ++
 .../TwitterMentionConnectorAutoConfiguration.java  |  3 +-
 .../src/main/resources/camel-connector.json        |  2 +-
 .../main/java/org/foo/connector/WineComponent.java |  4 ++
 26 files changed, 177 insertions(+), 69 deletions(-)

diff --git a/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
b/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
index 7ef274b..76ee1a3 100644
--- a/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
+++ b/archetypes/camel-archetype-connector/src/main/resources/archetype-resources/src/main/java/__name__Component.java
@@ -27,4 +27,8 @@ public class ${name}Component extends DefaultConnectorComponent {
         super("${name}", "${package}.${name}Component");
     }
 
+    public ${name}Component(String componentScheme) {
+        super("${name}", componentScheme, "${package}.${name}Component");
+    }
+
 }
diff --git a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
index f3bbddf..4a60f67 100644
--- a/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
+++ b/connectors/camel-connector-maven-plugin/src/main/java/org/apache/camel/maven/connector/SpringBootAutoConfigurationMojo.java
@@ -445,7 +445,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         sb.append("for (Map.Entry<String, " + commonConfigurationName + "> entry :
configuration.getConfigurations().entrySet()) {\n");
         sb.append("parameters.clear();\n");
         sb.append("\n");
-        sb.append(shortJavaType).append(" connector = new ").append(shortJavaType).append("();\n");
+        sb.append(shortJavaType).append(" connector = new ").append(shortJavaType).append("(").append("entry.getKey()").append(");\n");
         sb.append("connector.setCamelContext(camelContext);\n");
         sb.append("\n");
         sb.append("try {\n");
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorComponent.java
b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorComponent.java
index 48134bb..42b81f8 100644
--- a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorComponent.java
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorComponent.java
@@ -63,11 +63,16 @@ public interface ConnectorComponent extends Component {
     String getConnectorName();
 
     /**
-     * Gets the connector component name (component scheme)
+     * Gets the connector component name
      */
     String getComponentName();
 
     /**
+     * Gets the connector component scheme
+     */
+    String getComponentScheme();
+
+    /**
      * Gets the camel-connector JSon file.
      */
     String getCamelConnectorJSon();
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 f46b708..3ba61ab 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
@@ -56,8 +56,9 @@ public abstract class DefaultConnectorComponent extends DefaultComponent
impleme
     private final CamelCatalog catalog = new DefaultCamelCatalog(false);
 
     private final String baseScheme;
-    private final String componentName;
+    private final String componentAlias;
     private final String componentScheme;
+    private final String componentName;
     private final ConnectorModel model;
     private final Map<String, Object> options;
     private Processor beforeProducer;
@@ -66,14 +67,23 @@ public abstract class DefaultConnectorComponent extends DefaultComponent
impleme
     private Processor afterConsumer;
 
     protected DefaultConnectorComponent(String componentName, String className) {
-        this(componentName, loadConnectorClass(className));
+        this(componentName, null, loadConnectorClass(className));
+    }
+
+    protected DefaultConnectorComponent(String componentName, String componentScheme, String
className) {
+        this(componentName, componentScheme, loadConnectorClass(className));
     }
 
     protected DefaultConnectorComponent(String componentName, Class<?> componentClass)
{
+        this(componentName, null, componentClass);
+    }
+
+    protected DefaultConnectorComponent(String componentName, String componentScheme, Class<?>
componentClass) {
         this.model = new ConnectorModel(componentName, componentClass);
         this.baseScheme = this.model.getBaseScheme();
         this.componentName = componentName;
-        this.componentScheme = componentName + "-component";
+        this.componentScheme = componentScheme != null ? componentScheme : componentName
+ "-component";
+        this.componentAlias = componentScheme != null ? baseScheme + "-" + componentScheme
: componentName + "-component";
         this.options = new HashMap<>();
 
         // add to catalog
@@ -86,8 +96,8 @@ public abstract class DefaultConnectorComponent extends DefaultComponent
impleme
 
         // Add an alias for the base component so there's no clash between connectors
         // if they set options targeting the component.
-        if (!catalog.findComponentNames().contains(componentScheme)) {
-            this.catalog.addComponent(componentScheme, this.model.getBaseJavaType(), catalog.componentJSonSchema(baseScheme));
+        if (!catalog.findComponentNames().contains(componentAlias)) {
+            this.catalog.addComponent(componentAlias, this.model.getBaseJavaType(), catalog.componentJSonSchema(baseScheme));
         }
 
         registerExtension(this::getComponentVerifierExtension);
@@ -125,7 +135,7 @@ public abstract class DefaultConnectorComponent extends DefaultComponent
impleme
         Map<String, String> options = buildEndpointOptions(remaining, parameters);
 
         // create the uri of the base component
-        String delegateUri = createEndpointUri(componentScheme, options);
+        String delegateUri = createEndpointUri(componentAlias, options);
         Endpoint delegate = getCamelContext().getEndpoint(delegateUri);
 
         if (log.isInfoEnabled()) {
@@ -182,6 +192,11 @@ public abstract class DefaultConnectorComponent extends DefaultComponent
impleme
     }
 
     @Override
+    public String getComponentScheme() {
+        return componentScheme;
+    }
+
+    @Override
     public Map<String, Object> getOptions() {
         return options;
     }
@@ -273,11 +288,19 @@ public abstract class DefaultConnectorComponent extends DefaultComponent
impleme
 
         Component component = createNewBaseComponent();
         if (component != null) {
-            getCamelContext().removeComponent(this.componentScheme);
+            log.info("Register component: {} (type: {}) with scheme: {} and alias: {}",
+                this.componentName,
+                component.getClass().getName(),
+                this.componentScheme,
+                this.componentAlias
+            );
+
+            //String delegateComponentScheme =
+            getCamelContext().removeComponent(this.componentAlias);
 
             // ensure component is started and stopped when Camel shutdown
             getCamelContext().addService(component, true, true);
-            getCamelContext().addComponent(this.componentScheme, component);
+            getCamelContext().addComponent(this.componentAlias, component);
         }
 
         log.debug("Starting connector: {}", componentName);
diff --git a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
index c8c4e9d..203d6be 100644
--- a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
+++ b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/SchedulerTimerConnectorEndpoint.java
@@ -60,7 +60,7 @@ public class SchedulerTimerConnectorEndpoint extends DefaultConnectorEndpoint
{
         Processor pipeline = Pipeline.newInstance(getCamelContext(), children);
 
         // create a timer consumer which wraps calling the producer and then the intended
processor
-        String name = getComponent().getComponentName();
+        String name = getComponent().getComponentScheme();
         String uri = "timer:" + name + "?period=" + period;
 
         Consumer consumer = getCamelContext().getEndpoint(uri).createConsumer(pipeline);
diff --git a/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
b/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
index 838a644..c34c298 100644
--- a/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
+++ b/connectors/examples/bar-connector/src/main/java/org/foo/connector/BarComponent.java
@@ -24,4 +24,8 @@ public class BarComponent extends DefaultConnectorComponent {
         super("bar", "org.foo.connector.BarComponent");
     }
 
+    public BarComponent(String componentScheme) {
+        super("bar", componentScheme, "org.foo.connector.BarComponent");
+    }
+
 }
\ No newline at end of file
diff --git a/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
b/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
index 04861f2..52b022c 100644
--- a/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
+++ b/connectors/examples/foo-connector/src/main/java/org/foo/connector/FooComponent.java
@@ -27,4 +27,11 @@ public class FooComponent extends DefaultConnectorComponent {
         setBeforeConsumer(e -> e.getIn().setHeader("whoami", "I am foo"));
     }
 
+    public FooComponent(String componentScheme) {
+        super("foo", componentScheme, "org.foo.connector.FooComponent");
+
+        // show how you can add a fixed header
+        setBeforeConsumer(e -> e.getIn().setHeader("whoami", "I am foo"));
+    }
+
 }
\ No newline at end of file
diff --git a/connectors/examples/foo-connector/src/main/resources/camel-connector.json b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
index 62927ac..a73320d 100644
--- a/connectors/examples/foo-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/foo-connector/src/main/resources/camel-connector.json
@@ -2,7 +2,7 @@
   "baseScheme" : "timer",
   "baseGroupId" : "org.apache.camel",
   "baseArtifactId" : "camel-core",
-  "baseVersion" : "2.21.0-SNAPSHOT",
+  "baseVersion" : "2.21.0-20171103.151330-25",
   "baseJavaType" : "org.apache.camel.component.timer.TimerComponent",
   "name" : "Foo",
   "scheme" : "foo",
diff --git a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java
b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java
index 11c2bb9..056da7f 100644
--- a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java
+++ b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/PetStoreComponent.java
@@ -24,4 +24,8 @@ public class PetStoreComponent extends DefaultConnectorComponent {
         super("petstore", "org.foo.connector.PetStoreComponent");
     }
 
+    public PetStoreComponent(String componentScheme) {
+        super("petstore", componentScheme, "org.foo.connector.PetStoreComponent");
+    }
+
 }
\ No newline at end of file
diff --git a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
index bc39ddc..534b970 100644
--- a/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
+++ b/connectors/examples/petstore-connector/src/main/java/org/foo/connector/springboot/PetStoreConnectorAutoConfiguration.java
@@ -105,7 +105,7 @@ public class PetStoreConnectorAutoConfiguration {
         for (Map.Entry<String, PetStoreConnectorConfigurationCommon> entry : configuration
                 .getConfigurations().entrySet()) {
             parameters.clear();
-            PetStoreComponent connector = new PetStoreComponent();
+            PetStoreComponent connector = new PetStoreComponent(entry.getKey());
             connector.setCamelContext(camelContext);
             try {
                 IntrospectionSupport.getProperties(entry.getValue(),
diff --git a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
index 25bd05c..92829bd 100644
--- a/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/petstore-connector/src/main/resources/camel-connector.json
@@ -2,7 +2,7 @@
   "baseScheme" : "rest-swagger",
   "baseGroupId" : "org.apache.camel",
   "baseArtifactId" : "camel-rest-swagger",
-  "baseVersion" : "2.21.0-SNAPSHOT",
+  "baseVersion" : "2.21.0-20171103.154550-20",
   "baseJavaType" : "org.apache.camel.component.rest.swagger.RestSwaggerComponent",
   "name" : "PetStore",
   "scheme" : "petstore",
diff --git a/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/SalesforceUpsertContactComponent.java
b/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/SalesforceUpsertContactComponent.java
index df88a5e..9795d8f 100644
--- a/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/SalesforceUpsertContactComponent.java
+++ b/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/SalesforceUpsertContactComponent.java
@@ -27,4 +27,8 @@ public class SalesforceUpsertContactComponent extends DefaultConnectorComponent
         super("salesforce-upsert-contact", SalesforceUpsertContactComponent.class.getName());
     }
 
+    public SalesforceUpsertContactComponent(String componentScheme) {
+        super("salesforce-upsert-contact", componentScheme, SalesforceUpsertContactComponent.class.getName());
+    }
+
 }
diff --git a/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/springboot/SalesforceUpsertContactConnectorAutoConfiguration.java
b/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/springboot/SalesforceUpsertContactConnectorAutoConfiguration.java
index e5427a5..31de75a 100644
--- a/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/springboot/SalesforceUpsertContactConnectorAutoConfiguration.java
+++ b/connectors/examples/salesforce-upsert-contact-connector/src/main/java/org/foo/salesforce/contact/springboot/SalesforceUpsertContactConnectorAutoConfiguration.java
@@ -107,7 +107,8 @@ public class SalesforceUpsertContactConnectorAutoConfiguration {
         for (Map.Entry<String, SalesforceUpsertContactConnectorConfigurationCommon>
entry : configuration
                 .getConfigurations().entrySet()) {
             parameters.clear();
-            SalesforceUpsertContactComponent connector = new SalesforceUpsertContactComponent();
+            SalesforceUpsertContactComponent connector = new SalesforceUpsertContactComponent(
+                    entry.getKey());
             connector.setCamelContext(camelContext);
             try {
                 IntrospectionSupport.getProperties(entry.getValue(),
diff --git a/connectors/examples/salesforce-upsert-contact-connector/src/main/resources/camel-connector.json
b/connectors/examples/salesforce-upsert-contact-connector/src/main/resources/camel-connector.json
index 14ccc41..1e8cba5 100644
--- a/connectors/examples/salesforce-upsert-contact-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/salesforce-upsert-contact-connector/src/main/resources/camel-connector.json
@@ -2,7 +2,7 @@
   "baseScheme" : "salesforce",
   "baseGroupId" : "org.apache.camel",
   "baseArtifactId" : "camel-salesforce",
-  "baseVersion" : "2.21.0-SNAPSHOT",
+  "baseVersion" : "2.21.0-20171103.154747-20",
   "baseJavaType" : "org.apache.camel.component.salesforce.SalesforceComponent",
   "name" : "SalesforceUpsertContact",
   "scheme" : "salesforce-upsert-contact",
diff --git a/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/TwitterFindComponent.java
b/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/TwitterFindComponent.java
index 1140a5d..1582775 100644
--- a/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/TwitterFindComponent.java
+++ b/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/TwitterFindComponent.java
@@ -27,4 +27,8 @@ public class TwitterFindComponent extends DefaultConnectorComponent {
         super("twitter-find", "org.foo.find.TwitterFindComponent");
     }
 
+    public TwitterFindComponent(String componentScheme) {
+        super("twitter-find", componentScheme, "org.foo.find.TwitterFindComponent");
+    }
+
 }
diff --git a/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorAutoConfiguration.java
b/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorAutoConfiguration.java
index 8ae7e2d..d409040 100644
--- a/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorAutoConfiguration.java
+++ b/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorAutoConfiguration.java
@@ -106,7 +106,8 @@ public class TwitterFindConnectorAutoConfiguration {
         for (Map.Entry<String, TwitterFindConnectorConfigurationCommon> entry : configuration
                 .getConfigurations().entrySet()) {
             parameters.clear();
-            TwitterFindComponent connector = new TwitterFindComponent();
+            TwitterFindComponent connector = new TwitterFindComponent(
+                    entry.getKey());
             connector.setCamelContext(camelContext);
             try {
                 IntrospectionSupport.getProperties(entry.getValue(),
diff --git a/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorConfigurationCommon.java
b/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorConfigurationCommon.java
index 9f28ef1..90eb3c3 100644
--- a/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorConfigurationCommon.java
+++ b/connectors/examples/twitter-find-connector/src/main/java/org/foo/find/springboot/TwitterFindConnectorConfigurationCommon.java
@@ -43,16 +43,15 @@ public class TwitterFindConnectorConfigurationCommon {
      */
     private String consumerSecret;
     /**
+     * The search keywords. Multiple values can be separated with comma.
+     */
+    private String keywords;
+    /**
      * Filter out old tweets that has previously been polled. This state is
      * stored in memory only and based on last tweet id.
      */
     private boolean filterOld = true;
     /**
-     * Can be used for search and streaming/filter. Multiple values can be
-     * separated with comma.
-     */
-    private String keywords;
-    /**
      * Milliseconds before the next poll.
      */
     private long delay = 5000L;
@@ -93,14 +92,6 @@ public class TwitterFindConnectorConfigurationCommon {
         this.consumerSecret = consumerSecret;
     }
 
-    public boolean isFilterOld() {
-        return filterOld;
-    }
-
-    public void setFilterOld(boolean filterOld) {
-        this.filterOld = filterOld;
-    }
-
     public String getKeywords() {
         return keywords;
     }
@@ -109,6 +100,14 @@ public class TwitterFindConnectorConfigurationCommon {
         this.keywords = keywords;
     }
 
+    public boolean isFilterOld() {
+        return filterOld;
+    }
+
+    public void setFilterOld(boolean filterOld) {
+        this.filterOld = filterOld;
+    }
+
     public long getDelay() {
         return delay;
     }
diff --git a/connectors/examples/twitter-find-connector/src/main/resources/camel-connector-schema.json
b/connectors/examples/twitter-find-connector/src/main/resources/camel-connector-schema.json
index 186b0cf..a4121cc 100644
--- a/connectors/examples/twitter-find-connector/src/main/resources/camel-connector-schema.json
+++ b/connectors/examples/twitter-find-connector/src/main/resources/camel-connector-schema.json
@@ -1,13 +1,13 @@
 {
   "component":{
     "kind":"component",
-    "baseScheme":"twitter",
+    "baseScheme":"twitter-search",
     "scheme":"twitter-find",
-    "syntax":"twitter-find:kind",
+    "syntax":"twitter-find:keywords",
     "title":"TwitterFind",
     "description":"Find for twitter",
     "label":"twitter",
-    "deprecated":true,
+    "deprecated":false,
     "async":false,
     "consumerOnly":true,
     "lenientProperties":false,
@@ -67,6 +67,17 @@
     }
   },
   "properties":{
+    "keywords":{
+      "kind":"path",
+      "displayName":"Keywords",
+      "group":"common",
+      "required":true,
+      "type":"string",
+      "javaType":"java.lang.String",
+      "deprecated":false,
+      "secret":false,
+      "description":"The search keywords. Multiple values can be separated with comma."
+    },
     "filterOld":{
       "kind":"parameter",
       "displayName":"Filter Old",
@@ -80,18 +91,6 @@
       "defaultValue":true,
       "description":"Filter out old tweets that has previously been polled. This state is
stored in memory only and based on last tweet id."
     },
-    "keywords":{
-      "kind":"parameter",
-      "displayName":"Keywords",
-      "group":"filter",
-      "label":"consumer,filter",
-      "required":false,
-      "type":"string",
-      "javaType":"java.lang.String",
-      "deprecated":false,
-      "secret":false,
-      "description":"Can be used for search and streaming\/filter. Multiple values can be
separated with comma."
-    },
     "delay":{
       "kind":"parameter",
       "displayName":"Delay",
diff --git a/connectors/examples/twitter-find-connector/src/main/resources/camel-connector.json
b/connectors/examples/twitter-find-connector/src/main/resources/camel-connector.json
index dff0534..ca4806e 100644
--- a/connectors/examples/twitter-find-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/twitter-find-connector/src/main/resources/camel-connector.json
@@ -1,9 +1,9 @@
 {
-  "baseScheme" : "twitter",
+  "baseScheme" : "twitter-search",
   "baseGroupId" : "org.apache.camel",
   "baseArtifactId" : "camel-twitter",
-  "baseVersion" : "2.21.0-SNAPSHOT",
-  "baseJavaType" : "org.apache.camel.component.twitter.TwitterComponent",
+  "baseVersion" : "2.21.0-20171103.155850-19",
+  "baseJavaType" : "org.apache.camel.component.twitter.search.TwitterSearchComponent",
   "name" : "TwitterFind",
   "scheme" : "twitter-find",
   "javaType" : "org.foo.find.TwitterFindComponent",
@@ -18,7 +18,6 @@
   "componentOptions" : [ "accessToken", "accessTokenSecret", "consumerKey", "consumerSecret"
],
   "endpointOptions" : [ "delay", "keywords", "filterOld" ],
   "endpointValues" : {
-    "kind" : "search",
     "type" : "POLLING",
     "delay" : 5000
   },
diff --git a/connectors/examples/twitter-find-connector/src/test/java/org/foo/find/springboot/TwitterFindConnectorTest.java
b/connectors/examples/twitter-find-connector/src/test/java/org/foo/find/springboot/TwitterFindConnectorTest.java
index fa073b9..a56b010 100644
--- a/connectors/examples/twitter-find-connector/src/test/java/org/foo/find/springboot/TwitterFindConnectorTest.java
+++ b/connectors/examples/twitter-find-connector/src/test/java/org/foo/find/springboot/TwitterFindConnectorTest.java
@@ -16,10 +16,12 @@
  */
 package org.foo.find.springboot;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.twitter.TwitterEndpointPolling;
+import org.apache.camel.component.twitter.search.TwitterSearchEndpoint;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -35,6 +37,9 @@ import org.springframework.test.context.junit4.SpringRunner;
 @DirtiesContext
 @SpringBootApplication
 @SpringBootTest(
+    properties = {
+        "spring.main.banner-mode=off"
+    },
     classes = {
         TwitterFindConnectorTest.TestConfiguration.class
     }
@@ -45,19 +50,40 @@ public class TwitterFindConnectorTest {
 
     @Test
     public void testConfiguration() throws Exception {
-        TwitterEndpointPolling twitterEnpoint = null;
+        List<TwitterSearchEndpoint> endpoints = camelContext.getEndpoints().stream()
+            .filter(TwitterSearchEndpoint.class::isInstance)
+            .map(TwitterSearchEndpoint.class::cast)
+            .collect(Collectors.toList());
+
+        Assert.assertFalse(endpoints.isEmpty());
 
-        for (Endpoint endpoint : camelContext.getEndpoints()) {
-            if (endpoint instanceof TwitterEndpointPolling) {
-                twitterEnpoint = (TwitterEndpointPolling)endpoint;
-                break;
+        endpoints.forEach(endpoint -> {
+            if (endpoint.getEndpointUri().startsWith("twitter-find-component:")) {
+                Assert.assertEquals("cameltest", endpoint.getKeywords());
+                Assert.assertTrue(endpoint.isFilterOld());
+            } else if (endpoint.getEndpointUri().startsWith("twitter-search-tw-find1:"))
{
+                Assert.assertEquals("camelsearchtest1", endpoint.getKeywords());
+                Assert.assertFalse(endpoint.isFilterOld());
+            } else if (endpoint.getEndpointUri().startsWith("twitter-search-tw-find2:"))
{
+                Assert.assertEquals("camelsearchtest2", endpoint.getKeywords());
+                Assert.assertFalse(endpoint.isFilterOld());
+            } else {
+                Assert.fail("Unexpected endpoint " + endpoint.getEndpointUri());
             }
-        }
+        });
 
-        Assert.assertNotNull("No TwitterConsumerPolling found", twitterEnpoint);
-        Assert.assertTrue(twitterEnpoint.getEndpointUri().startsWith("twitter-find-component:"));
-        Assert.assertEquals("camelsearchtest", twitterEnpoint.getKeywords());
-        Assert.assertFalse(twitterEnpoint.isFilterOld());
+        Assert.assertNotEquals(
+            camelContext.getComponent("twitter-find-component"),
+            camelContext.getComponent("twitter-search-tw-find1")
+        );
+        Assert.assertNotEquals(
+            camelContext.getComponent("twitter-find-component"),
+            camelContext.getComponent("twitter-search-tw-find2")
+        );
+        Assert.assertNotEquals(
+            camelContext.getComponent("twitter-search-tw-find1"),
+            camelContext.getComponent("twitter-search-tw-find2")
+        );
     }
 
     // ***********************************
@@ -71,7 +97,13 @@ public class TwitterFindConnectorTest {
             return new RouteBuilder() {
                 @Override
                 public void configure() throws Exception {
-                    from("tw-find?keywords=camelsearchtest&filterOld=false")
+                    from("twitter-find?filterOld=true")
+                        .noAutoStartup()
+                        .to("mock:result");
+                    from("tw-find1?keywords=camelsearchtest1&filterOld=false")
+                        .noAutoStartup()
+                        .to("mock:result");
+                    from("tw-find2?keywords=camelsearchtest2&filterOld=false")
                         .noAutoStartup()
                         .to("mock:result");
                 }
diff --git a/connectors/examples/twitter-find-connector/src/test/resources/application.properties
b/connectors/examples/twitter-find-connector/src/test/resources/application.properties
index 290a001..7185f0c 100644
--- a/connectors/examples/twitter-find-connector/src/test/resources/application.properties
+++ b/connectors/examples/twitter-find-connector/src/test/resources/application.properties
@@ -17,8 +17,20 @@
 
 camel.springboot.name = search
 
-camel.connector.twitter-find.configurations.tw-find.consumer-key = NMqaca1bzXsOcZhP2XlwA
-camel.connector.twitter-find.configurations.tw-find.consumer-secret = VxNQiRLwwKVD0K9mmfxlTTbVdgRpriORypnUbHhxeQw
-camel.connector.twitter-find.configurations.tw-find.access-token = 26693234-W0YjxL9cMJrC0VZZ4xdgFMymxIQ10LeL1K8YlbBY
-camel.connector.twitter-find.configurations.tw-find.access-token-secret = BZD51BgzbOdFstWZYsqB5p5dbuuDV12vrOdatzhY4E
-camel.connector.twitter-find.configurations.tw-find.keywords = cameltest
\ No newline at end of file
+camel.connector.twitter-find.consumer-key = NMqaca1bzXsOcZhP2XlwA
+camel.connector.twitter-find.consumer-secret = VxNQiRLwwKVD0K9mmfxlTTbVdgRpriORypnUbHhxeQw
+camel.connector.twitter-find.access-token = 26693234-W0YjxL9cMJrC0VZZ4xdgFMymxIQ10LeL1K8YlbBY
+camel.connector.twitter-find.access-token-secret = BZD51BgzbOdFstWZYsqB5p5dbuuDV12vrOdatzhY4E
+camel.connector.twitter-find.keywords = cameltest
+
+camel.connector.twitter-find.configurations.tw-find1.consumer-key = NMqaca1bzXsOcZhP2XlwA
+camel.connector.twitter-find.configurations.tw-find1.consumer-secret = VxNQiRLwwKVD0K9mmfxlTTbVdgRpriORypnUbHhxeQw
+camel.connector.twitter-find.configurations.tw-find1.access-token = 26693234-W0YjxL9cMJrC0VZZ4xdgFMymxIQ10LeL1K8YlbBY
+camel.connector.twitter-find.configurations.tw-find1.access-token-secret = BZD51BgzbOdFstWZYsqB5p5dbuuDV12vrOdatzhY4E
+camel.connector.twitter-find.configurations.tw-find1.keywords = cameltest1
+
+camel.connector.twitter-find.configurations.tw-find2.consumer-key = NMqaca1bzXsOcZhP2XlwA
+camel.connector.twitter-find.configurations.tw-find2.consumer-secret = VxNQiRLwwKVD0K9mmfxlTTbVdgRpriORypnUbHhxeQw
+camel.connector.twitter-find.configurations.tw-find2.access-token = 26693234-W0YjxL9cMJrC0VZZ4xdgFMymxIQ10LeL1K8YlbBY
+camel.connector.twitter-find.configurations.tw-find2.access-token-secret = BZD51BgzbOdFstWZYsqB5p5dbuuDV12vrOdatzhY4E
+camel.connector.twitter-find.configurations.tw-find2.keywords = cameltest2
\ No newline at end of file
diff --git a/connectors/examples/twitter-find-connector/src/test/resources/logback.xml b/connectors/examples/twitter-find-connector/src/test/resources/logback.xml
index 203e8e4..93758c1 100644
--- a/connectors/examples/twitter-find-connector/src/test/resources/logback.xml
+++ b/connectors/examples/twitter-find-connector/src/test/resources/logback.xml
@@ -36,5 +36,6 @@
 
   <root level="INFO">
     <appender-ref ref="FILE"/>
+    <!--<appender-ref ref="STDOUT"/>-->
   </root>
 </configuration>
\ No newline at end of file
diff --git a/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/TwitterMentionComponent.java
b/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/TwitterMentionComponent.java
index ba3eaf4..3e76b52 100644
--- a/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/TwitterMentionComponent.java
+++ b/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/TwitterMentionComponent.java
@@ -27,4 +27,8 @@ public class TwitterMentionComponent extends DefaultConnectorComponent {
         super("twitter-mention", "org.foo.mention.TwitterMentionComponent");
     }
 
+    public TwitterMentionComponent(String componentScheme) {
+        super("twitter-mention", componentScheme, "org.foo.mention.TwitterMentionComponent");
+    }
+
 }
diff --git a/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/springboot/TwitterMentionConnectorAutoConfiguration.java
b/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/springboot/TwitterMentionConnectorAutoConfiguration.java
index 383611f..a579eca 100644
--- a/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/springboot/TwitterMentionConnectorAutoConfiguration.java
+++ b/connectors/examples/twitter-mention-connector/src/main/java/org/foo/mention/springboot/TwitterMentionConnectorAutoConfiguration.java
@@ -106,7 +106,8 @@ public class TwitterMentionConnectorAutoConfiguration {
         for (Map.Entry<String, TwitterMentionConnectorConfigurationCommon> entry :
configuration
                 .getConfigurations().entrySet()) {
             parameters.clear();
-            TwitterMentionComponent connector = new TwitterMentionComponent();
+            TwitterMentionComponent connector = new TwitterMentionComponent(
+                    entry.getKey());
             connector.setCamelContext(camelContext);
             try {
                 IntrospectionSupport.getProperties(entry.getValue(),
diff --git a/connectors/examples/twitter-mention-connector/src/main/resources/camel-connector.json
b/connectors/examples/twitter-mention-connector/src/main/resources/camel-connector.json
index 8452a8a..76386eb 100644
--- a/connectors/examples/twitter-mention-connector/src/main/resources/camel-connector.json
+++ b/connectors/examples/twitter-mention-connector/src/main/resources/camel-connector.json
@@ -2,7 +2,7 @@
   "baseScheme" : "twitter",
   "baseGroupId" : "org.apache.camel",
   "baseArtifactId" : "camel-twitter",
-  "baseVersion" : "2.21.0-SNAPSHOT",
+  "baseVersion" : "2.21.0-20171103.155850-19",
   "baseJavaType" : "org.apache.camel.component.twitter.TwitterComponent",
   "name" : "TwitterMention",
   "scheme" : "twitter-mention",
diff --git a/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
b/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
index 5b5ea92..870536b 100644
--- a/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
+++ b/connectors/examples/wine-connector/src/main/java/org/foo/connector/WineComponent.java
@@ -24,4 +24,8 @@ public class WineComponent extends DefaultConnectorComponent {
         super("wine", "org.foo.connector.WineComponent");
     }
 
+    public WineComponent(String componentScheme) {
+        super("wine", componentScheme, "org.foo.connector.WineComponent");
+    }
+
 }
\ No newline at end of file

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

Mime
View raw message