當前位置: 首頁>>代碼示例>>Java>>正文


Java MockEndpoint.expectedBodiesReceived方法代碼示例

本文整理匯總了Java中org.apache.camel.component.mock.MockEndpoint.expectedBodiesReceived方法的典型用法代碼示例。如果您正苦於以下問題:Java MockEndpoint.expectedBodiesReceived方法的具體用法?Java MockEndpoint.expectedBodiesReceived怎麽用?Java MockEndpoint.expectedBodiesReceived使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.camel.component.mock.MockEndpoint的用法示例。


在下文中一共展示了MockEndpoint.expectedBodiesReceived方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testJmsMessageWithSelector

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testJmsMessageWithSelector() throws Exception {
    MockEndpoint endpointA = getMockEndpoint("mock:a");
    MockEndpoint endpointB = getMockEndpoint("mock:b");
    MockEndpoint endpointC = getMockEndpoint("mock:c");

    endpointA.expectedBodiesReceivedInAnyOrder("A blue car!", "A blue car, again!");
    endpointA.expectedHeaderReceived("color", "blue");
    endpointB.expectedHeaderReceived("color", "red");
    endpointB.expectedBodiesReceived("A red car!");

    endpointC.expectedBodiesReceived("Message1", "Message2");
    endpointC.expectedMessageCount(2);

    template.sendBodyAndHeader("sjms:queue:hello", "A blue car!", "color", "blue");
    template.sendBodyAndHeader("sjms:queue:hello", "A red car!", "color", "red");
    template.sendBodyAndHeader("sjms:queue:hello", "A blue car, again!", "color", "blue");
    template.sendBodyAndHeader("sjms:queue:hello", "Message1", "SIZE_NUMBER", 1505);
    template.sendBodyAndHeader("sjms:queue:hello", "Message3", "SIZE_NUMBER", 1300);
    template.sendBodyAndHeader("sjms:queue:hello", "Message2", "SIZE_NUMBER", 1600);
    assertMockEndpointsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:JmsSelectorOptionTest.java

示例2: testTCPEncodeUTF8InputIsBytes

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testTCPEncodeUTF8InputIsBytes() throws Exception {
    final String uri = String.format("mina2:tcp://localhost:%1$s?encoding=UTF-8&sync=false", getPort());
    context.addRoutes(new RouteBuilder() {

        public void configure() {
            from(uri).to("mock:result");
        }
    });

    MockEndpoint endpoint = getMockEndpoint("mock:result");

    // include a UTF-8 char in the text \u0E08 is a Thai elephant
    byte[] body = "Hello Thai Elephant \u0E08".getBytes("UTF-8");

    endpoint.expectedMessageCount(1);
    endpoint.expectedBodiesReceived(body);

    template.sendBody(uri, body);
    assertMockEndpointsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:22,代碼來源:Mina2EncodingTest.java

示例3: testThreadUsedForEveryAggregatorWhenDefaultExecutorServiceUsed

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
public void testThreadUsedForEveryAggregatorWhenDefaultExecutorServiceUsed() throws Exception {
    assertTrue("There should be a thread for every aggregator when using defaults", 
            AggregateTimeoutWithExecutorServiceTest.aggregateThreadsCount() >= AggregateTimeoutWithExecutorServiceTest.NUM_AGGREGATORS);
    
    // sanity check to make sure were testing routes that work
    for (int i = 0; i < AggregateTimeoutWithExecutorServiceTest.NUM_AGGREGATORS; ++i) {
        MockEndpoint result = getMockEndpoint("mock:result" + i);
        // by default the use latest aggregation strategy is used so we get message 4
        result.expectedBodiesReceived("Message 4");
    }
    for (int i = 0; i < AggregateTimeoutWithExecutorServiceTest.NUM_AGGREGATORS; ++i) {
        for (int j = 0; j < 5; j++) {
            template.sendBodyAndHeader("direct:start" + i, "Message " + j, "id", "1");
        }
    }
    assertMockEndpointsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:18,代碼來源:AggregateTimeoutWithNoExecutorServiceTest.java

示例4: camelConnectorTest

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void camelConnectorTest() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");

    mock.expectedMinimumMessageCount(1);
    mock.expectedBodiesReceived("{\"c\":60}");

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:10,代碼來源:SqlStoredStartConnectorComponentTest.java

示例5: testSend

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testSend() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String body = "hello";

    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived(body.toUpperCase());

    template().sendBody("direct:start", body);

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:13,代碼來源:ComponentProxyComponentTest.java

示例6: testSend

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testSend() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String body = "hello";
    final String expected = Base64.getEncoder().encodeToString(body.toUpperCase().getBytes());

    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived(expected);

    template().sendBody("direct:start", body);

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:14,代碼來源:ComponentProxyRuntimeTest.java

示例7: testDefaultSplitWithCollection

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testDefaultSplitWithCollection() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String[] values = { "a","b","c" };

    mock.expectedMessageCount(values.length);
    mock.expectedBodiesReceived(values);

    template().sendBody("direct:start", Arrays.asList(values));

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:13,代碼來源:ComponentProxyRuntimeSplitTest.java

示例8: testDefaultSplitWithPojo

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testDefaultSplitWithPojo() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String value = "a";

    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived(value);

    template().sendBody("direct:start", value);

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:13,代碼來源:ComponentProxyRuntimeSplitTest.java

示例9: testTokenizerSplit

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testTokenizerSplit() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String values = "a,b,c";
    final String[] result = values.split(",");

    mock.expectedMessageCount(result.length);
    mock.expectedBodiesReceived(result);

    template().sendBody("direct:start", values);

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:14,代碼來源:ComponentProxyRuntimeSplitTest.java

示例10: testSend

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testSend() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String body = "hello";
    final String expected = Base64.getEncoder().encodeToString("HELLO WORLD!".toUpperCase().getBytes());

    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived(expected);

    template().sendBody("direct:start", body);

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:14,代碼來源:ComponentProxyRuntimeCustomizerTest.java

示例11: testSend

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testSend() throws Exception {
    final MockEndpoint mock = getMockEndpoint("mock:result");
    final String body = "hello";
    final String expected = body.toUpperCase();

    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived(expected);

    template().sendBody("direct:start", body);

    mock.assertIsSatisfied();
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:14,代碼來源:ComponentProxyRuntimePlaceholdersTest.java

示例12: testTwoMessages

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testTwoMessages() throws Exception {
    MockEndpoint resultEndpoint = context.getEndpoint("mock:test", MockEndpoint.class);
    resultEndpoint.expectedBodiesReceived("test", "test2");
    Subscriber<String> subscriber = camel.to("mock:test", String.class);
    Flux.just("test", "test2").subscribe(subscriber);
    resultEndpoint.assertIsSatisfied();
}
 
開發者ID:cschneider,項目名稱:reactive-components,代碼行數:9,代碼來源:CamelComponentTest.java

示例13: testEndpoint

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testEndpoint() throws Exception {
    // these tests does not run well on Windows
    if (isPlatform("windows")) {
        return;
    }

    MockEndpoint mockEndpointA = resolveMandatoryEndpoint("mock:a", MockEndpoint.class);
    mockEndpointA.expectedBodiesReceived(expectedBody);
    MockEndpoint mockEndpointB = resolveMandatoryEndpoint("mock:b", MockEndpoint.class);
    mockEndpointB.expectedBodiesReceived(expectedBody);

    invokeHttpEndpoint();

    mockEndpointA.assertIsSatisfied();
    mockEndpointB.assertIsSatisfied();
    List<Exchange> list = mockEndpointA.getReceivedExchanges();
    Exchange exchange = list.get(0);
    assertNotNull("exchange", exchange);

    Message in = exchange.getIn();
    assertNotNull("in", in);

    Map<String, Object> headers = in.getHeaders();

    log.info("Headers: " + headers);

    assertTrue("Should be more than one header but was: " + headers, headers.size() > 0);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:30,代碼來源:HttpsAsyncRouteTest.java

示例14: testFTPClientConfig

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testFTPClientConfig() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived("Hello World");

    assertMockEndpointsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:9,代碼來源:FtpConsumerUsingFTPClientConfigTest.java

示例15: testRemove

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
public void testRemove() throws Exception {
    // JMX tests dont work well on AIX CI servers (hangs them)
    if (isPlatform("aix")) {
        return;
    }

    MBeanServer mbeanServer = getMBeanServer();
    ObjectName on = getRouteObjectName(mbeanServer);

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");

    template.sendBodyAndHeader("file://target/managed", "Hello World", Exchange.FILE_NAME, "hello.txt");

    assertMockEndpointsSatisfied();

    // should be started
    String state = (String) mbeanServer.getAttribute(on, "State");
    assertEquals("Should be started", ServiceStatus.Started.name(), state);

    // stop
    mbeanServer.invoke(on, "stop", null, null);

    state = (String) mbeanServer.getAttribute(on, "State");
    assertEquals("Should be stopped", ServiceStatus.Stopped.name(), state);

    // remove
    mbeanServer.invoke(on, "remove", null, null);

    // should not be registered anymore
    boolean registered = mbeanServer.isRegistered(on);
    assertFalse("Route mbean should have been unregistered", registered);

    // and no more routes
    Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
    assertEquals(0, set.size());
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:38,代碼來源:ManagedRouteRemoveTest.java


注:本文中的org.apache.camel.component.mock.MockEndpoint.expectedBodiesReceived方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。