You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2013/09/05 16:01:59 UTC

[6/8] git commit: Add test that I forgot

Add test that I forgot


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

Branch: refs/heads/camel-2.12.x
Commit: bab78c639a45e0acc1321009d1cc9f00af466895
Parents: e66c6f1
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Sep 5 10:12:35 2013 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Thu Sep 5 11:31:21 2013 -0230

----------------------------------------------------------------------
 .../YammerRelationshipInJsonRouteTest.java      | 57 ++++++++++++++++++++
 1 file changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bab78c63/components/camel-yammer/src/test/java/org/apache/camel/component/yammer/YammerRelationshipInJsonRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-yammer/src/test/java/org/apache/camel/component/yammer/YammerRelationshipInJsonRouteTest.java b/components/camel-yammer/src/test/java/org/apache/camel/component/yammer/YammerRelationshipInJsonRouteTest.java
new file mode 100644
index 0000000..c486239
--- /dev/null
+++ b/components/camel-yammer/src/test/java/org/apache/camel/component/yammer/YammerRelationshipInJsonRouteTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.yammer;
+
+
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.yammer.model.Relationships;
+import org.junit.Test;
+
+public class YammerRelationshipInJsonRouteTest extends YammerComponentTestSupport {
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testConsumeAllUsers() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMinimumMessageCount(1);
+        assertMockEndpointsSatisfied();
+        
+        Exchange exchange = mock.getExchanges().get(0);
+        String relationships = exchange.getIn().getBody(String.class);
+        
+        assertEquals(getMessages(), relationships);
+    }
+
+    @Override
+    protected String jsonFile() {
+        return "/relationships.json";
+    }
+       
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                // using dummy keys here since we are mocking out calls to yammer.com with static json; in a real app, please use your own keys!
+                from("yammer:relationships?consumerKey=aConsumerKey&consumerSecret=aConsumerSecretKey&accessToken=aAccessToken&useJson=true").to("log:foo").to("mock:result");
+            }
+        };
+    }
+}