camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r733093 - /activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
Date Fri, 09 Jan 2009 17:31:16 GMT
Author: jstrachan
Date: Fri Jan  9 09:31:15 2009
New Revision: 733093

URL: http://svn.apache.org/viewvc?rev=733093&view=rev
Log:
added a little test case for CAMEL-1243 to ensure it gets set when we send to an endpoint

Added:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
  (with props)

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java?rev=733093&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
Fri Jan  9 09:31:15 2009
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.impl;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Endpoint;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.builder.RouteBuilder;
+
+import java.util.List;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class FromEndpointTest extends ContextTestSupport {
+    private MockEndpoint results;
+    private Object expectedBody = "<hello>world!</hello>";
+
+    public void testReceivedMessageHasFromEndpointSet() throws Exception {
+        results = getMockEndpoint("mock:results");
+        results.expectedBodiesReceived(expectedBody);
+
+        template.sendBody("direct:start", expectedBody);
+
+        results.assertIsNotSatisfied();
+        List<Exchange> list = results.getReceivedExchanges();
+        Exchange exchange = list.get(0);
+        Endpoint fromEndpoint = exchange.getFromEndpoint();
+        assertNotNull("exchange.fromEndpoint() is null!", fromEndpoint);
+        assertEquals("fromEndpoint URI", "direct:start", fromEndpoint.getEndpointUri());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").to("mock:results");
+            }
+        };
+
+    }
+}

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/FromEndpointTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message