activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john <john.fans...@ateb.com>
Subject unit test with expired advisory
Date Tue, 14 Jun 2011 15:26:51 GMT
Hi,

I'm using activemq version 5.3.1

I have successfully integrated a route in my camel application that monitors
an expired message advisory queue. The problem I'm having is trying to
create a unit test for my scenario. It seems like no matter what timeToLive
I pass in, receiving the expired advisory is inconsistent.

I've tried to pull everything out of my route to create a simple expired
advisory unit test. My test creates one route that listens on the expired
advisory queue and forward any messages to a second queue (ExpiredQueue).

My test class is below. If anyone has any thoughts as to why this unit test
doesn't work, please let me know!

    @Test
    public void oneExpires() throws Exception
    {
        MockEndpoint mockResult = getMockEndpoint("mock:result");

        RouteDefinition routeUnderTest =
            context.getRouteDefinition("expireAdvisory");
        routeUnderTest.adviceWith(new RouteBuilder()
        {

            @Override
            public void configure() throws Exception
            {
                interceptSendToEndpoint("activemq:queue:ExpiredQueue")
                .skipSendToOriginalEndpoint()
                .to("mock:result");
            }
        });

        mockResult.expectedMessageCount(1);
        
        ProducerTemplate producer = context.createProducerTemplate();
        producer.sendBody("activemq:queue:TestQueue?timeToLive=1000", "hi
mom");
        
        mockResult.assertIsSatisfied(5000);
    }

Thanks,

-john



--
View this message in context: http://activemq.2283324.n4.nabble.com/unit-test-with-expired-advisory-tp3596907p3596907.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message