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


Java MockEndpoint.setAssertPeriod方法代碼示例

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


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

示例1: testFooWine

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

	mock.expectedMinimumMessageCount(2);
    mock.setAssertPeriod(500);
    
    assertMockEndpointsSatisfied();
    
    List<Exchange> exchanges = mock.getReceivedExchanges();
    int drinks = 0;
    for (Exchange exchange : exchanges) {
        drinks += 2;
        Message message = exchange.getIn();
        String body = message.getBody().toString();
			
        assertEquals("Total " + drinks + " of wine ordered", body);
    }
}
 
開發者ID:fabric8io,項目名稱:django-examples,代碼行數:20,代碼來源:FooWineTest.java

示例2: testBeverage

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

	mock.expectedMinimumMessageCount(2);
    mock.setAssertPeriod(500);
    
    assertMockEndpointsSatisfied();
    
    List<Exchange> exchanges = mock.getReceivedExchanges();
    int drinks = 0;
    for (Exchange exchange : exchanges) {
        drinks += 2;
        Message message = exchange.getIn();
        String body = message.getBody().toString();
	
        assertEquals("Total " + drinks + " of gintonic ordered", body);
    }
}
 
開發者ID:fabric8io,項目名稱:django-examples,代碼行數:20,代碼來源:BeverageTest.java

示例3: testGroupLines

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testGroupLines() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(2);
    mock.setAssertPeriod(1000);
    mock.message(0).header(StreamConstants.STREAM_INDEX).isEqualTo(0);
    mock.message(0).header(StreamConstants.STREAM_COMPLETE).isEqualTo(false);
    mock.message(1).header(StreamConstants.STREAM_INDEX).isEqualTo(1);
    mock.message(1).header(StreamConstants.STREAM_COMPLETE).isEqualTo(true);

    assertMockEndpointsSatisfied();

    List<?> list = mock.getExchanges().get(0).getIn().getBody(List.class);
    assertEquals(3, list.size());
    assertEquals("A", list.get(0));
    assertEquals("B", list.get(1));
    assertEquals("C", list.get(2));

    List<?> list2 = mock.getExchanges().get(1).getIn().getBody(List.class);
    assertEquals(3, list2.size());
    assertEquals("D", list2.get(0));
    assertEquals("E", list2.get(1));
    assertEquals("F", list2.get(2));
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:25,代碼來源:StreamGroupLinesTest.java

示例4: testGroupLines

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testGroupLines() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(2);
    mock.setAssertPeriod(1000);
    mock.message(0).header(StreamConstants.STREAM_INDEX).isEqualTo(0);
    mock.message(0).header(StreamConstants.STREAM_COMPLETE).isEqualTo(false);
    mock.message(1).header(StreamConstants.STREAM_INDEX).isEqualTo(1);
    mock.message(1).header(StreamConstants.STREAM_COMPLETE).isEqualTo(true);

    assertMockEndpointsSatisfied();

    Object result = mock.getExchanges().get(0).getIn().getBody();
    assertEquals("Get a wrong result.", "A\nB\nC\nD\n", result);

    // we did not have 4 lines but since its the last it was triggered anyway
    Object result2 = mock.getExchanges().get(1).getIn().getBody();
    assertEquals("Get a wrong result.", "E\nF\n", result2);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:20,代碼來源:StreamGroupLinesLastStrategyTest.java

示例5: testGroupLines

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testGroupLines() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(2);
    mock.setAssertPeriod(1000);
    mock.message(0).header(StreamConstants.STREAM_INDEX).isEqualTo(0);
    mock.message(0).header(StreamConstants.STREAM_COMPLETE).isEqualTo(false);
    mock.message(1).header(StreamConstants.STREAM_INDEX).isEqualTo(1);
    mock.message(1).header(StreamConstants.STREAM_COMPLETE).isEqualTo(true);

    assertMockEndpointsSatisfied();

    Object result = mock.getExchanges().get(0).getIn().getBody();
    assertEquals("Get a wrong result.", "A\nB\nC\n", result);

    Object result2 = mock.getExchanges().get(1).getIn().getBody();
    assertEquals("Get a wrong result.", "D\nE\nF\n", result2);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:19,代碼來源:StreamGroupLinesStrategyTest.java

示例6: testFooBar

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

    mock.expectedMinimumMessageCount(2);
    mock.setAssertPeriod(500);
	
    assertMockEndpointsSatisfied();
}
 
開發者ID:fabric8io,項目名稱:django-examples,代碼行數:10,代碼來源:FooBarTest.java

示例7: testPurgeWhenStopping

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

    for (int i = 0; i < 100; i++) {
        template.sendBody("seda:foo", "Message " + i);
    }

    context.startRoute("myRoute");
    latch.await(5, TimeUnit.SECONDS);
    context.stopRoute("myRoute");

    mock.setAssertPeriod(2000);
    mock.assertIsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:16,代碼來源:SedaPurgeWhenStoppingTest.java

示例8: testRepeatCount

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
public void testRepeatCount() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(3);
    mock.setAssertPeriod(500);
    mock.message(0).header(Exchange.TIMER_COUNTER).isEqualTo(1);
    mock.message(1).header(Exchange.TIMER_COUNTER).isEqualTo(2);
    mock.message(2).header(Exchange.TIMER_COUNTER).isEqualTo(3);

    // we should only get 3 messages as we have a repeat count limit at 3

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

示例9: testInOutRepeatSequentialInvocations

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testInOutRepeatSequentialInvocations() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:finished");
    mock.setAssertPeriod(2000);
    mock.expectedMessageCount(1);
    String outPayload = template.requestBody("direct:test", "test", String.class);
    assertEquals("Some reply", outPayload);
    mock.assertIsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:10,代碼來源:JmsInOutRepeatedInvocationsTest.java

示例10: testInOutParallel

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
@Test
public void testInOutParallel() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:received");
    mock.setAssertPeriod(2000);
    mock.expectedMessageCount(5);
    String outPayload = template.requestBody("direct:test", "test", String.class);
    assertEquals("Fully done", outPayload);
    mock.assertIsSatisfied();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:10,代碼來源:JmsInOutParallelTest.java

示例11: setAssertPeriod

import org.apache.camel.component.mock.MockEndpoint; //導入方法依賴的package包/類
/**
 * Sets the assert period on all the Mock endpoints
 */
protected void setAssertPeriod(long period) {
    MockEndpoint.setAssertPeriod(context, period);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:7,代碼來源:ContextTestSupport.java


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