camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1358169 - in /camel/trunk/components/camel-test-spring/src: main/java/org/apache/camel/test/spring/ test/java/org/apache/camel/test/junit4/ test/resources/org/apache/camel/test/junit4/
Date Fri, 06 Jul 2012 12:47:42 GMT
Author: davsclaus
Date: Fri Jul  6 12:47:41 2012
New Revision: 1358169

URL: http://svn.apache.org/viewvc?rev=1358169&view=rev
Log:
CAMEL-5242: Fixed @MockEndpointsAndSkip. Thanks to Michal Svab for the patch.

Modified:
    camel/trunk/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
    camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java
    camel/trunk/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml

Modified: camel/trunk/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java?rev=1358169&r1=1358168&r2=1358169&view=diff
==============================================================================
--- camel/trunk/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
(original)
+++ camel/trunk/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
Fri Jul  6 12:47:41 2012
@@ -430,10 +430,10 @@ public class CamelSpringTestContextLoade
      * @param testClass the test class being executed
      */
     protected void handleMockEndpointsAndSkip(GenericApplicationContext context, Class<?>
testClass) throws Exception {
-        if (testClass.isAnnotationPresent(MockEndpoints.class)) {
+        if (testClass.isAnnotationPresent(MockEndpointsAndSkip.class)) {
             
             final String mockEndpoints = testClass.getAnnotation(
-                    MockEndpoints.class).value();
+                    MockEndpointsAndSkip.class).value();
             CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy()
{
                 
                 @Override

Modified: camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java?rev=1358169&r1=1358168&r2=1358169&view=diff
==============================================================================
--- camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java
(original)
+++ camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java
Fri Jul  6 12:47:41 2012
@@ -19,35 +19,38 @@ package org.apache.camel.test.junit4;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.seda.SedaEndpoint;
+import org.apache.camel.impl.InterceptSendToEndpoint;
 import org.apache.camel.test.spring.MockEndpointsAndSkip;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
-@MockEndpointsAndSkip("mock:c")
+@MockEndpointsAndSkip("seda:*")
 public class CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest
         extends CamelSpringJUnit4ClassRunnerPlainTest {
 
-    @EndpointInject(uri = "mock:mock:c", context = "camelContext2")
-    protected MockEndpoint mockMockC;
-    
-    @EndpointInject(uri = "mock:c", context = "camelContext2")
-    protected MockEndpoint mockC;
-    
+    @EndpointInject(uri = "mock:seda:context2.seda", context = "camelContext2")
+    protected MockEndpoint mock;
+
+    @EndpointInject(uri = "seda:context2.seda", context = "camelContext2")
+    private InterceptSendToEndpoint original;
+
     @Test
     @Override
     public void testPositive() throws Exception {
         assertEquals(ServiceStatus.Started, camelContext.getStatus());
         assertEquals(ServiceStatus.Started, camelContext2.getStatus());
-        
+
         mockA.expectedBodiesReceived("David");
         mockB.expectedBodiesReceived("Hello David");
-        mockC.expectedMessageCount(0);
-        mockMockC.expectedBodiesReceived("Hello David");
-        
+        mock.expectedBodiesReceived("Hello David");
+
         start.sendBody("David");
         start2.sendBody("David");
-        
+
         MockEndpoint.assertIsSatisfied(camelContext);
+        assertTrue("Original endpoint was invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().isEmpty());
     }
 }

Modified: camel/trunk/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml?rev=1358169&r1=1358168&r2=1358169&view=diff
==============================================================================
--- camel/trunk/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
(original)
+++ camel/trunk/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
Fri Jul  6 12:47:41 2012
@@ -46,6 +46,7 @@
         <simple>Hello ${body}</simple>
       </transform>
       <to uri="log:org.apache.camel.test.junit4.spring" />
+      <to uri="seda:context2.seda"/>
     </route>
   </camelContext>
 



Mime
View raw message