Java 类org.apache.camel.builder.Builder 实例源码

项目:Camel    文件:ValidationTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();

    validEndpoint = resolveMandatoryEndpoint("mock:valid", MockEndpoint.class);
    invalidEndpoint = resolveMandatoryEndpoint("mock:invalid", MockEndpoint.class);

    validEndpoint.whenAnyExchangeReceived(ProcessorBuilder.setBody(Builder.constant("validResult")));
    invalidEndpoint.whenAnyExchangeReceived(ProcessorBuilder.setBody(Builder.constant("invalidResult")));
}
项目:camel-c24io    文件:ValidationTest.java   
@Override
public void setUp() throws Exception {
    super.setUp();

    validEndpoint = getMockEndpoint("mock:valid");
    invalidEndpoint = getMockEndpoint("mock:invalid");

    validEndpoint.whenAnyExchangeReceived(ProcessorBuilder.setOutBody(Builder.constant("validResult")));
    invalidEndpoint.whenAnyExchangeReceived(ProcessorBuilder.setOutBody(Builder.constant("invalidResult")));
}
项目:rassyeyanie    文件:AbstractHeaderMatchingTransformer.java   
private Predicate buildPredicate(String header, List<String> values) {
    if (values.isEmpty()) {
        return BooleanPredicate.TRUE;
    } else {
        return Builder.header(header).in(values.toArray());
    }
}
项目:hacep    文件:CommandDTOTest.java   
@Test
public void testInputCommand() throws Exception {
    context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                    replaceFromWith("direct:test");
                    mockEndpoints("direct:execute-command");
                }
            }
    );
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:NOME_COMMAND")
                    .to("mock:results");
        }
    });

    String input = "{\n" +
            "  \"command\": \"NOME_COMMAND\",\n" +
            "  \"params\": [\n" +
            "    {\n" +
            "      \"key\": \"NOME_CHIAVE1\",\n" +
            "      \"value\": \"VALORE1\"\n" +
            "    },\n" +
            "    {\n" +
            "      \"key\": \"NOME_CHIAVE2\",\n" +
            "      \"value\": \"VALORE2\"\n" +
            "    }\n" +
            "  ]\n" +
            "}\n";

    context.start();

    getMockEndpoint("mock:direct:execute-command", false).expectedMessageCount(1);
    getMockEndpoint("mock:direct:execute-command", false)
            .message(0)
            .predicate(isInstanceOf(body(), Command.class))
            .predicate(isEqualTo(Builder.simple("${body.command}"), Builder.constant("NOME_COMMAND")))
            .predicate(isEqualTo(Builder.simple("${body.params?.size}"), Builder.constant(2)))
            .predicate(isInstanceOf(Builder.simple("${body.params[0]}"), KeyValueParam.class))
            .predicate(isEqualTo(Builder.simple("${body.params[0].key}"), Builder.constant("NOME_CHIAVE1")))
            .predicate(isEqualTo(Builder.simple("${body.params[0].value}"), Builder.constant("VALORE1")))
            .predicate(isInstanceOf(Builder.simple("${body.params[1]}"), KeyValueParam.class))
            .predicate(isEqualTo(Builder.simple("${body.params[1].key}"), Builder.constant("NOME_CHIAVE2")))
            .predicate(isEqualTo(Builder.simple("${body.params[1].value}"), Builder.constant("VALORE2")));

    getMockEndpoint("mock:results", false).expectedMessageCount(1);

    sendBody("direct:test", input);

    assertMockEndpointsSatisfied(1, TimeUnit.MINUTES);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given header
 */
