Java 类org.apache.camel.cdi.Uri 实例源码

项目:Camel    文件:AdviceTest.java   
void advice(@Observes CamelContextStartingEvent event,
            @Uri("mock:messages") MockEndpoint messages,
            ModelCamelContext context) throws Exception {
    messages.expectedMessageCount(2);
    messages.expectedBodiesReceived("Hello", "Bye");

    verifier.messages = messages;

    context.getRouteDefinition("route")
        .adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() {
                weaveAddLast().to("mock:messages");
            }
        });
}
项目:camel-cdi    文件:RawEventEndpointTest.java   
@Test
public void sendMessageToProducer(@Uri("direct:produce") ProducerTemplate producer) throws InterruptedException {
    long random =  Math.round(Math.random() * Long.MAX_VALUE);

    produced.expectedMessageCount(1);
    produced.expectedBodiesReceived(random);
    produced.message(0).predicate(exchange -> {
        EventMetadata metadata = exchange.getIn().getHeader("metadata", EventMetadata.class);
        return metadata.getType().equals(Long.class) && metadata.getQualifiers().equals(new HashSet<>(Arrays.asList(new AnnotationLiteral<Any>() {}, new AnnotationLiteral<Default>() {})));
    });

    consumed.expectedMessageCount(1);
    consumed.expectedBodiesReceived(random);

    producer.sendBody(random);

    assertIsSatisfied(2L, TimeUnit.SECONDS, consumed, produced);
}
项目:Camel    文件:Application.java   
void hello(@Observes CamelContextStartedEvent event,
           // Configuration properties can be injected with @ConfigProperty
           @ConfigProperty(name = "message") String message,
           // Property placeholders in @Uri qualifier are also resolved
           @Uri("{{destination}}") ProducerTemplate producer) {
    producer.sendBody(message);
}
项目:Camel    文件:CdiPropertiesTest.java   
@Test
public void testRouteMessage(@Uri("mock:outbound") MockEndpoint outbound) {
    assertThat("Exchange count is incorrect!",
        outbound.getExchanges(),
        hasSize(1));
    assertThat("Exchange body is incorrect!",
        outbound.getExchanges().get(0).getIn().getBody(String.class),
        is(equalTo("Hello")));
}
项目:Camel    文件:CdiXmlTest.java   
@Test
@Order(1)
public void takeTheBluePill(@Uri("mock:matrix") MockEndpoint matrix) throws InterruptedException {
    matrix.expectedMessageCount(1);
    matrix.expectedBodiesReceived("Matrix » Take the blue pill!");

    prompt.sendBody(neo, "Take the blue pill!");

    assertIsSatisfied(2L, TimeUnit.SECONDS, matrix);
}
项目:Camel    文件:CdiXmlTest.java   
@Test
@Order(2)
public void takeTheRedPill(@Uri("mock:zion") MockEndpoint zion) throws InterruptedException {
    zion.expectedMessageCount(1);
    zion.expectedHeaderReceived("location", "matrix");

    prompt.sendBody(neo, "Take the red pill!");

    assertIsSatisfied(2L, TimeUnit.SECONDS, zion);
}
项目:Camel    文件:UnstoppedCamelContextProducerFieldTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:start") ProducerTemplate inbound, @Uri("mock:result") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:ContextComponentTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("second-first-test");

    inbound.sendBody("test");

    MockEndpoint.assertIsSatisfied(1L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:PropertyInjectTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:in") ProducerTemplate in, @Uri("mock:out") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test");
    out.expectedHeaderReceived("header", "value");

    in.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:Camel    文件:RawEventEndpointCdi12Test.java   
@Test
public void sendMessageToProducer(@Uri("direct:produce") ProducerTemplate producer) throws InterruptedException {
    long random =  Math.round(Math.random() * Long.MAX_VALUE);
    produced.expectedMessageCount(1);
    produced.expectedBodiesReceived(random);
    consumed.expectedMessageCount(1);
    consumed.expectedBodiesReceived(random);

    producer.sendBody(random);

    assertIsSatisfied(2L, TimeUnit.SECONDS, consumed, produced);
}
项目:Camel    文件:CamelEventEndpointTest.java   
@Test
public void camelStartedEvent(@Uri("mock:started") MockEndpoint started) {
    assertThat("Event fired is incorrect!", started.getExchanges(),
        contains(
            hasProperty("in",
                hasProperty("body", instanceOf(CamelContextStartedEvent.class)))));
}
项目:Camel    文件:RouteBuildersWithSameContextNameTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "first");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:UnstoppedCamelContextProducerMethodTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:start") ProducerTemplate inbound,
                                 @Uri("mock:result") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:NamedCamelBeanTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate in,
                                 @Uri("mock:outbound") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test-processed");

    in.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:Camel    文件:UnstoppedCamelContextBeanTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:start") ProducerTemplate inbound, @Uri("mock:result") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:RouteBuilderWithContextNameTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "first");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:RouteBuildersWithContextNamesTest.java   
@Test
public void sendMessageToFirstInbound(@Uri(value = "direct:inbound", context = "first")
                                      ProducerTemplate inbound,
                                      @Uri(value = "mock:outbound", context = "first")
                                      MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "first");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:RouteBuildersWithContextNamesTest.java   
@Test
public void sendMessageToSecondInbound(@Uri("direct:inbound") @ContextName("second")
                                       ProducerTemplate inbound,
                                       @Uri("mock:outbound") @ContextName("second")
                                       MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "second");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:ProgrammaticLookupTest.java   
