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 2009/08/25 08:54:31 UTC

svn commit: r807500 - in /camel/trunk/camel-core/src/test/java/org/apache/camel/processor: SimpleMockTest.java SimpleProcessorTest.java

Author: davsclaus
Date: Tue Aug 25 06:54:30 2009
New Revision: 807500

URL: http://svn.apache.org/viewvc?rev=807500&view=rev
Log:
some simple unit tests

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java   (with props)
Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleMockTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleMockTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleMockTest.java?rev=807500&r1=807499&r2=807500&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleMockTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleMockTest.java Tue Aug 25 06:54:30 2009
@@ -34,6 +34,16 @@
         assertMockEndpointsSatisfied();
     }
 
+    public void testSimpleTwoMessages() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World", "Bye World");
+
+        template.sendBody("direct:start", "Hello World");
+        template.sendBody("direct:start", "Bye World");
+
+        assertMockEndpointsSatisfied();
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java?rev=807500&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java Tue Aug 25 06:54:30 2009
@@ -0,0 +1,48 @@
+/**
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class SimpleProcessorTest extends ContextTestSupport {
+
+    public void testProcess() throws Exception {
+        String out = template.requestBody("direct:start", "Hello World", String.class);
+        assertEquals("Bye World", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").process(new Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        exchange.getOut().setBody("Bye World");
+                    }
+                });
+            }
+        };
+    }
+
+}

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SimpleProcessorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date