public static ValueBuilder header(String name) {
    return Builder.header(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given exchange property
 */
public static ValueBuilder exchangeProperty(String name) {
    return Builder.exchangeProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound body on an exchange
 */
public static ValueBuilder body() {
    return Builder.body();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name) {
    return Builder.systemProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name, String defaultValue) {
    return Builder.systemProperty(name, defaultValue);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given header
 */
public static ValueBuilder header(String name) {
    return Builder.header(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given exchange property
 */
public static ValueBuilder exchangeProperty(String name) {
    return Builder.exchangeProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound body on an exchange
 */
public static ValueBuilder body() {
    return Builder.body();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name) {
    return Builder.systemProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name, String defaultValue) {
    return Builder.systemProperty(name, defaultValue);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given header
 */
public static ValueBuilder header(String name) {
    return Builder.header(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given property
 */
public static ValueBuilder property(String name) {
    return Builder.exchangeProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound body on an exchange
 */
public static ValueBuilder body() {
    return Builder.body();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name) {
    return Builder.systemProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name, String defaultValue) {
    return Builder.systemProperty(name, defaultValue);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given header
 */
public static ValueBuilder header(String name) {
    return Builder.header(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given exchange property
 */
public static ValueBuilder exchangeProperty(String name) {
    return Builder.exchangeProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound body on an exchange
 */
public static ValueBuilder body() {
    return Builder.body();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name) {
    return Builder.systemProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given system property
 */
public static ValueBuilder systemProperty(String name, String defaultValue) {
    return Builder.systemProperty(name, defaultValue);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given exchange property
 * 
 * @deprecated use {@link #exchangeProperty(String)}
 */
@Deprecated
public static ValueBuilder property(String name) {
    return Builder.exchangeProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound message body as a
 * specific type
 */
public static <T> ValueBuilder bodyAs(Class<T> type) {
    return Builder.bodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the outbound body on an
 * exchange
 * 
 * @deprecated use {@link #body()}
 */
@Deprecated
public static ValueBuilder outBody() {
    return Builder.outBody();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the outbound message body as a
 * specific type
 * 
 * @deprecated use {@link #bodyAs(Class)}
 */
@Deprecated
public static <T> ValueBuilder outBodyAs(Class<T> type) {
    return Builder.outBodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the fault body on an
 * exchange
 */
public static ValueBuilder faultBody() {
    return Builder.faultBody();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the fault message body as a
 * specific type
 * 
 * @deprecated use {@link #bodyAs(Class)}
 */
@Deprecated
public static <T> ValueBuilder faultBodyAs(Class<T> type) {
    return Builder.faultBodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a value builder for the given property
 * 
 * @deprecated use {@link #exchangeProperty(String)}
 */
@Deprecated
public static ValueBuilder property(String name) {
    return Builder.exchangeProperty(name);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound message body as a
 * specific type
 */
public static <T> ValueBuilder bodyAs(Class<T> type) {
    return Builder.bodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the outbound body on an
 * exchange
 *
 * @deprecated use {@link #body()}
 */
@Deprecated
public static ValueBuilder outBody() {
    return Builder.outBody();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the outbound message body as a
 * specific type
 *
 * @deprecated use {@link #bodyAs(Class)}
 */
@Deprecated
public static <T> ValueBuilder outBodyAs(Class<T> type) {
    return Builder.outBodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the fault body on an
 * exchange
 */
public static ValueBuilder faultBody() {
    return Builder.faultBody();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the fault message body as a
 * specific type
 *
 * @deprecated use {@link #bodyAs(Class)}
 */
@Deprecated
public static <T> ValueBuilder faultBodyAs(Class<T> type) {
    return Builder.faultBodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the inbound message body as a
 * specific type
 */
public static <T> ValueBuilder bodyAs(Class<T> type) {
    return Builder.bodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the outbound body on an
 * exchange
 */
public static ValueBuilder outBody() {
    return Builder.outBody();
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the outbound message body as a
 * specific type
 */
public static <T> ValueBuilder outBodyAs(Class<T> type) {
    return Builder.outBodyAs(type);
}
项目:Camel    文件:TestSupport.java   
/**
 * Returns a predicate and value builder for the fault body on an
 * exchange
 */
public static ValueBuilder faultBody() {
    return Builder.faultBody();
}