Package org.mule.transformer.builder

Examples of org.mule.transformer.builder.MockConverterBuilder


    }

    @Test
    public void filtersSameWeight() throws ResolverException
    {
        Converter xmlToInputStream = new MockConverterBuilder().named("xmlToInputStream").from(XML_DATA_TYPE).to(INPUT_STREAM_DATA_TYPE).weighting(1).build();
        Converter xmlToString = new MockConverterBuilder().named("xmlToString").from(XML_DATA_TYPE).to(STRING_DATA_TYPE).weighting(1).build();

        List<Converter> availableConverters = new ArrayList<Converter>();
        availableConverters.add(xmlToInputStream);
        availableConverters.add(xmlToString);
View Full Code Here


    }

    @Test
    public void filtersSameLengthDifferentWeightsAddingBetterTransformerFirst() throws ResolverException
    {
        Converter xmlToInputStream = new MockConverterBuilder().named("xmlToInputStream").from(XML_DATA_TYPE).to(INPUT_STREAM_DATA_TYPE).weighting(2).build();
        Converter xmlToString = new MockConverterBuilder().named("xmlToString").from(XML_DATA_TYPE).to(STRING_DATA_TYPE).weighting(1).build();

        List<Converter> availableConverters = new ArrayList<Converter>();
        availableConverters.add(xmlToInputStream);
        availableConverters.add(xmlToString);
View Full Code Here

    }

    @Test
    public void filtersSameLengthDifferentWeightsAddingBetterTransformerLast() throws ResolverException
    {
        Converter xmlToInputStream = new MockConverterBuilder().named("xmlToInputStream").from(XML_DATA_TYPE).to(INPUT_STREAM_DATA_TYPE).weighting(2).build();
        Converter xmlToString = new MockConverterBuilder().named("xmlToString").from(XML_DATA_TYPE).to(STRING_DATA_TYPE).weighting(1).build();

        List<Converter> availableConverters = new ArrayList<Converter>();
        availableConverters.add(xmlToString);
        availableConverters.add(xmlToInputStream);
View Full Code Here

    }

    @Test
    public void filtersEqualName() throws ResolverException
    {
        Converter xmlToString = new MockConverterBuilder().named("xmlToString").build();

        List<Converter> availableConverters = new ArrayList<Converter>();
        availableConverters.add(xmlToString);
        availableConverters.add(xmlToString);
View Full Code Here

    }

    @Test
    public void filtersDifferentNameWithBetterTransformerFist() throws ResolverException
    {
        Converter xmlToString = new MockConverterBuilder().named("xmlToString").build();
        Converter stringToJson = new MockConverterBuilder().named("stringToJson").build();

        List<Converter> availableConverters = new ArrayList<Converter>();
        availableConverters.add(stringToJson);
        availableConverters.add(xmlToString);
View Full Code Here

    }

    @Test
    public void filtersDifferentNameWithBetterTransformerLast() throws ResolverException
    {
        Converter xmlToString = new MockConverterBuilder().named("xmlToString").build();
        Converter stringToJson = new MockConverterBuilder().named("stringToJson").build();

        List<Converter> availableConverters = new ArrayList<Converter>();
        availableConverters.add(xmlToString);
        availableConverters.add(stringToJson);
View Full Code Here

    private GraphTransformerResolver graphResolver = new GraphTransformerResolver();

    @Test
    public void cachesResolvedTransformer() throws ResolverException
    {
        Converter xmlToJson = new MockConverterBuilder().from(XML_DATA_TYPE).to(JSON_DATA_TYPE).build();
        Converter inputStreamToXml = new MockConverterBuilder().from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();

        graphResolver.transformerChange(inputStreamToXml, TransformerResolver.RegistryAction.ADDED);
        graphResolver.transformerChange(xmlToJson, TransformerResolver.RegistryAction.ADDED);

        Transformer transformer1 = graphResolver.resolve(INPUT_STREAM_DATA_TYPE, JSON_DATA_TYPE);
View Full Code Here

    }

    @Test
    public void clearsCacheWhenAddsConverter() throws ResolverException
    {
        Converter xmlToJson = new MockConverterBuilder().named("xmlToJson").from(XML_DATA_TYPE).to(JSON_DATA_TYPE).build();
        Converter inputStreamToXml = new MockConverterBuilder().named("inputStreamToXml").from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();

        graphResolver.transformerChange(inputStreamToXml, TransformerResolver.RegistryAction.ADDED);
        graphResolver.transformerChange(xmlToJson, TransformerResolver.RegistryAction.ADDED);

        Transformer transformer1 = graphResolver.resolve(INPUT_STREAM_DATA_TYPE, JSON_DATA_TYPE);
        assertNotNull(transformer1);

        Converter xmlToString = new MockConverterBuilder().named("xmlToString").from(XML_DATA_TYPE).to(STRING_DATA_TYPE).build();
        graphResolver.transformerChange(xmlToString, TransformerResolver.RegistryAction.ADDED);

        Transformer transformer2 = graphResolver.resolve(INPUT_STREAM_DATA_TYPE, JSON_DATA_TYPE);
        assertNotSame(transformer1, transformer2);
    }
View Full Code Here

    }

    @Test
    public void ignoresAddedTransformer() throws ResolverException
    {
        Converter xmlToJson = new MockConverterBuilder().named("xmlToJson").from(XML_DATA_TYPE).to(JSON_DATA_TYPE).build();
        Converter inputStreamToXml = new MockConverterBuilder().named("inputStreamToXml").from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();

        graphResolver.transformerChange(inputStreamToXml, TransformerResolver.RegistryAction.ADDED);
        graphResolver.transformerChange(xmlToJson, TransformerResolver.RegistryAction.ADDED);

        Transformer transformer1 = graphResolver.resolve(INPUT_STREAM_DATA_TYPE, JSON_DATA_TYPE);
View Full Code Here

    }

    @Test
    public void ignoresRemovedTransformer() throws ResolverException
    {
        Converter xmlToJson = new MockConverterBuilder().named("xmlToJson").from(XML_DATA_TYPE).to(JSON_DATA_TYPE).build();
        Converter inputStreamToXml = new MockConverterBuilder().named("inputStreamToXml").from(INPUT_STREAM_DATA_TYPE).to(XML_DATA_TYPE).build();

        graphResolver.transformerChange(inputStreamToXml, TransformerResolver.RegistryAction.ADDED);
        graphResolver.transformerChange(xmlToJson, TransformerResolver.RegistryAction.ADDED);

        Transformer transformer1 = graphResolver.resolve(INPUT_STREAM_DATA_TYPE, JSON_DATA_TYPE);
View Full Code Here

TOP

Related Classes of org.mule.transformer.builder.MockConverterBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.