You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/08/07 09:34:04 UTC

git commit: CAMEL-6610 fix the IndexOutOfBoundsException when customized id of wireTap component

Updated Branches:
  refs/heads/master 0d17ff78e -> ed7e7c9fe


CAMEL-6610 fix the IndexOutOfBoundsException when customized id of wireTap component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ed7e7c9f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ed7e7c9f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ed7e7c9f

Branch: refs/heads/master
Commit: ed7e7c9feeb835fb1071b90276b1c009fed3b855
Parents: 0d17ff7
Author: Willem Jiang <ni...@apache.org>
Authored: Wed Aug 7 15:04:15 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Wed Aug 7 15:04:53 2013 +0800

----------------------------------------------------------------------
 .../org/apache/camel/model/ProcessorDefinition.java    |  8 +++++++-
 .../java/org/apache/camel/processor/WireTapTest.java   | 13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ed7e7c9f/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index ff16150..9b93a1a 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -1015,6 +1015,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
             // set id on this
             setId(id);
         } else {
+            
             // set it on last output as this is what the user means to do
             // for Block(s) with non empty getOutputs() the id probably refers
             //  to the last definition in the current Block
@@ -1027,7 +1028,12 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
                     }
                 }
             }
-            outputs.get(outputs.size() - 1).setId(id);
+            if (!getOutputs().isEmpty()) {
+                outputs.get(outputs.size() - 1).setId(id);
+            } else {
+                // the output could be empty
+                setId(id);
+            }
         }
 
         return (Type) this;

http://git-wip-us.apache.org/repos/asf/camel/blob/ed7e7c9f/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java b/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
index 266cd49..3c45d54 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
@@ -38,6 +38,16 @@ public class WireTapTest extends ContextTestSupport {
 
         assertMockEndpointsSatisfied();
     }
+    
+    public void testWireTapId() throws Exception {
+        MockEndpoint a = getMockEndpoint("mock:a");
+        MockEndpoint b = getMockEndpoint("mock:b");
+        a.expectedBodiesReceived("Hello");
+        b.expectedBodiesReceived("Hello");
+        
+        template.sendBody("direct:test", "Hello");
+        assertMockEndpointsSatisfied();
+    }
 
     @Override
     protected void setUp() throws Exception {
@@ -59,6 +69,9 @@ public class WireTapTest extends ContextTestSupport {
                 from("direct:tap")
                     .delay(1000).setBody().constant("Tapped")
                     .to("mock:result", "mock:tap");
+                
+                from("direct:test").wireTap("direct:a").id("wiretap_1").to("mock:a");
+                from("direct:a").to("mock:b");
             }
         };
     }


Re: git commit: CAMEL-6610 fix the IndexOutOfBoundsException when customized id of wireTap component

Posted by Willem jiang <wi...@gmail.com>.
Yes, you are right, I will commit a quick fix for it shortly.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, August 8, 2013 at 3:42 PM, Claus Ibsen wrote:

> Hi
>  
> Maybe this caused an unit test to fail in camel-spring now?
>  
> Tests in error:
> SpringWireTapTest>TestSupport.runBare:58->WireTapTest.testWireTapId:48
> » CamelExecution
>  
> Tests run: 972, Failures: 0, Errors: 1, Skipped: 1
>  
> On Wed, Aug 7, 2013 at 9:34 AM, <ningjiang@apache.org (mailto:ningjiang@apache.org) (mailto:ningjiang@apache.org)> wrote:
> > Updated Branches:
> > refs/heads/master 0d17ff78e -> ed7e7c9fe
> >  
> >  
> > CAMEL-6610 fix the IndexOutOfBoundsException when customized id of wireTap component
> >  
> >  
> > Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ed7e7c9f
> > Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ed7e7c9f
> > Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ed7e7c9f
> >  
> > Branch: refs/heads/master
> > Commit: ed7e7c9feeb835fb1071b90276b1c009fed3b855
> > Parents: 0d17ff7
> > Author: Willem Jiang <ningjiang@apache.org (mailto:ningjiang@apache.org) (mailto:ningjiang@apache.org)>
> > Authored: Wed Aug 7 15:04:15 2013 +0800
> > Committer: Willem Jiang <ningjiang@apache.org (mailto:ningjiang@apache.org) (mailto:ningjiang@apache.org)>
> > Committed: Wed Aug 7 15:04:53 2013 +0800
> >  
> > ----------------------------------------------------------------------
> > .../org/apache/camel/model/ProcessorDefinition.java | 8 +++++++-
> > .../java/org/apache/camel/processor/WireTapTest.java | 13 +++++++++++++
> > 2 files changed, 20 insertions(+), 1 deletion(-)
> > ----------------------------------------------------------------------
> >  
> >  
> > http://git-wip-us.apache.org/repos/asf/camel/blob/ed7e7c9f/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> > ----------------------------------------------------------------------
> > diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> > index ff16150..9b93a1a 100644
> > --- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> > +++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> > @@ -1015,6 +1015,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
> > // set id on this
> > setId(id);
> > } else {
> > +
> > // set it on last output as this is what the user means to do
> > // for Block(s) with non empty getOutputs() the id probably refers
> > // to the last definition in the current Block
> > @@ -1027,7 +1028,12 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
> > }
> > }
> > }
> > - outputs.get(outputs.size() - 1).setId(id);
> > + if (!getOutputs().isEmpty()) {
> > + outputs.get(outputs.size() - 1).setId(id);
> > + } else {
> > + // the output could be empty
> > + setId(id);
> > + }
> > }
> >  
> > return (Type) this;
> >  
> > http://git-wip-us.apache.org/repos/asf/camel/blob/ed7e7c9f/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> > ----------------------------------------------------------------------
> > diff --git a/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java b/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> > index 266cd49..3c45d54 100644
> > --- a/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> > +++ b/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> > @@ -38,6 +38,16 @@ public class WireTapTest extends ContextTestSupport {
> >  
> > assertMockEndpointsSatisfied();
> > }
> > +
> > + public void testWireTapId() throws Exception {
> > + MockEndpoint a = getMockEndpoint("mock:a");
> > + MockEndpoint b = getMockEndpoint("mock:b");
> > + a.expectedBodiesReceived("Hello");
> > + b.expectedBodiesReceived("Hello");
> > +
> > + template.sendBody("direct:test", "Hello");
> > + assertMockEndpointsSatisfied();
> > + }
> >  
> > @Override
> > protected void setUp() throws Exception {
> > @@ -59,6 +69,9 @@ public class WireTapTest extends ContextTestSupport {
> > from("direct:tap")
> > .delay(1000).setBody().constant("Tapped")
> > .to("mock:result", "mock:tap");
> > +
> > + from("direct:test").wireTap("direct:a").id("wiretap_1").to("mock:a");
> > + from("direct:a").to("mock:b");
> > }
> > };
> > }
> >  
>  
>  
>  
>  
>  
> --  
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com (mailto:cibsen@redhat.com) (mailto:cibsen@redhat.com)
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>  




