I have looked through this whole thing, and there is nothing different than what I am doing.
My valid tests work fine. They get the expected messages and validate accordingly. But the issue seems to be with processing deadLetter channels in Mocks. So basically, in my test, the message is sent through to the *resultEndpoint *instead of the *resultErrorEndpoint *which is causing my test to fail. Now just before I test my Mock's, I added this code to: *Assert.assertNotNull(camelContext); Assert.assertNotNull(resultEndpoint); Assert.assertNotNull(resultErrorEndpoint); //MockEndpoint.assertIsSatisfied(camelContext); // lets show the endpoints in the test List<MockEndpoint> list = CamelContextHelper.getSingletonEndpoints(camelContext, MockEndpoint.class); log.info("Found endpoints: " + list); // lets dump the messages sent to our test endpoint List<Exchange> exchanges = resultEndpoint.getReceivedExchanges(); log.info ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); for (Exchange exchange : exchanges) { log.info("Received resultEndpoint: [" + exchange + "]\n"); } // lets dump the messages sent to our test endpoint List<Exchange> exchangesMock = resultErrorEndpoint.getReceivedExchanges(); log.info ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); for (Exchange exchange : exchangesMock) { log.info("Received resultErrorEndpoint: [" + exchange + "]\n"); } log.info ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); * *And there is nothing happening to my error mock at all.* *[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) | testMocksAreValid [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found endpoints: [Endpoint[mock:outputDestinationURI], Endpoint[mock:outputErrorDes tinationURI]] [myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding consumer: ID:mickknutson-3837-1222725262920-2:21:1:1 [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received resultEndpoint: [Exchange[JmsMessage: {"changeRequestId":"99907","custId": "70999","requestType":"provision","quota":"102400","backend":"192.168.0.0/16 ","password":"abcd1234"}]] [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId = ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null, originalTransactionId = null, producerI d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination = queue://channel/gogrid/cloudstorage/command/status, transactionId = null, expiration = 0 , timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779, brokerOutTime = 1222725273779, correlationId = null, replyTo = null, persisten t = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, ma rshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 1024, properties = null, readOnlyProperties = true, readOnlyBody = true , droppable = false, text = {"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]] [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% * So there are 2 exchanges only. The first in green was for my initial add request which was successful. The second for for my status update in orange, which was also successful. What I do NOT have is any exchange whatsoever for my failed request. So according to my <test name="*InvalidProvisionChangeRequest*"> *<message> * * <![CDATA[mock:outputDestinationURI Received message count. Expected: <0> but was: <1>]]> </message>* Which means that nothing is getting routed to my deadLetter Channel in my tests only. On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <[EMAIL PROTECTED]> wrote: > > https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/ > > It is in fact not promoted too much (or not at all) on our camel wiki > documentation. > > > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsgårdsvænget 21 > 8362 Hørning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > > -----Original Message----- > From: Mick Knutson [mailto:[EMAIL PROTECTED] > Sent: 29. september 2008 19:57 > To: camel-user@activemq.apache.org > Subject: Re: issue routing Exchange to custom method in Processor > > I deploy this as a war to Tomcat and use a single applicationContext.xml to > start camel like: > > *<import resource="classpath:META-INF/spring/camel-context.xml"/> > > <camelContext id="camel" > xmlns="http://activemq.apache.org/camel/schema/spring"> > <!-- The routes are defined in --> > <package>com.servepath.gogrid.changerequest</package> > > </camelContext> > * > > > The same as in my applicationContext-test.xml except I do not include any > routing declarations as I have my test create the route like: > > > public void setRoutes(final String inputUri, final Processor processor) > throws Exception { > // Add Routes to Camel Context > camelContext.addRoutes(new RouteBuilder() { > public void configure() { > from(inputUri) > .errorHandler( > > deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI) > .loggingLevel(LoggingLevel.TRACE) > > ) > .process(changeRequestController) > .to(MOCK_OUTPUT_DESTINATION_URI); > } > }); > > }//setRoutes > > > PS, where can I find this camel TestNG component you are talking about? > > > > > > On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <[EMAIL PROTECTED]> wrote: > > > Hi > > > > I think it could be how you start camel. When you deploy to Jetty do you > > deploy it as OSGi bundles, or as a web application? > > > > Either way then its usually Spring that is starting up as normal and it > > will starup Camel properly. > > > > I am not sure this is happening correctly in your unit tests. > > > > Your BaseCamelTestNG class also starts Camel. It is only supposed to be > > started once. As well as stopped, let Spring handle this. > > > > There must be a hook somewhere where you can add your routes. However we > > use either plain junit or spring junit based in the testing of camel > itself > > - not TestNG so I am afraid I have not used it that much. > > > > Could you check out the camel-testng component. It might have some > pointers > > there. > > > > > > Med venlig hilsen > > > > Claus Ibsen > > ...................................... > > Silverbullet > > Skovsgårdsvænget 21 > > 8362 Hørning > > Tlf. +45 2962 7576 > > Web: www.silverbullet.dk > > > > -----Original Message----- > > From: Mick Knutson [mailto:[EMAIL PROTECTED] > > Sent: 29. september 2008 19:26 > > To: camel-user@activemq.apache.org > > Subject: Re: issue routing Exchange to custom method in Processor > > > > I have seperated them and that solves the first item. Thanks. > > But I still can't seem to get my errorMock to work. > > > > But when I deploy this to Jetty, the route and errors act as expected. > > > > > > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <[EMAIL PROTECTED]> > wrote: > > > > > Hi > > > > > > I don't think you should have both @MessageDriven and Processor in the > > same > > > java class. You should separate these two. This is not commonly used. > > > > > > > > > Med venlig hilsen > > > > > > Claus Ibsen > > > ...................................... > > > Silverbullet > > > Skovsgårdsvænget 21 > > > 8362 Hørning > > > Tlf. +45 2962 7576 > > > Web: www.silverbullet.dk > > > -----Original Message----- > > > From: Mick Knutson [mailto:[EMAIL PROTECTED] > > > Sent: 29. september 2008 18:12 > > > To: Camel; Active MQ > > > Subject: Re: issue routing Exchange to custom method in Processor > > > > > > Can someone help me? > > > > > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <[EMAIL PROTECTED] > > > >wrote: > > > > > > > The funny thing is, when I have an error with the message coming from > > > this > > > > queue, which I do because process(Exchange) does not expect my > message > > > body, > > > > the message gets routed to the proper deadLetter channel. > > > > > > > > > > > > > > > > > > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson < > [EMAIL PROTECTED] > > > >wrote: > > > > > > > >> I have a Processor with 2 different methods: > > > >> > > > >> The standard: > > > >> *public void process(Exchange exchange) { > > > >> * > > > >> > > > >> and a custom: > > > >> > > > >> [EMAIL PROTECTED](uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS) > > > >> public void onMessage(Exchange exchange) * > > > >> > > > >> Now here is my route: > > > >> > > > >> * from(Constants.CHANNEL_GG_CS_CR_ADD) > > > >> .errorHandler( > > > >> > > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR) > > > >> //.maximumRedeliveries(2) > > > >> //.initialRedeliveryDelay(1) > > > >> .loggingLevel(LoggingLevel.DEBUG) > > > >> ).processRef("changeRequestController") > > > >> .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER); > > > >> > > > >> > > > >> // Route for command status updates. > > > >> from(Constants.CHANNEL_GG_CS_COMMAND_STATUS) > > > >> .errorHandler( > > > >> > > > >> > > > > > > deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2) > > > >> .initialRedeliveryDelay(1) > > > >> .loggingLevel(LoggingLevel.INFO) > > > >> > > > ).to("bean:changeRequestController?methodName=onMessage"); > > > >> * > > > >> > > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my > > > >> process(Exchange) method is called, and that rout is fine. > > > >> > > > >> However, I get a response message back on > > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS > > > >> but it is also processed by *the *process(Exchange) instead of my > > > >> onMessage**(Exchange)* > > > >> > > > >> I have tried @MessageDriven annotation as well as the route builder > > but > > > >> neither works. > > > >> > > > >> Am I forced to have each process in a single class? > > > >> > > > >> > > > >> > > > >> -- > > > >> --- > > > >> Thank You... > > > >> > > > >> Mick Knutson > > > >> BASE Logic, inc. > > > >> (415) 354-4215 > > > >> > > > >> Website: http://baselogic.com > > > >> Blog: http://baselogic.com/blog > > > >> BLiNC Magazine: http://blincmagazine.com > > > >> Linked IN: http://linkedin.com/in/mickknutson > > > >> DJ Mick: http://djmick.com > > > >> MySpace: http://myspace.com/mickknutson > > > >> Vacation Rental: http://tahoe.baselogic.com > > > >> > > > >> > > > > > > > > > > > > -- > > > > --- > > > > Thank You... > > > > > > > > Mick Knutson > > > > BASE Logic, inc. > > > > (415) 354-4215 > > > > > > > > Website: http://baselogic.com > > > > Blog: http://baselogic.com/blog > > > > BLiNC Magazine: http://blincmagazine.com > > > > Linked IN: http://linkedin.com/in/mickknutson > > > > DJ Mick: http://djmick.com > > > > MySpace: http://myspace.com/mickknutson > > > > Vacation Rental: http://tahoe.baselogic.com > > > > > > > > > > > > > > > > > -- > > > --- > > > Thank You... > > > > > > Mick Knutson > > > BASE Logic, inc. > > > (415) 354-4215 > > > > > > Website: http://baselogic.com > > > Blog: http://baselogic.com/blog > > > BLiNC Magazine: http://blincmagazine.com > > > Linked IN: http://linkedin.com/in/mickknutson > > > DJ Mick: http://djmick.com > > > MySpace: http://myspace.com/mickknutson > > > Vacation Rental: http://tahoe.baselogic.com > > > > > > > > > > > -- > > --- > > Thank You... > > > > Mick Knutson > > BASE Logic, inc. > > (415) 354-4215 > > > > Website: http://baselogic.com > > Blog: http://baselogic.com/blog > > BLiNC Magazine: http://blincmagazine.com > > Linked IN: http://linkedin.com/in/mickknutson > > DJ Mick: http://djmick.com > > MySpace: http://myspace.com/mickknutson > > Vacation Rental: http://tahoe.baselogic.com > > > > > > -- > --- > Thank You... > > Mick Knutson > BASE Logic, inc. > (415) 354-4215 > > Website: http://baselogic.com > Blog: http://baselogic.com/blog > BLiNC Magazine: http://blincmagazine.com > Linked IN: http://linkedin.com/in/mickknutson > DJ Mick: http://djmick.com > MySpace: http://myspace.com/mickknutson > Vacation Rental: http://tahoe.baselogic.com > -- --- Thank You… Mick Knutson BASE Logic, inc. (415) 354-4215 Website: http://baselogic.com Blog: http://baselogic.com/blog BLiNC Magazine: http://blincmagazine.com Linked IN: http://linkedin.com/in/mickknutson DJ Mick: http://djmick.com MySpace: http://myspace.com/mickknutson Vacation Rental: http://tahoe.baselogic.com