CamelBlueprintTestSupport injecting wrong route from time to time
milanmilas Apr 18, 2013 1:09 PMI have spent whole day on Camel Testing and still I dont have clue what am I doing wrong. If I have only one blueprint xml file with route it always works fine.
If there are 2-3 other blueprint xml files it will pick some other route?????
XML files are not the same, Camelcontext has different name, file names are different,
route names are different.
This test sometimes pick route from other file instead from Route-RestletRequest.xml
import static org.junit.Assert.*;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Console;
import java.util.List;
import java.util.Properties;
public class RequestXmlTest extends CamelBlueprintTestSupport {
@Override
protected String getBlueprintDescriptor() {
return "/OSGI-INF/blueprint/Route-RestletRequest.xml";
}
// Expected message bodies
protected Object[] expectedBodies = {
"expectedBody1",
"expectedBody2" };
// Templates to send to input endpoints
@Produce(uri = "restlet:http://localhost:8887/Interface/CreateRequest?restletMethod=POST")
protected ProducerTemplate inputEndpoint;
@Test
//@Ignore
public void testCamelRoute() throws Exception {
//Mock Endpoints
getMockEndpoint("mock:queue").expectedMessageCount(2);
Logger LOG = LoggerFactory.getLogger(String.class);
LOG.info( "ROOOUTEEEEEE:" +context.getRouteDefinitions().get(0));
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
interceptSendToEndpoint("activemq:queue:Inbound*")
.skipSendToOriginalEndpoint().to("mock:queue");
}
});
context.start();
for (Object expectedBody : expectedBodies) {
inputEndpoint.sendBody(expectedBody);
}
// Validate our expectations
assertMockEndpointsSatisfied();
}
}
-
Route-RestletRequest.xml
<log message="The message contains $"/> <inOnly uri="activemq:queue:Inbound?jmsMessageType=Text"/> <process ref="SendRequestReponse"/> <log message="Response body $"/>
<log message="Response headers $"/>
</route>
</camelContext>
-
Route-Transform.xml
Edited by: milanmilas on Apr 18, 2013 5:09 PM