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 2015/06/01 09:10:15 UTC

[01/14] camel git commit: Added slack message helper class

Repository: camel
Updated Branches:
  refs/heads/master 0b4a1675d -> bd36f6245


Added slack message helper class


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

Branch: refs/heads/master
Commit: 62e44a693cd1122f4bcca680c50667fb58ef7147
Parents: 352a306
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:28:18 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:11 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/slack/helper/SlackMessage.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/62e44a69/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
new file mode 100644
index 0000000..d63f68e
--- /dev/null
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
@@ -0,0 +1,7 @@
+package org.apache.camel.component.slack.helper;
+
+/**
+ * Created by mikek on 5/30/15.
+ */
+public class SlackMessage {
+}


[09/14] camel git commit: Added license info

Posted by da...@apache.org.
Added license info


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

Branch: refs/heads/master
Commit: e49d4b5d10ee7dbed130a96d48e98061253c69af
Parents: e780d53
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:51:52 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:13 2015 +0200

----------------------------------------------------------------------
 .../camel/component/slack/SlackComponent.java       | 16 ++++++++++++++++
 .../apache/camel/component/slack/SlackEndpoint.java | 16 ++++++++++++++++
 .../apache/camel/component/slack/SlackProducer.java | 16 ++++++++++++++++
 .../camel/component/slack/helper/SlackMessage.java  | 16 ++++++++++++++++
 .../camel/component/slack/SlackProducerTest.java    | 16 ++++++++++++++++
 5 files changed, 80 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e49d4b5d/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
