You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2017/03/31 19:29:02 UTC

camel git commit: CAMEL-11098: lets make FacebookEndpointConfiguration UriParam work by adding a setter for the field

Repository: camel
Updated Branches:
  refs/heads/master daca8394b -> a120a7943


CAMEL-11098: lets make FacebookEndpointConfiguration UriParam work by adding a setter for the field


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

Branch: refs/heads/master
Commit: a120a7943ab2c6878b04522755f7d2c7d794a322
Parents: daca839
Author: jpoth <po...@gmail.com>
Authored: Fri Mar 31 17:44:09 2017 +0200
Committer: Zoran Regvart <zr...@apache.org>
Committed: Fri Mar 31 21:28:49 2017 +0200

----------------------------------------------------------------------
 components/camel-facebook/pom.xml               |  1 +
 .../component/facebook/FacebookEndpoint.java    |  9 ++++
 .../FacebookEndpointConfigurationTest.java      | 49 ++++++++++++++++++++
 3 files changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a120a794/components/camel-facebook/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-facebook/pom.xml b/components/camel-facebook/pom.xml
index 273f240..d105fc0 100644
--- a/components/camel-facebook/pom.xml
+++ b/components/camel-facebook/pom.xml
@@ -92,6 +92,7 @@
             <!-- Here we only run test of  -->
             <include>**/ReadingBuilderTest.java</include>
             <include>**/FacebookMethodsType*Test.java</include>
+            <include>**/FacebookEndpointConfigurationTest.java</include>
           </includes>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/camel/blob/a120a794/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java b/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
index 3735375..50696f6 100644
--- a/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
+++ b/components/camel-facebook/src/main/java/org/apache/camel/component/facebook/FacebookEndpoint.java
@@ -205,4 +205,13 @@ public class FacebookEndpoint extends DefaultEndpoint implements FacebookConstan
         this.inBody = inBody;
     }
 
+    /**
+     * Sets the {@link FacebookEndpointConfiguration} to use
+     * 
+     * @param configuration the {@link FacebookEndpointConfiguration} to use
+     */
+    public void setConfiguration(FacebookEndpointConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a120a794/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/config/FacebookEndpointConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/config/FacebookEndpointConfigurationTest.java b/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/config/FacebookEndpointConfigurationTest.java
new file mode 100644
index 0000000..a5a54f1
--- /dev/null
+++ b/components/camel-facebook/src/test/java/org/apache/camel/component/facebook/config/FacebookEndpointConfigurationTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.facebook.config;
+
+
+import org.apache.camel.component.facebook.FacebookComponent;
+import org.apache.camel.component.facebook.FacebookEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class FacebookEndpointConfigurationTest extends CamelTestSupport {
+
+    @Test
+    public void testConfigurationBeanUriParam() throws Exception {
+        FacebookComponent component = new FacebookComponent(context);
+        FacebookEndpoint facebookEndpoint = (FacebookEndpoint) component.createEndpoint("facebook://getFeed?configuration=#configuration");
+        assertTrue("Configuration bean wasn't taken into account!", "fakeId".equals(facebookEndpoint.getConfiguration().getOAuthAppId()));
+        assertTrue("Configuration bean wasn't taken into account!", "fakeSecret".equals(facebookEndpoint.getConfiguration().getOAuthAppSecret()));
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        FacebookEndpointConfiguration facebookEndpointConfiguration = new FacebookEndpointConfiguration();
+        facebookEndpointConfiguration.setOAuthAppId("fakeId");
+        facebookEndpointConfiguration.setOAuthAppSecret("fakeSecret");
+        jndi.bind("configuration", facebookEndpointConfiguration);
+        return jndi;
+    }
+
+}