Updated Branches: refs/heads/ode-1.3.6.x 74d7ffb76 -> 56bb4f759
closing ODE-454, kudos to Shammy Chen for the detailed report. Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/aa3f72bb Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/aa3f72bb Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/aa3f72bb Branch: refs/heads/ode-1.3.6.x Commit: aa3f72bb5d1828cc9e76512301de0ac2f03ab8d5 Parents: 9735d01 Author: Tammo van Lessen <[email protected]> Authored: Tue Aug 27 18:47:55 2013 +0200 Committer: Tammo van Lessen <[email protected]> Committed: Tue Aug 27 18:47:55 2013 +0200 ---------------------------------------------------------------------- .../ode/bpel/compiler/ForEachGenerator.java | 4 +- .../bpel/compiler/bom/BpelObjectFactory.java | 4 ++ .../apache/ode/bpel/compiler/bom/Branches.java | 44 ++++++++++++++++++++ .../bpel/compiler/bom/CompletionCondition.java | 4 ++ .../ode/bpel/compiler_2_0/GoodCompileTest.java | 3 ++ .../2.0/good/foreach/ForEach3-2.0.bpel | 2 +- 6 files changed, 58 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/aa3f72bb/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java index d661940..d672899 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ForEachGenerator.java @@ -58,8 +58,8 @@ public class ForEachGenerator extends DefaultActivityGenerator { oforEach.completionCondition = new OForEach.CompletionCondition(_context.getOProcess()); oforEach.completionCondition.successfulBranchesOnly - = forEach.getCompletionCondition().isSuccessfulBranchesOnly(); - oforEach.completionCondition.branchCount = _context.compileExpr(forEach.getCompletionCondition()); + = forEach.getCompletionCondition().getBranch().isSuccessfulBranchesOnly(); + oforEach.completionCondition.branchCount = _context.compileExpr(forEach.getCompletionCondition().getBranch()); } // ForEach 'adds' a counter variable in inner scope http://git-wip-us.apache.org/repos/asf/ode/blob/aa3f72bb/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java index cf9120f..1732f00 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java @@ -74,6 +74,8 @@ public class BpelObjectFactory { _mappings.put(Bpel20QNames.FINAL_PICK, PickActivity.class); _mappings.put(Bpel20QNames.FINAL_SCOPE, ScopeActivity.class); _mappings.put(Bpel20QNames.FINAL_FOREACH, ForEachActivity.class); + _mappings.put(Bpel20QNames.FINAL_COMPLETION_CONDITION, CompletionCondition.class); + _mappings.put(Bpel20QNames.FINAL_BRANCHES, Branches.class); _mappings.put(Bpel20QNames.FINAL_COPY, Copy.class); _mappings.put(Bpel20QNames.FINAL_CATCH, Catch.class); _mappings.put(Bpel20QNames.FINAL_CATCHALL, Catch.class); @@ -155,6 +157,8 @@ public class BpelObjectFactory { _mappings.put(Bpel20QNames.FROM, From.class); _mappings.put(Bpel20QNames.START_COUNTER_VALUE, Expression.class); _mappings.put(Bpel20QNames.FINAL_COUNTER_VALUE, Expression.class); + _mappings.put(Bpel20QNames.COMPLETION_CONDITION, CompletionCondition.class); + _mappings.put(Bpel20QNames.BRANCHES, Branches.class); _mappings.put(Bpel20QNames.CORRELATION, Correlation.class); _mappings.put(Bpel20QNames.CORRELATIONSET, CorrelationSet.class); _mappings.put(Bpel20QNames.COMPENSATE, CompensateScopeActivity.class); http://git-wip-us.apache.org/repos/asf/ode/blob/aa3f72bb/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Branches.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Branches.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Branches.java new file mode 100644 index 0000000..7e175ad --- /dev/null +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Branches.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ode.bpel.compiler.bom; + +import org.w3c.dom.Element; + +/** + * Interface for a <code><branches></code> as used in a + * forEach activity. + */ +public class Branches extends Expression { + + public Branches(Element el) { + super(el); + } + + /** + * Gets whether the completion count should include all terminated children + * or only successfully completed ones. + * + * @return counts completed + */ + public boolean isSuccessfulBranchesOnly() { + return getAttribute("successfulBranchesOnly", "no").equals("yes"); + } + +} http://git-wip-us.apache.org/repos/asf/ode/blob/aa3f72bb/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/CompletionCondition.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/CompletionCondition.java b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/CompletionCondition.java index d68da07..d50d2bd 100644 --- a/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/CompletionCondition.java +++ b/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/CompletionCondition.java @@ -40,4 +40,8 @@ public class CompletionCondition extends Expression { public boolean isSuccessfulBranchesOnly() { return getAttribute("successfulBranchesOnly", "no").equals("yes"); } + + public Branches getBranch() { + return (Branches) getFirstChild(Branches.class); + } } http://git-wip-us.apache.org/repos/asf/ode/blob/aa3f72bb/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java ---------------------------------------------------------------------- diff --git a/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java b/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java index 7a4060f..d55a59b 100644 --- a/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java +++ b/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java @@ -46,6 +46,9 @@ public class GoodCompileTest extends TestCase { suite.addTest(new GoodCompileTCase("/2.0/good/flow/flow5-2.0.bpel")); suite.addTest(new GoodCompileTCase("/2.0/good/flow/flow6-2.0.bpel")); suite.addTest(new GoodCompileTCase("/2.0/good/flow/flow7-2.0.bpel")); + suite.addTest(new GoodCompileTCase("/2.0/good/foreach/Foreach1-2.0.bpel")); + suite.addTest(new GoodCompileTCase("/2.0/good/foreach/Foreach2-2.0.bpel")); + suite.addTest(new GoodCompileTCase("/2.0/good/foreach/Foreach3-2.0.bpel")); suite.addTest(new GoodCompileTCase("/2.0/good/if/If1-2.0.bpel")); suite.addTest(new GoodCompileTCase("/2.0/good/if/If2-2.0.bpel")); suite.addTest(new GoodCompileTCase("/2.0/good/if/If3-2.0.bpel")); http://git-wip-us.apache.org/repos/asf/ode/blob/aa3f72bb/bpel-scripts/src/main/resources/2.0/good/foreach/ForEach3-2.0.bpel ---------------------------------------------------------------------- diff --git a/bpel-scripts/src/main/resources/2.0/good/foreach/ForEach3-2.0.bpel b/bpel-scripts/src/main/resources/2.0/good/foreach/ForEach3-2.0.bpel index 2ff63d5..4f84b46 100644 --- a/bpel-scripts/src/main/resources/2.0/good/foreach/ForEach3-2.0.bpel +++ b/bpel-scripts/src/main/resources/2.0/good/foreach/ForEach3-2.0.bpel @@ -50,7 +50,7 @@ <startCounterValue>0</startCounterValue> <finalCounterValue>10</finalCounterValue> <completionCondition> - <branches>5</branches> + <branches successfulBranchesOnly="yes">5</branches> </completionCondition> <scope name="sc1">
