Package org.mule.transformer.builder

Examples of org.mule.transformer.builder.MockTransformerBuilder


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

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

        Transformer xmlToString = new MockTransformerBuilder().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);
        assertSame(transformer1, transformer2);
    }
View Full Code Here


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

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

        Transformer xmlToString = new MockTransformerBuilder().named("xmlToString").from(XML_DATA_TYPE).to(STRING_DATA_TYPE).build();
        graphResolver.transformerChange(xmlToString, TransformerResolver.RegistryAction.REMOVED);

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

    @Test
    public void failsTransformerIgnoringNonMatchingConverter() throws MuleException
    {
        // Transformer(B -> D) Converter(C->D), payload A: FAIL
        Transformer transformer1 = new MockTransformerBuilder().from(dataTypeB).to(dataTypeD).build();
        Transformer converter2 = new MockConverterBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new A(), muleContext);
        try
        {
View Full Code Here

    @Test
    public void appliesTransformerSkipsConverter() throws MuleException
    {
        // Transformer(B -> D) Converter(C->D), payload B: converts B->D, skips converter C->D, resulting output is of the expected type -> OK
        Transformer transformer1 = new MockTransformerBuilder().from(dataTypeB).to(dataTypeD).returning(new D()).build();
        Transformer converter2 = new MockConverterBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new B(), muleContext);
        message.applyTransformers(null, transformer1, converter2);
View Full Code Here

    @Test
    public void failsTransformerIgnoringMatchingConverter() throws MuleException
    {
        // Transformer(B -> D) Converter(C->D), payload C: FAIL
        Transformer transformer1 = new MockTransformerBuilder().from(dataTypeB).to(dataTypeD).build();
        Transformer converter2 = new MockConverterBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new C(), muleContext);
        try
        {
View Full Code Here

    @Test
    public void failsTransformerIgnoringMatchingConverterWhenOriginalPayloadMatchesExpectedOutputType() throws MuleException
    {
        // Transformer(B -> D) Converter(C->D), payload D: FAIL
        Transformer transformer1 = new MockTransformerBuilder().from(dataTypeB).to(dataTypeD).build();
        Transformer converter2 = new MockConverterBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new D(), muleContext);
        try
        {
View Full Code Here

    @Test
    public void skipsConverterFailsOnTransformer() throws MuleException
    {
        // Converter(B -> D) Transformer(C->D), payload A: FAIL
        Transformer converter1 = new MockConverterBuilder().from(dataTypeB).to(dataTypeD).build();
        Transformer transformer2 = new MockTransformerBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new A(), muleContext);

        try
        {
View Full Code Here

    @Test
    public void appliesConverterFailsOnTransformer() throws MuleException
    {
        // Converter(B -> D) Transformer(C->D), payload B: converts B-> D, cannot apply transformer -> FAIL
        Transformer converter1 = new MockConverterBuilder().from(dataTypeB).to(dataTypeD).returning(new D()).build();
        Transformer transformer2 = new MockTransformerBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new B(), muleContext);
        try
        {
            message.applyTransformers(null, converter1, transformer2);
View Full Code Here

    @Test
    public void skipsConverterAppliesTransformer() throws MuleException
    {
        // Converter(B -> D) Transformer(C->D), payload C: skips converter, transforms C to D -> OK
        Transformer converter1 = new MockConverterBuilder().from(dataTypeB).to(dataTypeD).build();
        Transformer transformer2 = new MockTransformerBuilder().from(dataTypeC).to(dataTypeD).returning(new D()).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new C(), muleContext);
        message.applyTransformers(null, converter1, transformer2);

        assertTrue(message.getPayload() instanceof D);
View Full Code Here

    @Test
    public void skipsConverterFailsOnTransformerWhenOriginalPayloadMatchesExpectedOutputType() throws MuleException
    {
        // Converter(B -> D) Transformer(C->D), payload D: FAIL
        Transformer converter1 = new MockConverterBuilder().from(dataTypeB).to(dataTypeD).build();
        Transformer transformer2 = new MockTransformerBuilder().from(dataTypeC).to(dataTypeD).build();

        DefaultMuleMessage message = new DefaultMuleMessage(new D(), muleContext);
        try
        {
            message.applyTransformers(null, converter1, transformer2);
View Full Code Here

TOP

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

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.