Repository: camel
Updated Branches:
  refs/heads/master 424abd63c -> 654c33aab


http://git-wip-us.apache.org/repos/asf/camel/blob/1028f3cc/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatConsumerIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatConsumerIntegrationTest.java
 
b/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatConsumerIntegrationTest.java
new file mode 100644
index 0000000..d35149c
--- /dev/null
+++ 
b/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatConsumerIntegrationTest.java
@@ -0,0 +1,67 @@
+/**
+ * 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.hipchat.integration;
+
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Predicate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.hipchat.HipchatConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.idempotent.MemoryIdempotentRepository;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.http.StatusLine;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("Must be manually tested. Provide your own auth key, user, & room from 
https://www.hipchat.com/docs/apiv2/auth";)
+public class HipchatConsumerIntegrationTest extends CamelTestSupport {
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint result;
+
+    @Test
+    public void sendInOnly() throws Exception {
+        result.expectedMessageCount(1);
+        result.expectedMessagesMatches(new Predicate() {
+            @Override
+            public boolean matches(Exchange exchange) {
+                StatusLine status = 
(StatusLine)exchange.getIn().getHeader(HipchatConstants.FROM_USER_RESPONSE_STATUS);
+                return 200 == status.getStatusCode();
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                String hipchatEndpointUri = 
"hipchat://?authToken=XXXX&consumeUsers=@ShreyasPurohit&delay=1000";
+
+                from(hipchatEndpointUri)
+                    .idempotentConsumer(
+                        simple("${in.header.HipchatMessageDate} 
${in.header.HipchatFromUser}"),
+                        
MemoryIdempotentRepository.memoryIdempotentRepository(200)
+                    )
+                    .to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/1028f3cc/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatProducerIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatProducerIntegrationTest.java
 
b/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatProducerIntegrationTest.java
new file mode 100644
index 0000000..6f83930
--- /dev/null
+++ 
b/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/integration/HipchatProducerIntegrationTest.java
@@ -0,0 +1,93 @@
+/**
+ * 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.hipchat.integration;
+
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.hipchat.HipchatConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.http.StatusLine;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("Must be manually tested. Provide your own auth key, user, & room from 
https://www.hipchat.com/docs/apiv2/auth";)
+public class HipchatProducerIntegrationTest extends CamelTestSupport {
+    @EndpointInject(uri = "direct:start")
+    private ProducerTemplate template;
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint result;
+
+    @Test
+    public void sendInOnly() throws Exception {
+        result.expectedMessageCount(2);
+
+        Exchange exchange1 = template.send("direct:start", 
ExchangePattern.InOnly, new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(HipchatConstants.TO_ROOM, 
"Developer");
+                exchange.getIn().setHeader(HipchatConstants.MESSAGE_FORMAT, 
"text");
+                exchange.getIn().setHeader(HipchatConstants.TRIGGER_NOTIFY, 
"true");
+                
exchange.getIn().setHeader(HipchatConstants.MESSAGE_BACKGROUND_COLOR, "green");
+                exchange.getIn().setHeader(HipchatConstants.TO_USER, 
"@ShreyasPurohit");
+                exchange.getIn().setBody("Integration test Alert");
+            }
+        });
+
+        Exchange exchange2 = template.send("direct:start", 
ExchangePattern.InOnly, new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(HipchatConstants.TO_ROOM, 
"Developer");
+                exchange.getIn().setHeader(HipchatConstants.MESSAGE_FORMAT, 
"html");
+                exchange.getIn().setHeader(HipchatConstants.TRIGGER_NOTIFY, 
"false");
+                
exchange.getIn().setHeader(HipchatConstants.MESSAGE_BACKGROUND_COLOR, "red");
+                exchange.getIn().setHeader(HipchatConstants.TO_USER, 
"@ShreyasPurohit");
+                exchange.getIn().setBody("<b>Integration test Alert</b>");
+            }
+        });
+
+        assertMockEndpointsSatisfied();
+
+        assertResponseMessage(exchange1.getIn());
+        assertResponseMessage(exchange2.getIn());
+
+    }
+
+    private void assertResponseMessage(Message message) {
+        assertEquals(204, 
message.getHeader(HipchatConstants.TO_ROOM_RESPONSE_STATUS, 
StatusLine.class).getStatusCode());
+        assertEquals(204, 
message.getHeader(HipchatConstants.TO_USER_RESPONSE_STATUS, 
StatusLine.class).getStatusCode());
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                String hipchatEndpointUri = "hipchat://?authToken=XXXX";
+
+                from("direct:start")
+                        .to(hipchatEndpointUri)
+                        .to("mock:result");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/1028f3cc/components/camel-hipchat/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-hipchat/src/test/resources/log4j.properties 
b/components/camel-hipchat/src/test/resources/log4j.properties
new file mode 100644
index 0000000..906250b
--- /dev/null
+++ b/components/camel-hipchat/src/test/resources/log4j.properties
@@ -0,0 +1,15 @@
+#
+# The logging properties used
+#
+log4j.rootLogger=INFO, out
+
+# uncomment the following line to turn on Camel debugging
+#log4j.logger.org.apache.camel=DEBUG
+log4j.logger.org.apache.camel.component.hipchat=DEBUG
+
+# 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=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+

http://git-wip-us.apache.org/repos/asf/camel/blob/1028f3cc/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 6d546d6..c4fe5db 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -112,6 +112,7 @@
     <module>camel-hbase</module>
     <module>camel-hdfs</module>
     <module>camel-hdfs2</module>
+    <module>camel-hipchat</module>
     <module>camel-hl7</module>
     <module>camel-ibatis</module>
     <module>camel-ical</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/1028f3cc/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 6566840..b3401bf 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -885,6 +885,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-hipchat</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-hl7</artifactId>
         <version>${project.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/1028f3cc/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 07c4dac..fb59f65 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -635,6 +635,14 @@
     <bundle>mvn:org.apache.camel/camel-hdfs2/${project.version}</bundle>
     
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hadoop-client/${hadoop2-bundle-version}</bundle>
   </feature>
+  <feature name='camel-hipchat' version='${project.version}' resolver='(obr)' 
start-level='50'>
+    <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:com.fasterxml.jackson.core/jackson-core/${jackson2-version}</bundle>
+    <bundle 
dependency='true'>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson2-version}</bundle>
+    <feature version='${project.version}'>camel-core</feature>
+    <bundle>mvn:org.apache.camel/camel-hipchat/${project.version}</bundle>
+  </feature>
   <feature name='camel-hl7' version='${project.version}' resolver='(obr)' 
start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <feature version='${project.version}'>camel-netty4</feature>

Reply via email to