本文整理汇总了Java中org.apache.camel.component.mock.MockEndpoint.expectedBodiesReceivedInAnyOrder方法的典型用法代码示例。如果您正苦于以下问题:Java MockEndpoint.expectedBodiesReceivedInAnyOrder方法的具体用法?Java MockEndpoint.expectedBodiesReceivedInAnyOrder怎么用?Java MockEndpoint.expectedBodiesReceivedInAnyOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.component.mock.MockEndpoint
的用法示例。
在下文中一共展示了MockEndpoint.expectedBodiesReceivedInAnyOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSplitterWithAggregationStrategyParallelStreaming
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testSplitterWithAggregationStrategyParallelStreaming() throws Exception {
MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
resultEndpoint.expectedMessageCount(5);
resultEndpoint.expectedBodiesReceivedInAnyOrder("James", "Guillaume", "Hiram", "Rob", "Roman");
Exchange result = template.request("direct:parallel-streaming", new Processor() {
public void process(Exchange exchange) {
Message in = exchange.getIn();
in.setBody("James,Guillaume,Hiram,Rob,Roman");
in.setHeader("foo", "bar");
}
});
assertMockEndpointsSatisfied();
Message out = result.getOut();
assertMessageHeader(out, "foo", "bar");
assertEquals((Integer) 5, result.getProperty("aggregated", Integer.class));
}
示例2: testRecipientListParallelALot
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testRecipientListParallelALot() throws Exception {
String before = context.getExecutorServiceManager().resolveThreadName("foo");
for (int i = 0; i < 10; i++) {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.reset();
mock.expectedBodiesReceivedInAnyOrder("c", "b", "a");
template.sendBodyAndHeader("direct:start", "Hello World", "foo", "direct:a,direct:b,direct:c");
assertMockEndpointsSatisfied();
}
String after = context.getExecutorServiceManager().resolveThreadName("foo");
int num1 = context.getTypeConverter().convertTo(int.class, before);
int num2 = context.getTypeConverter().convertTo(int.class, after);
int diff = num2 - num1;
// should be at least 10 + 1 other threads (10 in parallel pool + 1 in aggregate pool)
// we run unit test per jmv fork, so there may be a hanging thread
assertTrue("There should be 12 or more threads in use, was: " + diff, diff >= 11);
}
示例3: testIncludesAndExcludesAndAntFilterNotCaseSensitive
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testIncludesAndExcludesAndAntFilterNotCaseSensitive() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result7");
mock.expectedBodiesReceivedInAnyOrder("Hello World 2", "Hello World 4", "Hello World 8", "Hello World 10");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.pdf");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 2", Exchange.FILE_NAME, "m.pdf");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 3", Exchange.FILE_NAME, "b.txt");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 4", Exchange.FILE_NAME, "m.txt");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 5", Exchange.FILE_NAME, "b.bak");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 6", Exchange.FILE_NAME, "m.bak");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 7", Exchange.FILE_NAME, "ay.PDF");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 8", Exchange.FILE_NAME, "my.Pdf");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 9", Exchange.FILE_NAME, "by.TXT");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 10", Exchange.FILE_NAME, "my.TxT");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 11", Exchange.FILE_NAME, "By.BAK");
template.sendBodyAndHeader("file://target/files/ant-path-7/x/y/z", "Hello World 12", Exchange.FILE_NAME, "My.BaK");
assertMockEndpointsSatisfied();
}
示例4: testSftpSimpleConsume
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testSftpSimpleConsume() throws Exception {
if (!canTest()) {
return;
}
String expected = "Hello World";
String expected2 = "Goodbye World";
// create file using regular file
template.sendBodyAndHeader("file://" + FTP_ROOT_DIR, expected, Exchange.FILE_NAME, "hello.txt");
template.sendBodyAndHeader("file://" + FTP_ROOT_DIR, expected2, Exchange.FILE_NAME, "goodbye.txt");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(2);
mock.expectedBodiesReceivedInAnyOrder(expected, expected2);
context.startRoute("foo");
assertMockEndpointsSatisfied();
GenericFile<?> remoteFile1 = mock.getExchanges().get(0).getIn().getBody(GenericFile.class);
GenericFile<?> remoteFile2 = mock.getExchanges().get(1).getIn().getBody(GenericFile.class);
assertTrue(remoteFile1.getBody() instanceof InputStream);
assertTrue(remoteFile2.getBody() instanceof InputStream);
}
示例5: testProduceAndConsume
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testProduceAndConsume() throws Exception {
List<String> bodies = new ArrayList<String>();
for (int k = 0; k < 10; ++k) {
bodies.add("this is body #" + k);
}
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMinimumMessageCount(bodies.size());
mock.expectedBodiesReceivedInAnyOrder(bodies);
for (String body : bodies) {
producerTemplate.sendBody(body);
}
mock.assertIsSatisfied();
}
示例6: testFtpFilter
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testFtpFilter() throws Exception {
if (isPlatform("aix")) {
// skip testing on AIX as it have an issue with this test with the file filter
return;
}
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(2);
mock.expectedBodiesReceivedInAnyOrder("Report 1", "Report 2");
mock.assertIsSatisfied();
}
示例7: testPollFileAndShouldBeMoved
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testPollFileAndShouldBeMoved() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("Hello", "Bye", "Goodday");
mock.expectedFileExists(FTP_ROOT_DIR + "/.done/hello.txt");
mock.expectedFileExists(FTP_ROOT_DIR + "/sub/.done/bye.txt");
mock.expectedFileExists(FTP_ROOT_DIR + "/sub/sub2/.done/goodday.txt");
mock.assertIsSatisfied();
}
示例8: testSplitParallelStopOnExceptionOk
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testSplitParallelStopOnExceptionOk() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:split");
mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
template.sendBody("direct:start", "Hello World,Bye World");
assertMockEndpointsSatisfied();
}
示例9: testSplitStopOnExceptionOk
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testSplitStopOnExceptionOk() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:split");
mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
getMockEndpoint("mock:handled").expectedMessageCount(0);
template.sendBody("direct:start", "Hello World,Bye World");
assertMockEndpointsSatisfied();
}
示例10: testSplitParallelNoStopOnExceptionOk
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testSplitParallelNoStopOnExceptionOk() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:split");
mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Hi World");
template.sendBody("direct:start", "Hello World,Bye World,Hi World");
assertMockEndpointsSatisfied();
}
示例11: testActionCalled
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testActionCalled() throws Exception {
Mailbox mailbox = Mailbox.get("[email protected]");
assertEquals(1, mailbox.size());
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("TestText");
assertMockEndpointsSatisfied();
waitForActionCalled();
}
示例12: testQueue
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
public void testQueue() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Goodday World", "Bar");
template2.sendBody("disruptor-vm:foo", "Hello World");
template2.sendBody("disruptor-vm:foo?size=20", "Bye World");
template2.sendBody("disruptor-vm:foo?concurrentConsumers=5", "Goodday World");
template.sendBody("disruptor-vm:bar", "Bar");
}
示例13: testDepth
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testDepth() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("a2", "b2");
template.sendBodyAndHeader("ftp://[email protected]:" + getPort() + "/depth?password=admin", "a", Exchange.FILE_NAME, "a.txt");
template.sendBodyAndHeader("ftp://[email protected]:" + getPort() + "/depth?password=admin", "b", Exchange.FILE_NAME, "b.txt");
template.sendBodyAndHeader("ftp://[email protected]:" + getPort() + "/depth/foo?password=admin", "a2", Exchange.FILE_NAME, "a2.txt");
template.sendBodyAndHeader("ftp://[email protected]:" + getPort() + "/depth/foo/bar?password=admin", "a3", Exchange.FILE_NAME, "a.txt");
template.sendBodyAndHeader("ftp://[email protected]:" + getPort() + "/depth/bar?password=admin", "b2", Exchange.FILE_NAME, "b2.txt");
template.sendBodyAndHeader("ftp://[email protected]:" + getPort() + "/depth/bar/foo?password=admin", "b3", Exchange.FILE_NAME, "b.txt");
// only expect 2 of the 6 sent, those at depth 2
assertMockEndpointsSatisfied();
}
示例14: testMinaRoute
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testMinaRoute() throws Exception {
MockEndpoint endpoint = getMockEndpoint("mock:result");
endpoint.expectedBodiesReceivedInAnyOrder("Hello Message: 0", "Hello Message: 1", "Hello Message: 2");
sendUdpMessages();
assertMockEndpointsSatisfied();
}
示例15: testPollFileAndShouldBeMoved
import org.apache.camel.component.mock.MockEndpoint; //导入方法依赖的package包/类
@Test
public void testPollFileAndShouldBeMoved() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceivedInAnyOrder("Hello", "Bye", "Goodday");
mock.expectedFileExists(FTP_ROOT_DIR + "/.done/hello.txt.old");
mock.expectedFileExists(FTP_ROOT_DIR + "/.done/bye/bye.txt.old");
mock.expectedFileExists(FTP_ROOT_DIR + "/.done/goodday/goodday.txt.old");
mock.assertIsSatisfied();
}