camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Zhemzhitsky (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-4690) Transformation with method expression is not reflected on the exchage.
Date Wed, 16 Nov 2011 21:39:54 GMT
Transformation with method expression is not reflected on the exchage.
----------------------------------------------------------------------

                 Key: CAMEL-4690
                 URL: https://issues.apache.org/jira/browse/CAMEL-4690
             Project: Camel
          Issue Type: Bug
    Affects Versions: 2.8.0
            Reporter: Sergey Zhemzhitsky


When trying to transform an exchange by means of method expression, exchange modifications
are not reflected on it.

Unit test to reproduce:
{code}
package org.apache.camel.test;

import javax.naming.Context;

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class ChangeNotReflectedTest extends CamelTestSupport {

    public static class PropertySetter {
        public void change(Exchange exchange) {
            exchange.setProperty("SetProperty", "PropertyValue");
        }
    }

    @Test
    public void testComponent() throws Exception {
        RouteBuilder routes = new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .to("bean:propSetter")
                    .to("mock:result");
            }
        };

        context().addRoutes(routes);
        startCamelContext();

        getMockEndpoint("mock:result").expectedPropertyReceived("SetProperty", "PropertyValue");

        Exchange exchange = createExchangeWithBody("Hello World!");
        template().send("direct:start", exchange);

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testTransformer() throws Exception {
        RouteBuilder routes = new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .transform()
                        .method("propSetter")
                    .to("mock:result");
            }
        };

        context().addRoutes(routes);
        startCamelContext();

        getMockEndpoint("mock:result").expectedPropertyReceived("SetProperty", "PropertyValue");

        Exchange exchange = createExchangeWithBody("Hello World!");
        template().send("direct:start", exchange);

        assertMockEndpointsSatisfied();
    }

    @Override
    protected Context createJndiContext() throws Exception {
        Context context = super.createJndiContext();
        context.bind("propSetter", new PropertySetter());
        return context;
    }

    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }

}
{code}

_testTransformer_ test failes.
Expected behavior _testTransformer_ test passes successfully.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message