当前位置: 首页>>代码示例>>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;未经允许,请勿转载。