Package org.mule.transformer.simple

Examples of org.mule.transformer.simple.StringAppendTransformer


    @Test
    public void testResponseAdaptorSingleMP() throws MuleException, Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        builder.chain(new StringAppendTransformer("1"), new ResponseMessageProcessorAdapter(
            new StringAppendTransformer("3")), new StringAppendTransformer("2"));
        assertEquals("0123", builder.build().process(getTestEventUsingFlow("0")).getMessageAsString());
    }
View Full Code Here


    @Test
    public void testResponseAdaptorSingleMPReturnsNull() throws MuleException, Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        builder.chain(new StringAppendTransformer("1"), new ResponseMessageProcessorAdapter(
            new ReturnNullMP()), new StringAppendTransformer("2"));
        assertEquals("012", builder.build().process(getTestEventUsingFlow("0")).getMessageAsString());
    }
View Full Code Here

    @Test
    public void testResponseAdaptorNestedChain() throws MuleException, Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        builder.chain(
            new StringAppendTransformer("1"),
            new ResponseMessageProcessorAdapter(new DefaultMessageProcessorChainBuilder().chain(
                new StringAppendTransformer("a"), new StringAppendTransformer("b")).build()),
            new StringAppendTransformer("2"));
        assertEquals("012ab", builder.build().process(getTestEventUsingFlow("0")).getMessageAsString());
    }
View Full Code Here

    @Test
    public void testResponseAdaptorNestedChainReturnsNull() throws MuleException, Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        builder.chain(
            new StringAppendTransformer("1"),
            new ResponseMessageProcessorAdapter(new DefaultMessageProcessorChainBuilder().chain(
                new StringAppendTransformer("a"), new StringAppendTransformer("b"), new ReturnNullMP())
                .build()), new StringAppendTransformer("2"));
        assertEquals("012", builder.build().process(getTestEventUsingFlow("0")).getMessageAsString());
    }
View Full Code Here

        assertEquals("", result.getPayload());
    }

    public void testEnrichHeaderNestedEvaluator() throws Exception
    {
        muleContext.getRegistry().registerObject("appender", new StringAppendTransformer(" append"));

        MessageEnricher enricher = new MessageEnricher();
        enricher.addEnrichExpressionPair(new EnrichExpressionPair("#[process:appender:#[header:header1]]",
            "#[header:myHeader]"));
        enricher.setEnrichmentMessageProcessor(new MessageProcessor()
View Full Code Here

    {
        AroundPolicy ap = new TestPolicy("test around policy");

        // this is our regular chain that should get a policy applied
        MessageProcessorChain chain = DefaultMessageProcessorChain.from(
                                                             new StringAppendTransformer("first"),
                                                             new StringAppendTransformer(" second"));
        initialiseObject(chain);

        // test registration
        assertEquals("No policies should have been registered.", 0, chain.getPolicies().list().size());
        chain.getPolicies().add(ap);
View Full Code Here

    public void testMultiplePolicies() throws Exception
    {

        // this is our regular chain that should get a policy applied
        MessageProcessorChain chain = DefaultMessageProcessorChain.from(
                                                            new StringAppendTransformer("first"),
                                                            new StringAppendTransformer(" second"));
        initialiseObject(chain);

        // test registration
        assertEquals("No policies should have been registered.", 0, chain.getPolicies().list().size());
        AroundPolicy policy1 = new TestPolicy("test around policy 1");
View Full Code Here

        }

        public MuleEvent invoke(PolicyInvocation invocation) throws MuleException
        {
            // mutates the event directly, thus we can safely ignore the return object
            new StringAppendTransformer("{before} ").process(invocation.getEvent());
            final MuleEvent result = invocation.proceed();
            //throw new DefaultMuleException("test");
            new StringAppendTransformer(" {after}").process(invocation.getEvent());
            return result;
        }
View Full Code Here

                event.getMessage().setPayload(Integer.valueOf(1));
                return event;
            }
        };

        FirstSuccessful fs = createFirstSuccessfulRouter(intSetter, new StringAppendTransformer("abc"));
        fs.setFailureExpression("#[payload-type:java.lang.Integer]");
        fs.initialise();

        assertEquals("abc", fs.process(getTestEvent("")).getMessageAsString());
    }
View Full Code Here

        assertEquals("http://vasya:pupkin@example.com:12345/foo/bar", result);
    }
   
    public void testNestedParsing() throws Exception
    {
        muleContext.getRegistry().registerObject("proc1", new StringAppendTransformer("c"));
        muleContext.getRegistry().registerObject("proc2", new StringAppendTransformer("e"));

        MuleEvent event = getTestEvent("b");
        RequestContext.setEvent(event);

        assertEquals("-1-abcde-2-", muleContext.getExpressionManager().parse(
View Full Code Here

TOP

Related Classes of org.mule.transformer.simple.StringAppendTransformer

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.