@Test
public void sendMessageToInbound() throws InterruptedException {
    ProducerTemplate inbound = producers.select(Uri.Literal.of("direct:inbound")).get();
    MockEndpoint outbound = endpoints.select(MockEndpoint.class, Uri.Literal.of("mock:outbound")).get();

    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:Camel    文件:InjectedTypeConverterTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);

    TypeConverterInput input = new TypeConverterInput();
    input.setProperty("property value is [{{property1}}]");

    inbound.sendBody(input);

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
    assertThat(outbound.getExchanges().get(0).getIn().getBody(TypeConverterOutput.class).getProperty(), is(equalTo("property value is [value 1]")));
}
项目:Camel    文件:ProduceTemplateTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate in,
                                 @Uri("mock:outbound") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test-processed");

    in.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:camel-cdi    文件:UnstoppedCamelContextProducerFieldTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:start") ProducerTemplate inbound, @Uri("mock:result") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:ContextComponentTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("second-first-test");

    inbound.sendBody("test");

    MockEndpoint.assertIsSatisfied(1L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:PropertyInjectTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:in") ProducerTemplate in, @Uri("mock:out") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test");
    out.expectedHeaderReceived("header", "value");

    in.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:camel-cdi    文件:CamelEventEndpointTest.java   
@Test
public void camelStartedEvent(@Uri("mock:started") MockEndpoint started) {
    assertThat("Event fired is incorrect!", started.getExchanges(),
        contains(
            hasProperty("in",
                hasProperty("body", instanceOf(CamelContextStartedEvent.class)))));
}
项目:camel-cdi    文件:RouteBuildersWithSameContextNameTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "first");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:ProduceFluentTemplateTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:inbound") FluentProducerTemplate in,
                                 @Uri("mock:outbound") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test-processed");

    in.withBody("test").send();

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:camel-cdi    文件:UnstoppedCamelContextProducerMethodTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:start") ProducerTemplate inbound,
                                 @Uri("mock:result") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:NamedCamelBeanTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate in,
                                 @Uri("mock:outbound") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test-processed");

    in.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:camel-cdi    文件:UnstoppedCamelContextBeanTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:start") ProducerTemplate inbound, @Uri("mock:result") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:RouteBuilderWithContextNameTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "first");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:RouteBuildersWithContextNamesTest.java   
@Test
public void sendMessageToFirstInbound(@Uri("direct:inbound") @ContextName("first")
                                      ProducerTemplate inbound,
                                      @Uri("mock:outbound") @ContextName("first")
                                      MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "first");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:RouteBuildersWithContextNamesTest.java   
@Test
public void sendMessageToSecondInbound(@Uri("direct:inbound") @ContextName("second")
                                       ProducerTemplate inbound,
                                       @Uri("mock:outbound") @ContextName("second")
                                       MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");
    outbound.expectedHeaderReceived("context", "second");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:ProgrammaticLookupTest.java   
@Test
public void sendMessageToInbound() throws InterruptedException {
    ProducerTemplate inbound = producers.select(Uri.Literal.of("direct:inbound")).get();
    MockEndpoint outbound = endpoints.select(MockEndpoint.class, Uri.Literal.of("mock:outbound")).get();

    outbound.expectedMessageCount(1);
    outbound.expectedBodiesReceived("test");

    inbound.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
项目:camel-cdi    文件:InjectedTypeConverterTest.java   
@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
                                 @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
    outbound.expectedMessageCount(1);

    TypeConverterInput input = new TypeConverterInput();
    input.setProperty("property value is [{{property1}}]");

    inbound.sendBody(input);

    assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
    assertThat(outbound.getExchanges().get(0).getIn().getBody(TypeConverterOutput.class).getProperty(), is(equalTo("property value is [value 1]")));
}
项目:camel-cdi    文件:ProduceTemplateTest.java   
@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate in,
                                 @Uri("mock:outbound") MockEndpoint out) throws InterruptedException {
    out.expectedMessageCount(1);
    out.expectedBodiesReceived("test-processed");

    in.sendBody("test");

    assertIsSatisfied(2L, TimeUnit.SECONDS, out);
}
项目:camel-cdi    文件:Application.java   
void hello(@Observes CamelContextStartedEvent event,
           // Configuration properties can be injected with @ConfigProperty
           @ConfigProperty(name = "message") String message,
           // Property placeholders in @Uri qualifier are also resolved
           @Uri("{{destination}}") ProducerTemplate producer) {
    producer.sendBody(message);
}
项目:camel-cdi    文件:PropertiesSampleTest.java   
@Test
public void testRouteMessage(@Uri("mock:outbound") MockEndpoint outbound) {
    assertThat("Exchange count is incorrect!",
        outbound.getExchanges(),
        hasSize(1));
    assertThat("Exchange body is incorrect!",
        outbound.getExchanges().get(0).getIn().getBody(String.class),
        is(equalTo("Hello")));
}
项目:camel-cdi    文件:XmlSampleTest.java   
@Test
@InSequence(1)
public void takeTheBluePill(@Uri("mock:matrix") MockEndpoint matrix) throws InterruptedException {
    matrix.expectedMessageCount(1);
    matrix.expectedBodiesReceived("Matrix » Take the blue pill!");

    prompt.sendBody(neo, "Take the blue pill!");

    assertIsSatisfied(2L, TimeUnit.SECONDS, matrix);
}
项目:camel-cdi    文件:XmlSampleTest.java   
@Test
@InSequence(2)
public void takeTheRedPill(@Uri("mock:zion") MockEndpoint zion) throws InterruptedException {
    zion.expectedMessageCount(1);
    zion.expectedHeaderReceived("location", "matrix");

    prompt.sendBody(neo, "Take the red pill!");

    assertIsSatisfied(2L, TimeUnit.SECONDS, zion);
}