index af5ca6c..fd1c9ff 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
@@ -1,3 +1,19 @@
+/**
+ * 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.slack;
 
 import org.apache.camel.Endpoint;

http://git-wip-us.apache.org/repos/asf/camel/blob/e49d4b5d/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
index 6e51579..0278ea8 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
@@ -1,3 +1,19 @@
+/**
+ * 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.slack;
 
 import org.apache.camel.Consumer;

http://git-wip-us.apache.org/repos/asf/camel/blob/e49d4b5d/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
index 455d0ad..7fcbb2e 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
@@ -1,3 +1,19 @@
+/**
+ * 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.slack;
 
 import org.apache.camel.CamelException;

http://git-wip-us.apache.org/repos/asf/camel/blob/e49d4b5d/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
index 4cb0462..ceba145 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
@@ -1,3 +1,19 @@
+/**
+ * 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.slack.helper;
 
 import org.json.simple.JSONObject;

http://git-wip-us.apache.org/repos/asf/camel/blob/e49d4b5d/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
index 29691fc..bd3aa98 100644
--- a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
+++ b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
@@ -1,3 +1,19 @@
+/**
+ * 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.slack;
 
 import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;


[07/14] camel git commit: Added some documentation

Posted by da...@apache.org.
Added some documentation


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

Branch: refs/heads/master
Commit: 7930c7a93e2990ed00a9f99e8eb01d72dc5388fd
Parents: dc8e761
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:51:22 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:13 2015 +0200

----------------------------------------------------------------------
 components/camel-slack/README.md | 60 +++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7930c7a9/components/camel-slack/README.md
----------------------------------------------------------------------
diff --git a/components/camel-slack/README.md b/components/camel-slack/README.md
new file mode 100644
index 0000000..09b5dab
--- /dev/null
+++ b/components/camel-slack/README.md
@@ -0,0 +1,60 @@
+Camel Slack Component
+=====================
+
+The **slack** component allows you to connect to an instance of [Slack](http://www.slack.com) and delivers a message contained in the message body via a pre established [Slack incoming webhook](https://api.slack.com/incoming-webhooks).
+
+## URI format
+
+To send a message to a channel.
+
+```
+slack:#channel[?options]
+```
+
+To send a direct message to a slackuser.
+
+```
+slack:@username[?options]
+```
+
+The Slack component only supports producer endpoints so you cannot use this component at the beginning of a route to listen to messages in a channel.
+
+## Options
+
+These options will 
+
+| Option | Example | Description |
+| ------ | ------- | ----------- |
+| `username` | `username=CamelUser` | This is the username that the bot will have when sending messages to a channel or user. |
+| `iconUrl` | `iconUrl=http://somehost.com/avatar.gif` | The avatar that the component will use when sending message to a channel or user. |
+| `iconEmoji` | `iconEmoji=:camel:` | Use a Slack emoji as an avatar |
+
+## SlackComponent
+
+The SlackComponent must be configured as a Spring or Blueprint bean that contains the incoming webhook url for the integration as a parameter.
+
+```
+<bean id="slack" class="io.mikekennedy.camel.SlackComponent">
+    <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
+</bean>
+```
+
+## Example Configuration
+
+```
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+
+    <bean id="slack" class="io.mikekennedy.camel.SlackComponent">
+        <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
+    </bean>
+    
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+        <route>
+            <from uri="direct:test"/>
+            <to uri="slack:#channel?iconEmoji=:camel:&amp;username=CamelTest"/>
+        </route>
+    </camelContext>
+
+</blueprint>
+```
\ No newline at end of file


[13/14] camel git commit: Add camel-slack to kit

Posted by da...@apache.org.
Add camel-slack to kit


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

Branch: refs/heads/master
Commit: eaf4ab99aad4f79a19abc517a6f918fad47113d9
Parents: a0003f5
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jun 1 09:11:44 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 09:11:44 2015 +0200

----------------------------------------------------------------------
 apache-camel/pom.xml                            |  4 +
 .../src/main/descriptors/common-bin.xml         |  1 +
 components/camel-slack/pom.xml                  | 81 ++++++++++----------
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 42 ----------
 .../component/slack/SlackProducerTest.java      |  8 +-
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 42 ++++++++++
 components/pom.xml                              |  1 +
 parent/pom.xml                                  |  6 ++
 8 files changed, 101 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 03cf602..53e6b8c 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -668,6 +668,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-slack</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-smpp</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 48ac728..d24d053 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -178,6 +178,7 @@
         <include>org.apache.camel:camel-shiro</include>
         <include>org.apache.camel:camel-sip</include>
         <include>org.apache.camel:camel-sjms</include>
+        <include>org.apache.camel:camel-slack</include>
         <include>org.apache.camel:camel-smpp</include>
         <include>org.apache.camel:camel-snmp</include>
         <include>org.apache.camel:camel-soap</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/components/camel-slack/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/pom.xml b/components/camel-slack/pom.xml
index dd4292b..16ce46a 100644
--- a/components/camel-slack/pom.xml
+++ b/components/camel-slack/pom.xml
@@ -19,55 +19,56 @@ limitations under the License.
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
-    <modelVersion>4.0.0</modelVersion>
+  <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <artifactId>components</artifactId>
-        <groupId>org.apache.camel</groupId>
-        <version>2.16-SNAPSHOT</version>
-    </parent>
+  <parent>
+    <artifactId>components</artifactId>
+    <groupId>org.apache.camel</groupId>
+    <version>2.16-SNAPSHOT</version>
+  </parent>
 
-    <artifactId>camel-slack</artifactId>
-    <packaging>bundle</packaging>
-    <name>Camel :: Slack</name>
-    <description>Camel Slack Support</description>
+  <artifactId>camel-slack</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Slack</name>
+  <description>Camel Slack Support</description>
 
-    <properties>
-        <camel.osgi.export.pkg>org.apache.camel.component.slack.*</camel.osgi.export.pkg>
-        <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=slack</camel.osgi.export.service>
-    </properties>
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.slack.*</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=slack</camel.osgi.export.service>
+  </properties>
 
-    <dependencies>
+  <dependencies>
 
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-core</artifactId>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
 
-        <dependency>
-            <groupId>com.googlecode.json-simple</groupId>
-            <artifactId>json-simple</artifactId>
-            <version>1.1.1</version>
-        </dependency>
+    <dependency>
+      <groupId>com.googlecode.json-simple</groupId>
+      <artifactId>json-simple</artifactId>
+      <version>${json-simple-version}</version>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>${httpclient4-version}</version>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>${httpclient4-version}</version>
+    </dependency>
 
-        <!-- test dependencies -->
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-blueprint</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>test</scope>
-        </dependency>
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-blueprint</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
 
-    </dependencies>
+  </dependencies>
 
 
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 08a6da5..0000000
--- a/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-    <bean id="slack" class="org.apache.camel.component.slack.SlackComponent">
-        <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
-    </bean>
-
-    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
-        <onException>
-            <exception>java.lang.Exception</exception>
-            <handled>
-                <constant>true</constant>
-            </handled>
-            <to uri="mock:errors"/>
-        </onException>
-        <route>
-            <from uri="direct:test"/>
-            <to uri="slack:#general?iconEmoji=:camel:&amp;username=CamelTest"/>
-        </route>
-        <route>
-            <from uri="direct:error"/>
-            <to uri="slack:#badchannel?iconEmoji=:camel:&amp;username=CamelTest"/>
-        </route>
-    </camelContext>
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
index bd3aa98..457418b 100644
--- a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
+++ b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
@@ -28,15 +28,19 @@ public class SlackProducerTest extends CamelBlueprintTestSupport {
 
     @Test
     public void testSlackMessage() throws Exception {
-        getMockEndpoint(("mock:errors")).expectedMessageCount(0);
+        getMockEndpoint("mock:errors").expectedMessageCount(0);
+
         template.sendBody("direct:test", "Hello from Camel!");
+
         assertMockEndpointsSatisfied();
     }
 
     @Test
     public void testSlackError() throws Exception {
-        getMockEndpoint(("mock:errors")).expectedMessageCount(1);
+        getMockEndpoint("mock:errors").expectedMessageCount(1);
+
         template.sendBody("direct:error", "Error from Camel!");
+
         assertMockEndpointsSatisfied();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/components/camel-slack/src/test/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/test/resources/OSGI-INF/blueprint/blueprint.xml b/components/camel-slack/src/test/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..08a6da5
--- /dev/null
+++ b/components/camel-slack/src/test/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+
+    <bean id="slack" class="org.apache.camel.component.slack.SlackComponent">
+        <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
+    </bean>
+
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+        <onException>
+            <exception>java.lang.Exception</exception>
+            <handled>
+                <constant>true</constant>
+            </handled>
+            <to uri="mock:errors"/>
+        </onException>
+        <route>
+            <from uri="direct:test"/>
+            <to uri="slack:#general?iconEmoji=:camel:&amp;username=CamelTest"/>
+        </route>
+        <route>
+            <from uri="direct:error"/>
+            <to uri="slack:#badchannel?iconEmoji=:camel:&amp;username=CamelTest"/>
+        </route>
+    </camelContext>
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index e364395..c6fa5ba 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -199,6 +199,7 @@
     <module>camel-smpp</module>
     <module>camel-snmp</module>
     <module>camel-sjms</module>
+    <module>camel-slack</module>
     <module>camel-soap</module>
     <module>camel-solr</module>
     <module>camel-spark-rest</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/eaf4ab99/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d50ea24..ea2dd1a 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -294,6 +294,7 @@
     <json4s-bundle-version>3.2.8_1</json4s-bundle-version>
     <json-asm-version>1.0.2</json-asm-version>
     <json-path-version>2.0.0</json-path-version>
+    <json-simple-version>1.1.1</json-simple-version>
     <json-smart-version>2.1.1</json-smart-version>
     <jsp-api-2.1-version>1.0.1</jsp-api-2.1-version>
     <jsr311-api-version>1.1.1</jsr311-api-version>
@@ -1375,6 +1376,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-slack</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-soap</artifactId>
         <version>${project.version}</version>
       </dependency>


[03/14] camel git commit: Added a test blueprint file

Posted by da...@apache.org.
Added a test blueprint file


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

Branch: refs/heads/master
Commit: c14d4ef746ab882acbf843168e6bff71561f3759
Parents: ee05713
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:46:30 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:12 2015 +0200

----------------------------------------------------------------------
 .../resources/OSGI-INF/blueprint/blueprint.xml  | 42 ++++++++++++++++++++
 1 file changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c14d4ef7/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index e69de29..08a6da5 100644
--- a/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+
+    <bean id="slack" class="org.apache.camel.component.slack.SlackComponent">
+        <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
+    </bean>
+
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+        <onException>
+            <exception>java.lang.Exception</exception>
+            <handled>
+                <constant>true</constant>
+            </handled>
+            <to uri="mock:errors"/>
+        </onException>
+        <route>
+            <from uri="direct:test"/>
+            <to uri="slack:#general?iconEmoji=:camel:&amp;username=CamelTest"/>
+        </route>
+        <route>
+            <from uri="direct:error"/>
+            <to uri="slack:#badchannel?iconEmoji=:camel:&amp;username=CamelTest"/>
+        </route>
+    </camelContext>
+
+</blueprint>


[12/14] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


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

Branch: refs/heads/master
Commit: a0003f5645b073682c61fab245b23f66dc143cb9
Parents: dab79df
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jun 1 09:06:14 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 09:06:14 2015 +0200

----------------------------------------------------------------------
 .../camel/component/slack/SlackComponent.java   | 28 ++++-----
 .../camel/component/slack/SlackEndpoint.java    | 60 +++++++++++++-------
 .../camel/component/slack/SlackProducer.java    | 47 ++++++++++-----
 .../component/slack/helper/SlackMessage.java    | 28 ---------
 .../src/test/resources/log4j.properties         | 35 ++++++++++++
 5 files changed, 116 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a0003f56/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
index fd1c9ff..9929d82 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
@@ -16,27 +16,26 @@
  */
 package org.apache.camel.component.slack;
 
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.util.Map;
 
