camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Zhemzhitsky (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-4690) Transformation with method expression is not reflected to the exchage.
Date Thu, 17 Nov 2011 03:58:51 GMT

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

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

    Description: 
When trying to transform an exchange by means of method expression, exchange modifications
are not reflected to 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.

  was:
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.

        Summary: Transformation with method expression is not reflected to the exchage.  (was:
Transformation with method expression is not reflected on the exchage.)
    
> Transformation with method expression is not reflected to 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 to 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