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


Java NotifyBuilder.matches方法代码示例

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


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

示例1: testNotifyFrom

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testNotifyFrom() throws Exception {
    // use from to indicate it should only be messages originating from the given endpoint
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenDone(1).create();

    template.sendBody("seda:quote", "Camel rocks");
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");

    boolean matches = notify.matches(1, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    assertEquals(1, confirm.getExchanges().size());
    assertEquals("OK,123,2010-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:17,代码来源:NotifyTest.java

示例2: xxxtestTokenPairPerformanceRoute

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

    boolean matches = notify.matches(5, TimeUnit.MINUTES);
    log.info("Processed file with " + size + " elements in: " + TimeUtils.printDuration(watch.stop()));

    log.info("Processed " + tiny.get() + " tiny messages");
    log.info("Processed " + small.get() + " small messages");
    log.info("Processed " + med.get() + " medium messages");
    log.info("Processed " + large.get() + " large messages");

    assertEquals((size / 10) * 4, tiny.get());
    assertEquals((size / 10) * 2, small.get());
    assertEquals((size / 10) * 3, med.get());
    assertEquals((size / 10) * 1, large.get());

    assertTrue("Should complete route", matches);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:TokenPairIteratorSplitChoicePerformanceTest.java

示例3: xxTestXPatPerformanceRoute

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

    boolean matches = notify.matches(60, TimeUnit.SECONDS);
    log.info("Processed file with " + size + " elements in: " + TimeUtils.printDuration(watch.stop()));

    log.info("Processed " + tiny.get() + " tiny messages");
    log.info("Processed " + small.get() + " small messages");
    log.info("Processed " + med.get() + " medium messages");
    log.info("Processed " + large.get() + " large messages");

    assertEquals((size / 10) * 4, tiny.get());
    assertEquals((size / 10) * 2, small.get());
    assertEquals((size / 10) * 3, med.get());
    assertEquals((size / 10) * 1, large.get());

    assertTrue("Should complete route", matches);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:XPathSplitChoicePerformanceTest.java

示例4: testInOnly

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
public void testInOnly() throws Exception {
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start").to("seda:foo?timeout=1000");
        }
    });

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

    // no problem for in only as we do not expect a reply
    template.sendBody("direct:start", "Hello World");
    notify.matches(2, TimeUnit.SECONDS);

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:SedaNoConsumerTest.java

示例5: testXPathSTaXPerformanceRoute

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

    boolean matches = notify.matches(60, TimeUnit.SECONDS);
    log.info("Processed file with " + size + " elements in: " + TimeUtils.printDuration(watch.stop()));

    log.info("Processed " + tiny.get() + " tiny messages");
    log.info("Processed " + small.get() + " small messages");
    log.info("Processed " + med.get() + " medium messages");
    log.info("Processed " + large.get() + " large messages");

    assertEquals((size / 10) * 4, tiny.get());
    assertEquals((size / 10) * 2, small.get());
    assertEquals((size / 10) * 3, med.get());
    assertEquals((size / 10) * 1, large.get());

    assertTrue("Should complete route", matches);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:StAXXPathSplitChoicePerformanceTest.java

示例6: testAddingDataToCacheWithNonStringCacheKey

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testAddingDataToCacheWithNonStringCacheKey() throws Exception {
    context.addRoutes(new RouteBuilder() {
        public void configure() {
            from("direct:a").
                    setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD)).
                    setHeader(CacheConstants.CACHE_KEY, constant(10L)).
                    to("cache://TestCache1");
        }
    });
    context.start();
    NotifyBuilder notify = new NotifyBuilder(context).whenExactlyDone(1).create();

    log.debug("------------Beginning CacheProducer Add Test---------------");
    sendOriginalFile();

    notify.matches(10, TimeUnit.SECONDS);
    assertNotNull(fetchElement("10"));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:CacheProducerTest.java

示例7: testXPathPerformanceRoute

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
@Ignore("Manual test")
public void testXPathPerformanceRoute() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(size).create();

    boolean matches = notify.matches(60, TimeUnit.SECONDS);
    log.info("Processed file with " + size + " elements in: " + TimeUtils.printDuration(watch.stop()));

    log.info("Processed " + tiny.get() + " tiny messages");
    log.info("Processed " + small.get() + " small messages");
    log.info("Processed " + med.get() + " medium messages");
    log.info("Processed " + large.get() + " large messages");

    assertEquals((size / 10) * 4, tiny.get());
    assertEquals((size / 10) * 2, small.get());
    assertEquals((size / 10) * 3, med.get());
    assertEquals((size / 10) * 1, large.get());

    assertTrue("Should complete route", matches);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:XPathSplitChoicePerformanceTest.java

示例8: testOrderClientInvalid

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

    Calendar cal = Calendar.getInstance(Locale.US);
    cal.set(Calendar.YEAR, 2017);
    cal.set(Calendar.MONTH, Calendar.APRIL);
    cal.set(Calendar.DAY_OF_MONTH, 20);
    cal.set(Calendar.HOUR_OF_DAY, 7);
    cal.set(Calendar.MINUTE, 47);
    cal.set(Calendar.SECOND, 58);
    Date date = cal.getTime();

    OrderClient client = new OrderClient("tcp://localhost:61616");
    // when using customer id 999 we force an invalid order
    client.sendOrder(999, date, "5555", "2222");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    // should be one message in confirm queue
    BrowsableEndpoint be = context.getEndpoint("activemq:queue:invalid", BrowsableEndpoint.class);
    List<Exchange> list = be.getExchanges();
    assertEquals(1, list.size());
    assertEquals("999,2017-04-20T07:47:58,5555,2222", list.get(0).getIn().getBody(String.class));
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:27,代码来源:OrderTest.java

