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 2012/01/25 06:43:47 UTC

svn commit: r1235634 - /camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java

Author: davsclaus
Date: Wed Jan 25 05:43:47 2012
New Revision: 1235634

URL: http://svn.apache.org/viewvc?rev=1235634&view=rev
Log:
CAMEL-4932: camel-twitter improvements. Applied patch from Bilgin.

Added:
    camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java   (with props)

Added: camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java?rev=1235634&view=auto
==============================================================================
--- camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java (added)
+++ camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java Wed Jan 25 05:43:47 2012
@@ -0,0 +1,60 @@
+/**
+ * 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.twitter;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.twitter.mocks.TwitterStreamMock;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SearchEventTest extends CamelTwitterTestSupport {
+    private static final transient Logger LOG = LoggerFactory.getLogger(SearchEventTest.class);
+
+    @EndpointInject(uri = "mock:result")
+    protected MockEndpoint resultEndpoint;
+
+    private TwitterStreamMock twitterStream;
+
+    @Test
+    public void testSearchTimeline() throws Exception {
+        resultEndpoint.expectedMinimumMessageCount(1);
+
+        twitterStream.updateStatus("#cameltest tweet");
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("twitter://streaming/filter?type=event&twitterStream=#twitterStream&keywords=#cameltest")
+                    .transform(body().convertToString()).to("mock:result");
+            }
+        };
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        twitterStream = new TwitterStreamMock();
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("twitterStream", twitterStream);
+        return registry;
+    }
+}

Propchange: camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date