09-22-2011 04:31 PM
from("activiti:myProcess:servicetask1")
.log(LoggingLevel.INFO, "Received message on service task")
.to("jms:queue:myQueue");
from("direct:start")
.to("activiti:myProcess");
Which I want to unit test using a MockEndpoint. I checked out http://camel.apache.org/mock.html, especially the section on "Mocking Existing Endpoints" and so I coded my unit test as:
@Autowired
private CamelContext camelContext;
@Produce(uri = "direct:start", context = "camelProcess")
protected ProducerTemplate template;
@Test
public void testMyProcessViaCamel() throws Exception {
// Advise all the endpoints
for (final RouteDefinition route : this.camelContext.getRouteDefinitions()) {
route.adviceWith(this.camelContext, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
// mock all endpoints
this.mockEndpoints();
}
});
}
But this fails because I get a RuntimeException from the ActivitiEndpoint class:
void addConsumer(ActivitiConsumer consumer) {
if (activitiConsumer != null) {
throw new RuntimeException("Activit consumer already defined for " + getEndpointUri() + "!");
}
activitiConsumer = consumer;
}
I was wondering if the ActivitiEndpoint should even care about adding a consumer when one has already been added? In this case, Camel has it's reasons for replacing the existing consumer.
void addConsumer(ActivitiConsumer consumer) {
activitiConsumer = consumer;
}
09-23-2011 07:20 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.