Hi guys,
Thanks for the advice on a previous post asking about how to change the
route of an application for the purposes of testing. Since that time I have
gone and done some research into using adviceWith and given it a go. It
seems to be working for me but I'm getting an error whilst executing the
unit test and I'm not sure what it means.
I am trying to use adviceWith to replace the JPA select from the database
and just give camel an entity bean that I have created.
The error is ....
Caused by:
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No
consumers available on endpoint: Endpoint[direct://itemExport].
Exchange[Message: ImportPayloadEntity[ id:999 ]
The original route in my application looks like this...
from("direct:itemExport")
.routeId("itemExportMagento")
.autoStartup("{{item.export.magento}}")
.startupOrder(2)
.shutdownRoute(ShutdownRoute.Defer)
.errorHandler(deadLetterChannel("log:dead")
.maximumRedeliveries(5)
.retryAttemptedLogLevel(LoggingLevel.ERROR))
.pollEnrich("jpa://org.apache.camel.auski.etl.entity.ImportPayloadEntity?consumer.namedQuery=queryImportPayloads&consumeDelete=false&delay=3000&consumeLockEntity=false")
.to("itemExportMagentoFromSourceHeaderProcessor")
.to("bean:serviceBean?method=login")
.to("itemExportMagentoFromLoginBodyProcessor")
.split().method("splitterService","magentoUowSplit")
.to("itemExportMagentoActivityCodeProcessor")
and my unit test looks like this...
public class ItemExportMagentoRouteTest extends CamelSpringTestSupport {
@Override
protected AbstractApplicationContext createApplicationContext() {
return new
ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");
}
@Override
public boolean isUseAdviceWith() {
return true;
}
@Test
public void testExportRoute() throws Exception {
context.getRouteDefinition("itemExportMagento").adviceWith(context, new
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveByType(PollEnrichDefinition.class).remove();
}
});
context.startRoute("itemExportMagento");
ImportPayloadEntity importPayloadEntity = new ImportPayloadEntity();
importPayloadEntity.setId(new Long(999));
importPayloadEntity.setFilename("MinderTest.xml");
Collection<ItemEntity> items = new ArrayList<ItemEntity>();
ItemEntity itemEntity = createItem(importPayloadEntity);
items.add(itemEntity);
importPayloadEntity.setItems(items);
template.sendBody("direct:itemExport", importPayloadEntity);
}
I am using Camel 2.11.0. I'm thinking maybe it is something to do with the
way I'm doing template.sendBody("direct:itemExport", importPayloadEntity); ?
Has anyone got any thoughts?
thanks
--
View this message in context:
http://camel.465427.n5.nabble.com/First-CamelSpringTestSupport-unit-test-AdviceWith-No-consumers-available-on-endpoint-tp5744656.html
Sent from the Camel - Users mailing list archive at Nabble.com.