Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 69966 invoked from network); 18 Oct 2007 16:12:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Oct 2007 16:12:52 -0000 Received: (qmail 56937 invoked by uid 500); 18 Oct 2007 16:12:40 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 56874 invoked by uid 500); 18 Oct 2007 16:12:39 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 56865 invoked by uid 99); 18 Oct 2007 16:12:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2007 09:12:39 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2007 16:12:42 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IiXyv-0008H1-Fm for camel-user@activemq.apache.org; Thu, 18 Oct 2007 09:12:21 -0700 Message-ID: <13278046.post@talk.nabble.com> Date: Thu, 18 Oct 2007 09:12:21 -0700 (PDT) From: jmfj To: camel-user@activemq.apache.org Subject: Re: Why are both tests failing? In-Reply-To: <13263902.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: j@j3m.org References: <13263902.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org I am seeing that all processors are receiving and handling these messages as expected, but for some reason the MockEndpoint are either not receiving these messages or not adding up to the total messages received. A MockEndpoint bug? Anything you guys could think of? Thanks jmfj wrote: > > > > public void testSeda() throws Exception { > CamelContext context = new DefaultCamelContext(); > context.addRoutes(new RouteBuilder() { > > @Override > public void configure() throws Exception { > from("seda:inbound").convertBodyTo(String.class).process(new > Processor() { > > public void process(Exchange arg0) throws Exception { > System.out.println("proc 3/1: " + arg0 + "/" + > Thread.currentThread()); > } > > }).to("seda:stage-1"); > > from("seda:stage-1").process(new Processor() { > > public void process(Exchange arg0) throws Exception { > System.out.println("proc 3/2: " + arg0 + "/" + > Thread.currentThread()); > } > > }).to("mock:eventPublisher"); > > } > > }); > > CamelTemplate template = new CamelTemplate(context); > > context.start(); > > template.sendBody("seda:inbound", "test-direct-endpoints"); > > MockEndpoint eventPubilsher = > context.getEndpoint("mock:event-publisher", MockEndpoint.class); > eventPubilsher.expectedMessageCount(1); > > MockEndpoint.assertIsSatisfied(1, TimeUnit.SECONDS, eventPubilsher); > > context.stop(); > } > > public void testDirect() throws Exception { > CamelContext context = new DefaultCamelContext(); > context.addRoutes(new RouteBuilder() { > > @Override > public void configure() throws Exception { > from("seda:inbound").convertBodyTo(String.class).process(new > Processor() { > > public void process(Exchange arg0) throws Exception { > System.out.println("proc 2/1: " + arg0 + "/" + > Thread.currentThread()); > } > > }).to("direct:stage-1"); > > from("direct:stage-1").process(new Processor() { > > public void process(Exchange arg0) throws Exception { > System.out.println("proc 2/2: " + arg0 + "/" + > Thread.currentThread()); > } > > }).to("mock:eventPublisher"); > > } > > }); > > CamelTemplate template = new CamelTemplate(context); > > context.start(); > > template.sendBody("seda:inbound", "test-direct-endpoints"); > > MockEndpoint eventPubilsher = > context.getEndpoint("mock:event-publisher", MockEndpoint.class); > eventPubilsher.expectedMessageCount(1); > > eventPubilsher.assertIsSatisfied(); > > context.stop(); > } > > Exceptions traces are respectivelly: > > java.lang.AssertionError: Timeout waiting for endpoints to receive enough > messages. mock:event-publisher timed out. > at > org.apache.camel.component.mock.MockEndpoint.assertWait(MockEndpoint.java:73) > at > org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:83) > at > xxxx.actions.common.route.CommonRouteTest.testSeda(CommonRouteTest.java:93) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at junit.framework.TestCase.runTest(TestCase.java:164) > at junit.framework.TestCase.runBare(TestCase.java:130) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:120) > at junit.framework.TestSuite.runTest(TestSuite.java:230) > at junit.framework.TestSuite.run(TestSuite.java:225) > at > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > > > and > > java.lang.AssertionError: mock:event-publisher Received message count. > Expected: <1> but was: <0> > at > org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:511) > at > org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:493) > at > org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:148) > at > org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:125) > at > xxx.actions.common.route.CommonRouteTest.testDirect(CommonRouteTest.java:133) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at junit.framework.TestCase.runTest(TestCase.java:164) > at junit.framework.TestCase.runBare(TestCase.java:130) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:120) > at junit.framework.TestSuite.runTest(TestSuite.java:230) > at junit.framework.TestSuite.run(TestSuite.java:225) > at > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) > > Thanks !! > > -- View this message in context: http://www.nabble.com/Why-are-both-tests-failing--tf4643641s22882.html#a13278046 Sent from the Camel - Users mailing list archive at Nabble.com.