示例9: testOrderClientFailure

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testOrderClientFailure() throws Exception {
    // now we expect the message to fail so we use whenFailed
    NotifyBuilder notify = new NotifyBuilder(context).whenFailed(1).create();

    Calendar cal = Calendar.getInstance(Locale.US);
    cal.set(Calendar.YEAR, 2017);
    cal.set(Calendar.MONTH, Calendar.APRIL);
    cal.set(Calendar.DAY_OF_MONTH, 20);
    cal.set(Calendar.HOUR_OF_DAY, 7);
    cal.set(Calendar.MINUTE, 47);
    cal.set(Calendar.SECOND, 58);
    Date date = cal.getTime();

    OrderClient client = new OrderClient("tcp://localhost:61616");
    // by using 9999 as the last item id we force an exception to occur
    client.sendOrder(123, date, "4444", "9999");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:22,代码来源:OrderTest.java

示例10: testNotifyFrom

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testNotifyFrom() throws Exception {
    // use from to indicate it should only be messages originating from the given endpoint
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenDone(1).create();

    template.sendBody("seda:quote", "Camel rocks");
    template.sendBody("seda:order", "123,2017-04-20'T'15:47:59,4444,5555");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    assertEquals(1, confirm.getExchanges().size());
    assertEquals("OK,123,2017-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:17,代码来源:NotifyTest.java

示例11: testNotifyWhenAnyDoneMatches

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
    // use a predicate to indicate when a certain message is done
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2017-04-20'T'15:48:00,2222,3333")).create();

    // send in 2 messages. Its the 2nd message we want to test
    template.sendBody("seda:order", "123,2017-04-20'T'15:47:59,4444,5555");
    template.sendBody("seda:order", "123,2017-04-20'T'15:48:00,2222,3333");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    // there should be 2 messages on the confirm queue
    assertEquals(2, confirm.getExchanges().size());
    // and the 2nd message should be the message we wanted to test for
    assertEquals("OK,123,2017-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:20,代码来源:NotifyTest.java

示例12: testOrderClientInvalid

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

    Calendar cal = Calendar.getInstance(Locale.US);
    cal.set(Calendar.YEAR, 2010);
    cal.set(Calendar.MONTH, Calendar.APRIL);
    cal.set(Calendar.DAY_OF_MONTH, 20);
    cal.set(Calendar.HOUR_OF_DAY, 7);
    cal.set(Calendar.MINUTE, 47);
    cal.set(Calendar.SECOND, 58);
    Date date = cal.getTime();

    OrderClient client = new OrderClient("tcp://localhost:61616");
    // when using customer id 999 we force an invalid order
    client.sendOrder(999, date, "5555", "2222");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    // should be one message in confirm queue
    BrowsableEndpoint be = context.getEndpoint("activemq:queue:invalid", BrowsableEndpoint.class);
    List<Exchange> list = be.getExchanges();
    assertEquals(1, list.size());
    assertEquals("999,2010-04-20T07:47:58,5555,2222", list.get(0).getIn().getBody(String.class));
}
 
开发者ID:camelinaction,项目名称:camelinaction,代码行数:27,代码来源:OrderTest.java

示例13: testOrderClientFailure

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testOrderClientFailure() throws Exception {
    // now we expect the message to fail so we use whenFailed
    NotifyBuilder notify = new NotifyBuilder(context).whenFailed(1).create();

    Calendar cal = Calendar.getInstance(Locale.US);
    cal.set(Calendar.YEAR, 2010);
    cal.set(Calendar.MONTH, Calendar.APRIL);
    cal.set(Calendar.DAY_OF_MONTH, 20);
    cal.set(Calendar.HOUR_OF_DAY, 7);
    cal.set(Calendar.MINUTE, 47);
    cal.set(Calendar.SECOND, 58);
    Date date = cal.getTime();

    OrderClient client = new OrderClient("tcp://localhost:61616");
    // by using 9999 as the last item id we force an exception to occur
    client.sendOrder(123, date, "4444", "9999");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);
}
 
开发者ID:camelinaction,项目名称:camelinaction,代码行数:22,代码来源:OrderTest.java

示例14: testNotifyFrom

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testNotifyFrom() throws Exception {
    // use from to indicate it should only be messages originating from the given endpoint
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenDone(1).create();

    template.sendBody("seda:quote", "Camel rocks");
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    assertEquals(1, confirm.getExchanges().size());
    assertEquals("OK,123,2010-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
 
开发者ID:camelinaction,项目名称:camelinaction,代码行数:17,代码来源:NotifyTest.java

示例15: testNotifyWhenAnyDoneMatches

import org.apache.camel.builder.NotifyBuilder; //导入方法依赖的package包/类
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
    // use a predicate to indicate when a certain message is done
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2010-04-20'T'15:48:00,2222,3333")).create();

    // send in 2 messages. Its the 2nd message we want to test
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");
    template.sendBody("seda:order", "123,2010-04-20'T'15:48:00,2222,3333");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    // there should be 2 messages on the confirm queue
    assertEquals(2, confirm.getExchanges().size());
    // and the 2nd message should be the message we wanted to test for
    assertEquals("OK,123,2010-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
 
开发者ID:camelinaction,项目名称:camelinaction,代码行数:20,代码来源:NotifyTest.java


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