Hello,
I have a simple custom router defined in Java DSL.
@Component
public class CustomRouter extends SpringRouteBuilder{
@Autowired
private SourceQProcessor sourceQProcessor;
public void configure() {
from("activemq:queue:SourceQueue")
.process(sourceQProcessor)
.recipientList(header("recepientList")).parallelProcessing();
}
}
in spring applicationContext I have <contextScan/> which loads this route
into the context.
My test case extends CamelSpringTestSupport, which also has
@Override
protected AbstractXmlApplicationContext createApplicationContext(){
appContext = new
ClassPathXmlApplicationContext("classpath:applicationContext.xml");
return appContext;
}
setUp method looks as below
@Before
public void setUp() throws Exception{
super.setUp();
context.addComponent("jms", context.getComponent("seda"));
context.removeComponent("activemq");
context.addComponent("activemq",
context.getComponent("seda"));
}
now question is how can I make sure that CustomRouter gets called while
running the test. Also above component replacement doesn't look like
working. because createApplicationContext has already created/loaded the
context before setUp()?
In my test method I want to verify if message from JMS endpoint is being
delivered to JMS destinations (receipientList)? where JMS/ActiveMQ
components should be replaced with "seda". but this isn't the behavior. my
route isn't called as well.
Any idea?
--
View this message in context:
http://camel.465427.n5.nabble.com/Unit-test-Mock-Spring-context-tp5662737p5662737.html
Sent from the Camel - Users mailing list archive at Nabble.com.