当前位置: 首页>>代码示例>>Java>>正文


Java NotifyBuilder.matchesMockWaitTime方法代码示例

本文整理汇总了Java中org.apache.camel.builder.NotifyBuilder.matchesMockWaitTime方法的典型用法代码示例。如果您正苦于以下问题:Java NotifyBuilder.matchesMockWaitTime方法的具体用法?Java NotifyBuilder.matchesMockWaitTime怎么用?Java NotifyBuilder.matchesMockWaitTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.builder.NotifyBuilder的用法示例。


在下文中一共展示了NotifyBuilder.matchesMockWaitTime方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRouteFileToFile

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testRouteFileToFile() throws Exception {
    deleteDirectory("target/file2file");
    NotifyBuilder notify = new NotifyBuilder(context).from("activemq:queue:hello").whenDone(1).create();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);

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

    assertMockEndpointsSatisfied();

    notify.matchesMockWaitTime();

    File file = new File("target/file2file/out/hello.txt");
    assertTrue("The file should exists", file.exists());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:FileRouteToJmsToFileTest.java

示例2: testBurstySampling

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testBurstySampling() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(5).create();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMinimumMessageCount(2);
    mock.setResultWaitTime(3000);

    List<Exchange> sentExchanges = new ArrayList<Exchange>();

    // send a burst of 5 exchanges, expecting only one to get through
    sendExchangesThroughDroppingThrottler(sentExchanges, 5);
    // sleep through a complete period
    Thread.sleep(1100);
    // send another 5 now
    sendExchangesThroughDroppingThrottler(sentExchanges, 5);

    notify.matchesMockWaitTime();
    mock.assertIsSatisfied();

    validateDroppedExchanges(sentExchanges, mock.getReceivedCounter());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:SamplingThrottlerTest.java

示例3: testZipFileUnmarshalDelete

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testZipFileUnmarshalDelete() throws Exception {
    // there are 2 exchanges
    NotifyBuilder event = event().whenDone(2).create();

    getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
    template.sendBodyAndHeader("file:target/zip", "Hello World", Exchange.FILE_NAME, "hello.txt");
    assertMockEndpointsSatisfied();

    event.matchesMockWaitTime();

    File in = new File("target/zip/hello.txt");
    assertFalse("Should have been deleted " + in, in.exists());

    File out = new File("target/zip/out/hello.txt.zip");
    assertFalse("Should have been deleted " + out, out.exists());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ZipDataFormatFileUnmarshalDeleteTest.java

示例4: testSamplingFromExchangeStream

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testSamplingFromExchangeStream() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(15).create();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMinimumMessageCount(2);
    mock.setResultWaitTime(3000);

    List<Exchange> sentExchanges = new ArrayList<Exchange>();
    sendExchangesThroughDroppingThrottler(sentExchanges, 15);

    notify.matchesMockWaitTime();
    mock.assertIsSatisfied();

    validateDroppedExchanges(sentExchanges, mock.getReceivedCounter());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:SamplingThrottlerTest.java

示例5: testSedaUOW

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testSedaUOW() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);

    template.sendBodyAndHeader("direct:start", "Hello World", "foo", "bar");

    assertMockEndpointsSatisfied();
    notify.matchesMockWaitTime();

    assertEquals("onCompleteA", sync);
    assertEquals("onCompleteA", lastOne);
    assertEquals("Should have propagated the header inside the Synchronization.onComplete() callback", "bar", foo);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:SedaUnitOfWorkTest.java

示例6: testSedaUOWWithException

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testSedaUOWWithException() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

    template.sendBodyAndHeader("direct:start", "Hello World", "kaboom", "yes");

    notify.matchesMockWaitTime();

    assertEquals("onFailureA", sync);
    assertEquals("onFailureA", lastOne);
    assertEquals("Should have propagated the header inside the Synchronization.onFailure() callback", "yes", kaboom);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:SedaUnitOfWorkTest.java

示例7: testNoop

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testNoop() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(2);
    assertMockEndpointsSatisfied();

    notify.matchesMockWaitTime();

    File file = new File("target/filenoop");
    assertEquals("There should be 2 files", 2, file.list().length);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:FileConsumerNoopTest.java

示例8: assertResult

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
protected void assertResult() throws InterruptedException {
    // should be 1 completed and 1 failed
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

    template.sendBody("activemq:queue:foo", "blah");

    notify.matchesMockWaitTime();

    assertTrue("Expected only 2 calls to process() (1 failure, 1 success) but encountered "
               + getConditionalExceptionProcessor().getCount() + ".", getConditionalExceptionProcessor().getCount() == 2);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:AbstractTransactionTest.java

示例9: testGzipFileUnmarshalDelete

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testGzipFileUnmarshalDelete() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

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

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

    assertMockEndpointsSatisfied();
    notify.matchesMockWaitTime();

    File in = new File("target/gzip/hello.txt");
    assertFalse("Should have been deleted " + in, in.exists());

    File out = new File("target/gzip/out/hello.txt.gz");
    assertFalse("Should have been deleted " + out, out.exists());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:GzipDataFormatFileUnmarshalDeleteTest.java

示例10: testNoTransactionRollbackUsingXmlQueueToQueue

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testNoTransactionRollbackUsingXmlQueueToQueue() throws Exception {

    // configure routes and add to camel context
    context.addRoutes(new SpringRouteBuilder() {

        @Override
        public void configure() throws Exception {
            errorHandler(noErrorHandler());
            from("activemq:queue:foo?transacted=false").process(new ConditionalExceptionProcessor())
                    .to("activemq:queue:bar?transacted=false");


        }
    });

    NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();

    template.sendBody("activemq:queue:foo", "blah");

    notify.matchesMockWaitTime();

    assertTrue("Expected only 1 calls to process() (1 failure) but encountered "
               + getConditionalExceptionProcessor().getCount() + ".", getConditionalExceptionProcessor().getCount() == 1);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:QueueToQueueTransactionWithoutDefineTransactionManagerTest.java

示例11: testDisruptorUOW

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testDisruptorUOW() throws Exception {
    final NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

    final MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);


    template.sendBody("direct:start", "Hello World");

    assertMockEndpointsSatisfied();
    notify.matchesMockWaitTime();

    assertEquals("onCompleteA", sync);
    assertEquals("onCompleteA", lastOne);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:DisruptorUnitOfWorkTest.java


注:本文中的org.apache.camel.builder.NotifyBuilder.matchesMockWaitTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。