0 Replies Latest reply on Jul 26, 2013 4:56 PM by ksimpson

    Camel Blueprint unit tests

    ksimpson Newbie

      Anyone have an extension of CamelBlueprintTestSupport that actually works?  Here's a simple route I'm trying to test:

       

       



      from("{{cad.acceptor}}/echo").id("CAD Echo Service")




      .setBody(simple("ECHO: ${body}").resultType(String.class))




      .to("mock:echoResponse");

       

           where {{cad.acceptor}} is configured to be: jetty:http://localhost/cad/CADService


      And the unit test:


      @Test

      public void testEcho() throws Exception {


      String message = "woo and hoo!";


      cadEchoAcceptorEndpoint = getMockEndpoint("mock:{{cad.acceptor}}/echo");


      getMockEndpoint("mock:echoResponse").expectedBodiesReceived("ECHO: "+ message);


      producerTemplate.sendBody(cadEchoAcceptorEndpoint, message);


      assertMockEndpointsSatisfied();

      }

       

      And yet it always fails:

      java.lang.AssertionError: mock://echoResponse Received message count. Expected: <1> but was: <0>

                at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:1318)

                at org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:1300)

                at org.apache.camel.component.mock.MockEndpoint.doAssertIsSatisfied(MockEndpoint.java:372)

                at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:351)

                at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:339)

                at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:177)

                at org.apache.camel.test.junit4.CamelTestSupport.assertMockEndpointsSatisfied(CamelTestSupport.java:627)

                at com.obsglobal.partners.portland.routes.CADRoutesTest.testEcho(CADRoutesTest.java:70)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

                at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

                at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

                at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)

                at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)

                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

                at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

                at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

                at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)

                at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)

                at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

       

      Can anyone point out what I'm doing wrong?