Search in sources :

Example 1 with TypeConverterInput

use of org.apache.camel.cdi.pojo.TypeConverterInput in project camel by apache.

the class InjectedTypeConverterTest method convertWithTypeConverter.

@Test
public void convertWithTypeConverter(TypeConverter converter) throws NoTypeConversionAvailableException {
    TypeConverterInput input = new TypeConverterInput();
    input.setProperty("property value is [{{property2}}]");
    TypeConverterOutput output = converter.mandatoryConvertTo(TypeConverterOutput.class, input);
    assertThat(output.getProperty(), is(equalTo("property value is [value 2]")));
}
Also used : TypeConverterInput(org.apache.camel.cdi.pojo.TypeConverterInput) TypeConverterOutput(org.apache.camel.cdi.pojo.TypeConverterOutput) Test(org.junit.Test)

Example 2 with TypeConverterInput

use of org.apache.camel.cdi.pojo.TypeConverterInput in project camel by apache.

the class InjectedTypeConverterTest method sendMessageToInbound.

@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]")));
}
Also used : TypeConverterInput(org.apache.camel.cdi.pojo.TypeConverterInput) Test(org.junit.Test)

Aggregations

TypeConverterInput (org.apache.camel.cdi.pojo.TypeConverterInput)2 Test (org.junit.Test)2 TypeConverterOutput (org.apache.camel.cdi.pojo.TypeConverterOutput)1