Afternoon all,

I have created Junit for existing production routes , Requirement was not to
change anything from the route and test it with dummy data. From
cameInAction and camel.apache.org i found the best approach will be to use
adviceWith. I am using camel 2.10.

When i run the Junit it starts of with replacing the From using
replaceFromWith , New Route is created with changes from AdviceWith after
the ContextStart ( I use isUseAdviceWith = True) and as soon as it starts it
starts shutting down. The Route is not executed as expected , Please help.

Given Below is my Test class :

@UseAdviceWith
public class AMSTest extends CamelSpringTestSupport{

        @Override
        protected AbstractApplicationContext createApplicationContext() {
                return new ClassPathXmlApplicationContext(
                                "ams-context.xml");
        }
        
        
    @Override
    public boolean isUseAdviceWith() {
        return true;
    }

        @Test
        public void testLAMS() throws Exception 
        {
                
                
context.getRouteDefinition("compare-request").adviceWith(context, new
AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {

                        
replaceFromWith("file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE");
                }
            });
                
                context.start();
        }
}

StackTrace :

12:05:19,213 DEBUG AMSTest:240 - setUp test
12:05:19,231 DEBUG AMSTest:297 - Using created route builder: Routes: []
12:05:19,232  INFO AMSTest:304 - Skipping starting CamelContext as
isUseAdviceWith is set to true.
12:05:19,232 DEBUG AMSTest:311 - Routing Rules are: []
12:05:19,236  INFO AdviceWithTasks:313 - AdviceWith replace input from
[file:{{outbound_home}}/Compare?fileName=STARTCOMPARE&move={{data_home}}]
--> [file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE]
12:05:19,237  INFO RouteDefinition:267 - AdviceWith route after: "NEW Route
With Changes"
12:05:19,650  INFO SpringCamelContext:1381 - Apache Camel 2.10.0
(CamelContext: myCamel) is starting
12:05:19,686  INFO DefaultManagementAgent:431 - JMX Connector thread started
and listening at:
service:jmx:rmi:///jndi/rmi://ubuntu12-virtual-machine:8000/jmxrmi/camel
12:05:19,690  INFO DefaultManagementLifecycleStrategy:849 - StatisticsLevel
at All so enabling load performance statistics
12:05:20,269  INFO FileConsumer:27 - using Oceanview FileConsumer
12:05:20,688  INFO SpringCamelContext:2015 - Route: compare-request started
and consuming from:
Endpoint[file:///home/manish/cameldata/Compare?fileName=STARTCOMPARE]
12:05:20,691  INFO SpringCamelContext:1416 - Total 1 routes, of which 1 is
started.
12:05:20,692  INFO SpringCamelContext:1417 - Apache Camel 2.10.0
(CamelContext: myCamel) started in 1.042 seconds
12:05:20,692  INFO AMSTest:322 -
********************************************************************************
12:05:20,692  INFO AMSTest:323 - Testing done:
testAMS(com.ocean.ams.AMSTest)
12:05:20,692  INFO AMSTest:324 - Took: 1.460 seconds (1460 millis)
12:05:20,693  INFO AMSTest:325 -
********************************************************************************
12:05:20,693  INFO SpringCamelContext:1557 - Apache Camel 2.10.0
(CamelContext: myCamel) is shutting down



--
View this message in context: 
http://camel.465427.n5.nabble.com/Junit-Test-Failing-with-AdviceWith-tp5760732.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to