I am getting a similar issue to this old issue on 2.14.0
http://camel.465427.n5.nabble.com/getRouteDefinition-throws-NullPointerException-in-CamelSpringTestSupport-before-context-is-started-td5759499.html
My unit tests pass ok on IntelliJ IDEA but fail intermittently on mvn when I
run the tests all together. Occasionally it passes. Sometimes one or two
of the tests in the TestClass fail.
I suspect that the context is not "ready" when I run the tests. Is there
some sort of race condition occuring and any suggestions on how to avoid
this.
Here is the general structure:
public class PublishOrderTest extends CamelBlueprintTestSupport {
@After
public void tearDown() throws Exception {
super.tearDown();
}
@Override
protected String getBlueprintDescriptor() {
return "OSGI-INF/blueprint/order-publish-context.xml," +
"blueprint/order-publish-test-properties.xml";
}
@Override
public boolean isUseAdviceWith() {
return true;
}
@Test
public void testMessageReceived() throws Exception {
ModelCamelContext modelCamelContext = context;
modelCamelContext.getRouteDefinition("my-route-id").adviceWith(modelCamelContext,
new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
replaceFromWith("direct:in");
weaveById("publishedMessage").after().to("mock:out");
}
});
modelCamelContext.start();
Policy policy = initPolicy();
MockEndpoint mockOut = getMockEndpoint("mock:out");
mockOut.setExpectedMessageCount(1);
template.sendBody("direct:in", policy);
assertMockEndpointsSatisfied();
modelCamelContext.stop();
}
Has anyone any ideas?
Thanks,
O.
--
View this message in context:
http://camel.465427.n5.nabble.com/CamelBluePrintTestSupport-2-17-0-getRouteDefinition-null-pointer-exception-tp5790419.html
Sent from the Camel - Users mailing list archive at Nabble.com.