[jira] Created: (CAMEL-676) intercept with predicate doesnt proceed as default

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
intercept with predicate doesnt proceed as default
--------------------------------------------------

                 Key: CAMEL-676
                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
             Project: Apache Camel
          Issue Type: Sub-task
          Components: camel-core
    Affects Versions: 1.4.0
            Reporter: Claus Ibsen
             Fix For: 1.4.0


If the intercept has a predicate it seems as if it doesn't proceed by default or the like.

{code}
    public void testInterceptor() throws Exception {
        MockEndpoint mockTest = getMockEndpoint("mock:test");
        mockTest.expectedBodiesReceived("Camel in Action");

        MockEndpoint mockOk = getMockEndpoint("mock:ok");
        mockOk.expectedBodiesReceived("Camel in Action");

        template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");

        mockTest.assertIsSatisfied();
        mockOk.assertIsSatisfied();
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                // TODO: enable this with predicate instead of the one below fails the unit test
                //intercept(header("user").isEqualTo("test")).to("mock:test");

                // this without predicate success
                intercept().to("mock:test");

                from("seda:order").to("mock:ok");
            }
        };
    }
{code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44030#action_44030 ]

Claus Ibsen commented on CAMEL-676:
-----------------------------------

Okay its the InterceptType#createProxy that has a flaw when there is a predicate it doesn't add the default proceed at the otherwise in the answer.

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44032#action_44032 ]

Claus Ibsen commented on CAMEL-676:
-----------------------------------

See failing unit test InterceptorPredicateProceedAndStopTest
method: testInterceptorWithPredicate

It has a TODO statement, so its easy to find in IDEA

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44033#action_44033 ]

Claus Ibsen commented on CAMEL-676:
-----------------------------------

*Without proceed:*
*dsl:* intercept(header("user").isEqualTo("test")).to("mock:test");
*answer:* Intercept[[Choice[ [When[ Expression[null] -> [org.apache.camel.model.ProceedType@1226a77]]] Otherwise[[To[mock:test]]]]]]

*With explicit proceed:*
*dsl:* intercept(header("user").isEqualTo("test")).to("mock:test").proceed();
*answer:* Intercept[[Choice[ [When[ Expression[null] -> [org.apache.camel.model.ProceedType@1226a77]]] Otherwise[[To[mock:test], org.apache.camel.model.ProceedType@1226a77]]]]]

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Claus Ibsen reassigned CAMEL-676:
---------------------------------

    Assignee: Claus Ibsen

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44034#action_44034 ]

Claus Ibsen commented on CAMEL-676:
-----------------------------------

Okay got it covered - I think.

In a route like this
{code}
intercept(header("foo").isEqualTo("bar")).to("mock:b").stop();
{code}

All messages that fails the predicate test (foo != bar) is now proceeded by default.
This is that if (foo == bar) then its routed to mock and stopped.

This is the most intuitive.

To stop all don't use a predicate.
{code}
intercept().to("mock:b").stop();
{code}

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Claus Ibsen resolved CAMEL-676.
-------------------------------

    Resolution: Fixed

Fixed in revision #674289

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-676) intercept with predicate doesnt proceed as default

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44037#action_44037 ]

Claus Ibsen commented on CAMEL-676:
-----------------------------------

See also
http://activemq.apache.org/camel/dsl.html

The section "Changes in Camel 1.4".

> intercept with predicate doesnt proceed as default
> --------------------------------------------------
>
>                 Key: CAMEL-676
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-676
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 1.4.0
>
>
> If the intercept has a predicate it seems as if it doesn't proceed by default or the like.
> {code}
>     public void testInterceptor() throws Exception {
>         MockEndpoint mockTest = getMockEndpoint("mock:test");
>         mockTest.expectedBodiesReceived("Camel in Action");
>         MockEndpoint mockOk = getMockEndpoint("mock:ok");
>         mockOk.expectedBodiesReceived("Camel in Action");
>         template.sendBodyAndHeader("seda:order", "Camel in Action", "user", "test");
>         mockTest.assertIsSatisfied();
>         mockOk.assertIsSatisfied();
>     }
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             public void configure() throws Exception {
>                 // TODO: enable this with predicate instead of the one below fails the unit test
>                 //intercept(header("user").isEqualTo("test")).to("mock:test");
>                 // this without predicate success
>                 intercept().to("mock:test");
>                 from("seda:order").to("mock:ok");
>             }
>         };
>     }
> {code}

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.