use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class TransactionalClientWithAnnotatedBeanTest method testTransactionRollback.
@Override
public void testTransactionRollback() throws Exception {
MockEndpoint book = getMockEndpoint("mock:book");
book.expectedMessageCount(1);
super.testTransactionRollback();
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class AdviceWithTransactionIssueTest method testAdviceWithWeaveById.
@Test
public void testAdviceWithWeaveById() throws Exception {
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveById("mock-b*").after().to("mock:last");
}
});
context.start();
MockEndpoint mockLast = getMockEndpoint("mock:last");
mockLast.expectedBodiesReceived("bar");
mockLast.setExpectedMessageCount(1);
template.sendBody("seda:start", "bar");
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class CamelRouteRefInjectionIssueTest method testTheRouteRefInjection.
public void testTheRouteRefInjection() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World!");
template.sendBody("direct:start", "Hello World!");
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class FileWireTapWithXMLPayloadIssueTest method testWireTapXpathExpression.
public void testWireTapXpathExpression() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
MockEndpoint tap = getMockEndpoint("mock:wiretap");
tap.expectedMessageCount(1);
assertMockEndpointsSatisfied();
String dataResult = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
String dataTap = tap.getReceivedExchanges().get(0).getIn().getBody(String.class);
assertEquals(dataResult, dataTap);
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class SpringJmxRecipientListRegisterAlwaysTest method testJmxEndpointsAddedDynamicallyAlwaysRegister.
public void testJmxEndpointsAddedDynamicallyAlwaysRegister() throws Exception {
MockEndpoint x = getMockEndpoint("mock:x");
MockEndpoint y = getMockEndpoint("mock:y");
MockEndpoint z = getMockEndpoint("mock:z");
x.expectedBodiesReceived("answer");
y.expectedBodiesReceived("answer");
z.expectedBodiesReceived("answer");
template.sendBodyAndHeader("direct:a", "answer", "recipientListHeader", "mock:x,mock:y,mock:z");
assertMockEndpointsSatisfied();
MBeanServer mbeanServer = getMBeanServer();
// this endpoint is part of the route and should be registered
ObjectName name = ObjectName.getInstance("org.apache.camel:context=camel-1,type=endpoints,name=\"direct://a\"");
assertTrue("Should be registered", mbeanServer.isRegistered(name));
// endpoints added after routes has been started is now also registered
name = ObjectName.getInstance("org.apache.camel:context=camel-1,type=endpoints,name=\"mock://x\"");
assertTrue("Should be registered", mbeanServer.isRegistered(name));
name = ObjectName.getInstance("org.apache.camel:context=camel-1,type=endpoints,name=\"mock://y\"");
assertTrue("Should be registered", mbeanServer.isRegistered(name));
name = ObjectName.getInstance("org.apache.camel:context=camel-1,type=endpoints,name=\"mock://z\"");
assertTrue("Should be registered", mbeanServer.isRegistered(name));
// however components is always registered
name = ObjectName.getInstance("org.apache.camel:context=camel-1,type=components,name=\"mock\"");
assertTrue("Should be registered", mbeanServer.isRegistered(name));
}
Aggregations