-public class SlackComponent extends DefaultComponent {
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.UriEndpointComponent;
 
-    private static final transient Logger LOG = LoggerFactory.getLogger(SlackComponent.class);
+public class SlackComponent extends UriEndpointComponent {
 
     private String webhookUrl;
 
+    public SlackComponent() {
+        super(SlackEndpoint.class);
+    }
+
     /**
      * Create a slack endpoint
      *
-     * @param uri the full URI of the endpoint
+     * @param uri         the full URI of the endpoint
      * @param channelName the channel or username that the message should be sent to
-     * @param parameters the optional parameters passed in
+     * @param parameters  the optional parameters passed in
      * @return the camel endpoint
-     * @throws Exception
      */
     @Override
     protected Endpoint createEndpoint(String uri, String channelName, Map<String, Object> parameters) throws Exception {
@@ -45,19 +44,12 @@ public class SlackComponent extends DefaultComponent {
         return endpoint;
     }
 
-    /**
-     * Getter for the incoming webhook URL
-     *
-     * @return String containing the incoming webhook URL
-     */
     public String getWebhookUrl() {
         return webhookUrl;
     }
 
     /**
-     * Setter for the incoming webhook URL
-     *
-     * @param webhookUrl the incoming webhook URL
+     * The incoming webhook URL
      */
     public void setWebhookUrl(String webhookUrl) {
         this.webhookUrl = webhookUrl;

http://git-wip-us.apache.org/repos/asf/camel/blob/a0003f56/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
index 0278ea8..e3d0d10 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
@@ -20,17 +20,23 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
 
+@UriEndpoint(scheme = "slack", title = "Slack", syntax = "slack:channel", producerOnly = true, label = "social")
 public class SlackEndpoint extends DefaultEndpoint {
 
-    private static final transient Logger LOG = LoggerFactory.getLogger(SlackEndpoint.class);
-
+    @UriPath @Metadata(required = "true")
+    private String channel;
+    @UriParam
     private String webhookUrl;
+    @UriParam
     private String username;
-    private String channel;
+    @UriParam
     private String iconUrl;
+    @UriParam
     private String iconEmoji;
 
     /**
@@ -46,25 +52,12 @@ public class SlackEndpoint extends DefaultEndpoint {
         this.channel = channelName;
     }
 
-    /**
-     * Creates a SlackProducer
-     *
-     * @return SlackProducer
-     * @throws Exception
-     */
     @Override
     public Producer createProducer() throws Exception {
         SlackProducer producer = new SlackProducer(this);
         return producer;
     }
 
-    /**
-     * Unsupported operation
-     *
-     * @param processor
-     * @return
-     * @throws java.lang.UnsupportedOperationException
-     */
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
         throw new UnsupportedOperationException("You cannot consume slack messages from this endpoint: " + getEndpointUri());
@@ -75,26 +68,46 @@ public class SlackEndpoint extends DefaultEndpoint {
         return true;
     }
 
+    /**
+     * The incoming webhook URL
+     */
+    public void setWebhookUrl(String webhookUrl) {
+        this.webhookUrl = webhookUrl;
+    }
+
     public String getWebhookUrl() {
         return webhookUrl;
     }
 
+    public String getChannel() {
+        return channel;
+    }
+
+    /**
+     * The channel name (syntax #name) or slackuser (syntax @userName) to send a message directly to an user.
+     */
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
     public String getUsername() {
         return username;
     }
 
+    /**
+     * This is the username that the bot will have when sending messages to a channel or user.
+     */
     public void setUsername(String username) {
         this.username = username;
     }
 
-    public String getChannel() {
-        return channel;
-    }
-
     public String getIconUrl() {
         return iconUrl;
     }
 
+    /**
+     * The avatar that the component will use when sending message to a channel or user.
+     */
     public void setIconUrl(String iconUrl) {
         this.iconUrl = iconUrl;
     }
@@ -103,6 +116,9 @@ public class SlackEndpoint extends DefaultEndpoint {
         return iconEmoji;
     }
 
+    /**
+     * Use a Slack emoji as an avatar
+     */
     public void setIconEmoji(String iconEmoji) {
         this.iconEmoji = iconEmoji;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/a0003f56/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
index 7fcbb2e..637f830 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
@@ -16,7 +16,10 @@
  */
 package org.apache.camel.component.slack;
 
-import org.apache.camel.CamelException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.slack.helper.SlackMessage;
 import org.apache.camel.impl.DefaultProducer;
@@ -25,20 +28,12 @@ import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClientBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.json.simple.JSONObject;
 
 public class SlackProducer extends DefaultProducer {
 
-    private static final transient Logger LOG = LoggerFactory.getLogger(SlackProducer.class);
-
     private SlackEndpoint slackEndpoint;
 
-    /**
-     * Constuctor
-     *
-     * @param endpoint a SlackEndpoint
-     */
     public SlackProducer(SlackEndpoint endpoint) {
         super(endpoint);
         this.slackEndpoint = endpoint;
@@ -60,16 +55,40 @@ public class SlackProducer extends DefaultProducer {
         slackMessage.setIconEmoji(slackEndpoint.getIconEmoji());
 
         // Set the post body
-        StringEntity body = new StringEntity(slackMessage.toString());
+        String json = asJson(slackMessage);
+        StringEntity body = new StringEntity(json);
 
         // Do the post
         httpPost.setEntity(body);
 
         HttpResponse response = client.execute(httpPost);
 
-        if (response.getStatusLine().getStatusCode() != 200) {
-            LOG.error("Error POSTing to Slack API: " + response.toString());
-            throw new CamelException("Error POSTing to Slack API: " + response.toString());
+        // 2xx is OK, anything else we regard as failure
+        if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 299) {
+            throw new CamelExchangeException("Error POSTing to Slack API: " + response.toString(), exchange);
         }
     }
+
+    /**
+     * Returns a JSON string to be posted to the Slack API
+     *
+     * @return JSON string
+     */
+    public String asJson(SlackMessage message) {
+        Map<String, String> jsonMap = new HashMap<String, String>();
+
+        // Put the values in a map
+        jsonMap.put("text", message.getText());
+        jsonMap.put("channel", message.getChannel());
+        jsonMap.put("username", message.getUsername());
+        jsonMap.put("icon_url", message.getIconUrl());
+        jsonMap.put("icon_emoji", message.getIconEmoji());
+
+        // Generate a JSONObject
+        JSONObject jsonObject = new JSONObject(jsonMap);
+
+        // Return the string based on the JSON Object
+        return JSONObject.toJSONString(jsonObject);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a0003f56/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
index ceba145..8b33633 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
@@ -16,11 +16,6 @@
  */
 package org.apache.camel.component.slack.helper;
 
-import org.json.simple.JSONObject;
-
-import java.util.HashMap;
-import java.util.Map;
-
 public class SlackMessage {
 
     private String text;
@@ -69,28 +64,5 @@ public class SlackMessage {
         this.iconEmoji = iconEmoji;
     }
 
-    /**
-     * Returns a JSON string to be posted to the Slack API
-     *
-     * @return JSON string
-     */
-    public String toString() {
-
-        Map<String, String> jsonMap = new HashMap<String, String>();
-
-        // Put the values in a map
-        jsonMap.put("text", this.text);
-        jsonMap.put("channel", this.channel);
-        jsonMap.put("username", this.username);
-        jsonMap.put("icon_url", this.iconUrl);
-        jsonMap.put("icon_emoji", this.iconEmoji);
-
-        // Generate a JSONObject
-        JSONObject jsonObject = new JSONObject(jsonMap);
-
-        // Return the string based on the JSON Object
-        return JSONObject.toJSONString(jsonMap);
-
-    }
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/a0003f56/components/camel-slack/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/test/resources/log4j.properties b/components/camel-slack/src/test/resources/log4j.properties
new file mode 100644
index 0000000..7b3e914
--- /dev/null
+++ b/components/camel-slack/src/test/resources/log4j.properties
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, file
+
+#log4j.logger.org.apache.camel=INFO
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-slack-test.log
+log4j.appender.file.append=false


[05/14] camel git commit: Added camel blueprint test support

Posted by da...@apache.org.
Added camel blueprint test support


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

Branch: refs/heads/master
Commit: ee05713759bf4821ee39073a3de2e6e51cfe5d99
Parents: a4935d9
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:46:10 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:12 2015 +0200

----------------------------------------------------------------------
 components/camel-slack/pom.xml                               | 8 +-------
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml      | 0
 .../org/apache/camel/component/slack/SlackProducerTest.java  | 7 +++++++
 3 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ee057137/components/camel-slack/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/pom.xml b/components/camel-slack/pom.xml
index da75056..d88d690 100644
--- a/components/camel-slack/pom.xml
+++ b/components/camel-slack/pom.xml
@@ -37,14 +37,8 @@
 
         <!-- test dependencies -->
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test</artifactId>
-            <scope>test</scope>
+            <artifactId>camel-test-blueprint</artifactId>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/ee057137/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/components/camel-slack/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/camel/blob/ee057137/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
new file mode 100644
index 0000000..52e12b9
--- /dev/null
+++ b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
@@ -0,0 +1,7 @@
+package org.apache.camel.component.slack;
+
+/**
+ * Created by mikek on 5/30/15.
+ */
+public class SlackProducerTest {
+}


[04/14] camel git commit: Added dependencies on httpclient and json-simple

Posted by da...@apache.org.
Added dependencies on httpclient and json-simple


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

Branch: refs/heads/master
Commit: c7539a7e7ccb6b5a24f133b94ec641a29383446f
Parents: 62e44a6
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:28:50 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:12 2015 +0200

----------------------------------------------------------------------
 components/camel-slack/pom.xml                  | 12 +++
 .../camel/component/slack/SlackProducer.java    | 57 +++++++++++++-
 .../component/slack/helper/SlackMessage.java    | 79 +++++++++++++++++++-
 3 files changed, 144 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c7539a7e/components/camel-slack/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/pom.xml b/components/camel-slack/pom.xml
index 121826b..da75056 100644
--- a/components/camel-slack/pom.xml
+++ b/components/camel-slack/pom.xml
@@ -23,6 +23,18 @@
             <artifactId>camel-core</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.googlecode.json-simple</groupId>
+            <artifactId>json-simple</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>${httpclient4-version}</version>
+        </dependency>
+
         <!-- test dependencies -->
         <dependency>
             <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/c7539a7e/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
index f3a5b1c..455d0ad 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
@@ -1,4 +1,59 @@
 package org.apache.camel.component.slack;
 
-public class SlackProducer {
+import org.apache.camel.CamelException;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.slack.helper.SlackMessage;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SlackProducer extends DefaultProducer {
+
+    private static final transient Logger LOG = LoggerFactory.getLogger(SlackProducer.class);
+
+    private SlackEndpoint slackEndpoint;
+
+    /**
+     * Constuctor
+     *
+     * @param endpoint a SlackEndpoint
+     */
+    public SlackProducer(SlackEndpoint endpoint) {
+        super(endpoint);
+        this.slackEndpoint = endpoint;
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+
+        // Create an HttpClient and Post object
+        HttpClient client = HttpClientBuilder.create().build();
+        HttpPost httpPost = new HttpPost(slackEndpoint.getWebhookUrl());
+
+        // Build Helper object
+        SlackMessage slackMessage = new SlackMessage();
+        slackMessage.setText(exchange.getIn().getBody(String.class));
+        slackMessage.setChannel(slackEndpoint.getChannel());
+        slackMessage.setUsername(slackEndpoint.getUsername());
+        slackMessage.setIconUrl(slackEndpoint.getIconUrl());
+        slackMessage.setIconEmoji(slackEndpoint.getIconEmoji());
+
+        // Set the post body
+        StringEntity body = new StringEntity(slackMessage.toString());
+
+        // Do the post
+        httpPost.setEntity(body);
+
+        HttpResponse response = client.execute(httpPost);
+
+        if (response.getStatusLine().getStatusCode() != 200) {
+            LOG.error("Error POSTing to Slack API: " + response.toString());
+            throw new CamelException("Error POSTing to Slack API: " + response.toString());
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c7539a7e/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
index d63f68e..4cb0462 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/helper/SlackMessage.java
@@ -1,7 +1,80 @@
 package org.apache.camel.component.slack.helper;
 
-/**
- * Created by mikek on 5/30/15.
- */
+import org.json.simple.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
 public class SlackMessage {
+
+    private String text;
+    private String channel;
+    private String username;
+    private String iconUrl;
+    private String iconEmoji;
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public void setChannel(String channel) {
+        this.channel = channel;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getIconUrl() {
+        return iconUrl;
+    }
+
+    public void setIconUrl(String iconUrl) {
+        this.iconUrl = iconUrl;
+    }
+
+    public String getIconEmoji() {
+        return iconEmoji;
+    }
+
+    public void setIconEmoji(String iconEmoji) {
+        this.iconEmoji = iconEmoji;
+    }
+
+    /**
+     * Returns a JSON string to be posted to the Slack API
+     *
+     * @return JSON string
+     */
+    public String toString() {
+
+        Map<String, String> jsonMap = new HashMap<String, String>();
+
+        // Put the values in a map
+        jsonMap.put("text", this.text);
+        jsonMap.put("channel", this.channel);
+        jsonMap.put("username", this.username);
+        jsonMap.put("icon_url", this.iconUrl);
+        jsonMap.put("icon_emoji", this.iconEmoji);
+
+        // Generate a JSONObject
+        JSONObject jsonObject = new JSONObject(jsonMap);
+
+        // Return the string based on the JSON Object
+        return JSONObject.toJSONString(jsonMap);
+
+    }
 }
+


[06/14] camel git commit: Added component file

Posted by da...@apache.org.
Added component file


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

Branch: refs/heads/master
Commit: a4935d92207c57110774c799887dddb8a1a8674a
Parents: c7539a7
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:29:16 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:12 2015 +0200

----------------------------------------------------------------------
 .../services/org/apache/camel/component/slack     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a4935d92/components/camel-slack/src/main/resources/META-INF/services/org/apache/camel/component/slack
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/resources/META-INF/services/org/apache/camel/component/slack b/components/camel-slack/src/main/resources/META-INF/services/org/apache/camel/component/slack
new file mode 100644
index 0000000..c4862e0
--- /dev/null
+++ b/components/camel-slack/src/main/resources/META-INF/services/org/apache/camel/component/slack
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.slack.SlackComponent


[14/14] camel git commit: Add camel-slack to features

Posted by da...@apache.org.
Add camel-slack to features


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

Branch: refs/heads/master
Commit: bd36f6245bdb4eec2181cfce6fb4959bd3ccba9c
Parents: eaf4ab9
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jun 1 09:14:42 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 09:14:42 2015 +0200

----------------------------------------------------------------------
 .../features/src/main/resources/features.xml    |  8 ++++
 .../camel/itest/karaf/CamelSlackTest.java       | 40 ++++++++++++++++++++
 2 files changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bd36f624/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 7f7d345..1e26ccf 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1314,6 +1314,14 @@
     <feature version='${project.version}'>camel-core</feature>
     <bundle>mvn:org.apache.camel/camel-sjms/${project.version}</bundle>
   </feature>
+  <feature name='camel-slack' version='${project.version}' resolver='(obr)' start-level='50'>
+    <bundle dependency='true'>mvn:com.googlecode.json-simple/json-simple/${json-simple-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpcore-osgi/${httpcore4-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.geronimo.specs/geronimo-servlet_3.0_spec/${geronimo-servlet-spec-version}</bundle>
+    <feature version='${project.version}'>camel-core</feature>
+    <bundle>mvn:org.apache.camel/camel-slack/${project.version}</bundle>
+  </feature>
   <feature name='camel-smpp' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsmpp/${jsmpp-bundle-version}</bundle>

http://git-wip-us.apache.org/repos/asf/camel/blob/bd36f624/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSlackTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSlackTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSlackTest.java
new file mode 100644
index 0000000..8c39d8d
--- /dev/null
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSlackTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.itest.karaf;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelSlackTest extends AbstractFeatureTest {
+
+    public static final String COMPONENT = extractName(CamelSlackTest.class);
+
+    @Test
+    public void test() throws Exception {
+        testComponent(COMPONENT);
+    }
+
+    @Configuration
+    public static Option[] configure() {
+        return configure(COMPONENT);
+    }
+
+}
\ No newline at end of file


[08/14] camel git commit: Cleaned up pom to build as a bundle

Posted by da...@apache.org.
Cleaned up pom to build as a bundle


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

Branch: refs/heads/master
Commit: e780d5300928a31b9356b33c1a27deedf7c56776
Parents: 7930c7a
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:51:38 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:13 2015 +0200

----------------------------------------------------------------------
 components/camel-slack/pom.xml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e780d530/components/camel-slack/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/pom.xml b/components/camel-slack/pom.xml
index d88d690..dd4292b 100644
--- a/components/camel-slack/pom.xml
+++ b/components/camel-slack/pom.xml
@@ -1,4 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -16,6 +32,11 @@
     <name>Camel :: Slack</name>
     <description>Camel Slack Support</description>
 
+    <properties>
+        <camel.osgi.export.pkg>org.apache.camel.component.slack.*</camel.osgi.export.pkg>
+        <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=slack</camel.osgi.export.service>
+    </properties>
+
     <dependencies>
 
         <dependency>


[02/14] camel git commit: Initial commit

Posted by da...@apache.org.
Initial commit


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

Branch: refs/heads/master
Commit: 352a306b12b9f00585b4f4d20bf570f594f685b6
Parents: 0b4a167
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:18:56 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:11 2015 +0200

----------------------------------------------------------------------
 components/camel-slack/pom.xml                  | 46 ++++++++++
 .../camel/component/slack/SlackComponent.java   | 49 ++++++++++
 .../camel/component/slack/SlackEndpoint.java    | 94 ++++++++++++++++++++
 .../camel/component/slack/SlackProducer.java    |  4 +
 4 files changed, 193 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/352a306b/components/camel-slack/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-slack/pom.xml b/components/camel-slack/pom.xml
new file mode 100644
index 0000000..121826b
--- /dev/null
+++ b/components/camel-slack/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>components</artifactId>
+        <groupId>org.apache.camel</groupId>
+        <version>2.16-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-slack</artifactId>
+    <packaging>bundle</packaging>
+    <name>Camel :: Slack</name>
+    <description>Camel Slack Support</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/352a306b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
new file mode 100644
index 0000000..af5ca6c
--- /dev/null
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponent.java
@@ -0,0 +1,49 @@
+package org.apache.camel.component.slack;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Map;
+
+public class SlackComponent extends DefaultComponent {
+
+    private static final transient Logger LOG = LoggerFactory.getLogger(SlackComponent.class);
+
+    private String webhookUrl;
+
+    /**
+     * Create a slack endpoint
+     *
+     * @param uri the full URI of the endpoint
+     * @param channelName the channel or username that the message should be sent to
+     * @param parameters the optional parameters passed in
+     * @return the camel endpoint
+     * @throws Exception
+     */
+    @Override
+    protected Endpoint createEndpoint(String uri, String channelName, Map<String, Object> parameters) throws Exception {
+        Endpoint endpoint = new SlackEndpoint(uri, channelName, this);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+
+    /**
+     * Getter for the incoming webhook URL
+     *
+     * @return String containing the incoming webhook URL
+     */
+    public String getWebhookUrl() {
+        return webhookUrl;
+    }
+
+    /**
+     * Setter for the incoming webhook URL
+     *
+     * @param webhookUrl the incoming webhook URL
+     */
+    public void setWebhookUrl(String webhookUrl) {
+        this.webhookUrl = webhookUrl;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/352a306b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
new file mode 100644
index 0000000..6e51579
--- /dev/null
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackEndpoint.java
@@ -0,0 +1,94 @@
+package org.apache.camel.component.slack;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SlackEndpoint extends DefaultEndpoint {
+
+    private static final transient Logger LOG = LoggerFactory.getLogger(SlackEndpoint.class);
+
+    private String webhookUrl;
+    private String username;
+    private String channel;
+    private String iconUrl;
+    private String iconEmoji;
+
+    /**
+     * Constructor for SlackEndpoint
+     *
+     * @param uri the full component url
+     * @param channelName the channel or username the message is directed at
+     * @param component the component that was created
+     */
+    public SlackEndpoint(String uri, String channelName, SlackComponent component) {
+        super(uri, component);
+        this.webhookUrl = component.getWebhookUrl();
+        this.channel = channelName;
+    }
+
+    /**
+     * Creates a SlackProducer
+     *
+     * @return SlackProducer
+     * @throws Exception
+     */
+    @Override
+    public Producer createProducer() throws Exception {
+        SlackProducer producer = new SlackProducer(this);
+        return producer;
+    }
+
+    /**
+     * Unsupported operation
+     *
+     * @param processor
+     * @return
+     * @throws java.lang.UnsupportedOperationException
+     */
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException("You cannot consume slack messages from this endpoint: " + getEndpointUri());
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public String getWebhookUrl() {
+        return webhookUrl;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getChannel() {
+        return channel;
+    }
+
+    public String getIconUrl() {
+        return iconUrl;
+    }
+
+    public void setIconUrl(String iconUrl) {
+        this.iconUrl = iconUrl;
+    }
+
+    public String getIconEmoji() {
+        return iconEmoji;
+    }
+
+    public void setIconEmoji(String iconEmoji) {
+        this.iconEmoji = iconEmoji;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/352a306b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
new file mode 100644
index 0000000..f3a5b1c
--- /dev/null
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
@@ -0,0 +1,4 @@
+package org.apache.camel.component.slack;
+
+public class SlackProducer {
+}


[11/14] camel git commit: Removed references to io.mkennedy

Posted by da...@apache.org.
Removed references to io.mkennedy


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

Branch: refs/heads/master
Commit: dab79df0528f592d1d70ef67bca201a9f29b6606
Parents: e49d4b5
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:54:18 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:14 2015 +0200

----------------------------------------------------------------------
 components/camel-slack/README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dab79df0/components/camel-slack/README.md
----------------------------------------------------------------------
diff --git a/components/camel-slack/README.md b/components/camel-slack/README.md
index 09b5dab..54ea564 100644
--- a/components/camel-slack/README.md
+++ b/components/camel-slack/README.md
@@ -34,7 +34,7 @@ These options will
 The SlackComponent must be configured as a Spring or Blueprint bean that contains the incoming webhook url for the integration as a parameter.
 
 ```
-<bean id="slack" class="io.mikekennedy.camel.SlackComponent">
+<bean id="slack" class="org.apache.camel.component.SlackComponent">
     <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
 </bean>
 ```
@@ -45,7 +45,7 @@ The SlackComponent must be configured as a Spring or Blueprint bean that contain
 <?xml version="1.0" encoding="UTF-8"?>
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
 
-    <bean id="slack" class="io.mikekennedy.camel.SlackComponent">
+    <bean id="slack" class="org.apache.camel.component.SlackComponent">
         <property name="webhookUrl" value="https://hooks.slack.com/services/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"/>
     </bean>
     


[10/14] camel git commit: Refactored test to use blueprint

Posted by da...@apache.org.
Refactored test to use blueprint


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

Branch: refs/heads/master
Commit: dc8e761e475b3b1d7e7c9e21ef1539b4b9b0eca5
Parents: c14d4ef
Author: Mike Kennedy <mi...@ucr.edu>
Authored: Sat May 30 23:46:49 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jun 1 08:55:13 2015 +0200

----------------------------------------------------------------------
 .../component/slack/SlackProducerTest.java      | 27 +++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dc8e761e/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
index 52e12b9..29691fc 100644
--- a/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
+++ b/components/camel-slack/src/test/java/org/apache/camel/component/slack/SlackProducerTest.java
@@ -1,7 +1,26 @@
 package org.apache.camel.component.slack;
 
-/**
- * Created by mikek on 5/30/15.
- */
-public class SlackProducerTest {
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.Test;
+
+public class SlackProducerTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "OSGI-INF/blueprint/blueprint.xml";
+    }
+
+    @Test
+    public void testSlackMessage() throws Exception {
+        getMockEndpoint(("mock:errors")).expectedMessageCount(0);
+        template.sendBody("direct:test", "Hello from Camel!");
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testSlackError() throws Exception {
+        getMockEndpoint(("mock:errors")).expectedMessageCount(1);
+        template.sendBody("direct:error", "Error from Camel!");
+        assertMockEndpointsSatisfied();
+    }
 }