Re: git commit: CAMEL-6610 fix the IndexOutOfBoundsException when customized id of wireTap component

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Maybe this caused an unit test to fail in camel-spring now?

Tests in error:
  SpringWireTapTest>TestSupport.runBare:58->WireTapTest.testWireTapId:48
» CamelExecution

Tests run: 972, Failures: 0, Errors: 1, Skipped: 1

On Wed, Aug 7, 2013 at 9:34 AM,  <ni...@apache.org> wrote:
> Updated Branches:
>   refs/heads/master 0d17ff78e -> ed7e7c9fe
>
>
> CAMEL-6610 fix the IndexOutOfBoundsException when customized id of wireTap component
>
>
> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ed7e7c9f
> Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ed7e7c9f
> Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ed7e7c9f
>
> Branch: refs/heads/master
> Commit: ed7e7c9feeb835fb1071b90276b1c009fed3b855
> Parents: 0d17ff7
> Author: Willem Jiang <ni...@apache.org>
> Authored: Wed Aug 7 15:04:15 2013 +0800
> Committer: Willem Jiang <ni...@apache.org>
> Committed: Wed Aug 7 15:04:53 2013 +0800
>
> ----------------------------------------------------------------------
>  .../org/apache/camel/model/ProcessorDefinition.java    |  8 +++++++-
>  .../java/org/apache/camel/processor/WireTapTest.java   | 13 +++++++++++++
>  2 files changed, 20 insertions(+), 1 deletion(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/camel/blob/ed7e7c9f/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> ----------------------------------------------------------------------
> diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> index ff16150..9b93a1a 100644
> --- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> +++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
> @@ -1015,6 +1015,7 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
>              // set id on this
>              setId(id);
>          } else {
> +
>              // set it on last output as this is what the user means to do
>              // for Block(s) with non empty getOutputs() the id probably refers
>              //  to the last definition in the current Block
> @@ -1027,7 +1028,12 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
>                      }
>                  }
>              }
> -            outputs.get(outputs.size() - 1).setId(id);
> +            if (!getOutputs().isEmpty()) {
> +                outputs.get(outputs.size() - 1).setId(id);
> +            } else {
> +                // the output could be empty
> +                setId(id);
> +            }
>          }
>
>          return (Type) this;
>
> http://git-wip-us.apache.org/repos/asf/camel/blob/ed7e7c9f/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> ----------------------------------------------------------------------
> diff --git a/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java b/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> index 266cd49..3c45d54 100644
> --- a/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> +++ b/camel-core/src/test/java/org/apache/camel/processor/WireTapTest.java
> @@ -38,6 +38,16 @@ public class WireTapTest extends ContextTestSupport {
>
>          assertMockEndpointsSatisfied();
>      }
> +
> +    public void testWireTapId() throws Exception {
> +        MockEndpoint a = getMockEndpoint("mock:a");
> +        MockEndpoint b = getMockEndpoint("mock:b");
> +        a.expectedBodiesReceived("Hello");
> +        b.expectedBodiesReceived("Hello");
> +
> +        template.sendBody("direct:test", "Hello");
> +        assertMockEndpointsSatisfied();
> +    }
>
>      @Override
>      protected void setUp() throws Exception {
> @@ -59,6 +69,9 @@ public class WireTapTest extends ContextTestSupport {
>                  from("direct:tap")
>                      .delay(1000).setBody().constant("Tapped")
>                      .to("mock:result", "mock:tap");
> +
> +                from("direct:test").wireTap("direct:a").id("wiretap_1").to("mock:a");
> +                from("direct:a").to("mock:b");
>              }
>          };
>      }
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen