use of org.mule.runtime.core.internal.transformer.builder.MockConverterBuilder in project mule by mulesoft.
the class TransformationGraphLookupStrategyTestCase method compatibleConverterShouldBeReturnedEvenIfTargetDataTypeDoesNotExist.
@Test
public void compatibleConverterShouldBeReturnedEvenIfTargetDataTypeDoesNotExist() throws Exception {
Converter jsonToTextString = new MockConverterBuilder().named("jsonToTextString").from(JSON_STRING).to(TEXT_STRING).build();
graph.addConverter(jsonToTextString);
List<Converter> converters = lookupStrategyTransformation.lookupConverters(JSON_STRING, STRING);
assertThat(converters, hasSize(1));
assertThat(converters.get(0).getName(), is("jsonToTextString"));
}
use of org.mule.runtime.core.internal.transformer.builder.MockConverterBuilder in project mule by mulesoft.
the class TransformationGraphLookupStrategyTestCase method findsDirectTransformationWhileChangingGraph.
@Test
public void findsDirectTransformationWhileChangingGraph() throws Exception {
Converter inputStreamToXml = new MockConverterBuilder().from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();
graph.addConverter(inputStreamToXml);
List<Converter> converters = lookupStrategyTransformation.lookupConverters(INPUT_STREAM_DATA_TYPE, XML_DATA_TYPE);
assertThat(converters, hasSize(1));
assertThat(converters.get(0), is(inputStreamToXml));
}
use of org.mule.runtime.core.internal.transformer.builder.MockConverterBuilder in project mule by mulesoft.
the class TransformationGraphLookupStrategyTestCase method lookupTransformersNoSourceInGraph.
@Test
public void lookupTransformersNoSourceInGraph() throws Exception {
Converter inputStreamToXml = new MockConverterBuilder().from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();
graph.addConverter(inputStreamToXml);
List<Converter> converters = lookupStrategyTransformation.lookupConverters(JSON_DATA_TYPE, INPUT_STREAM_DATA_TYPE);
assertEquals(0, converters.size());
}
use of org.mule.runtime.core.internal.transformer.builder.MockConverterBuilder in project mule by mulesoft.
the class TransformationGraphLookupStrategyTestCase method compatibleConverterShouldBeReturnedEvenIfTSourceDataTypeDoesNotExist.
@Test
public void compatibleConverterShouldBeReturnedEvenIfTSourceDataTypeDoesNotExist() throws Exception {
Converter xmlToTextString = new MockConverterBuilder().named("textStringToXML").from(XML_DATA_TYPE).to(TEXT_STRING).build();
graph.addConverter(xmlToTextString);
List<Converter> converters = lookupStrategyTransformation.lookupConverters(XML_DATA_TYPE, STRING);
assertThat(converters, hasSize(1));
assertThat(converters.get(0).getName(), is("textStringToXML"));
}
use of org.mule.runtime.core.internal.transformer.builder.MockConverterBuilder in project mule by mulesoft.
the class TransformationGraphLookupStrategyTestCase method findsMultipleDirectTransformations.
@Test
public void findsMultipleDirectTransformations() throws Exception {
Converter inputStreamToXml = new MockConverterBuilder().from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();
graph.addConverter(inputStreamToXml);
Converter betterInputStreamToXml = new MockConverterBuilder().from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();
graph.addConverter(betterInputStreamToXml);
List<Converter> converters = lookupStrategyTransformation.lookupConverters(INPUT_STREAM_DATA_TYPE, XML_DATA_TYPE);
assertEquals(2, converters.size());
Assert.assertTrue(converters.contains(inputStreamToXml));
Assert.assertTrue(converters.contains(betterInputStreamToXml));
}
Aggregations