You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Sergey Zhemzhitsky (Updated) (JIRA)" <ji...@apache.org> on 2011/11/16 22:39:55 UTC

[jira] [Updated] (CAMEL-4690) Transformation with method expression is not reflected on the exchage.

     [ https://issues.apache.org/jira/browse/CAMEL-4690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Zhemzhitsky updated CAMEL-4690:
--------------------------------------

    Component/s: camel-core
    
> 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
>          Components: camel-core
>    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