Repository: ode
Updated Branches:
  refs/heads/ode-1.3.x 85bb58585 -> a56446717


ODE-974: Identify process instance by iterating all the correlation sets and 
finding the intersecting instances during each iteration


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

Branch: refs/heads/ode-1.3.x
Commit: a56446717ff416c60ff1d53d91a0bb41f781f920
Parents: 85bb585
Author: sathwik <[email protected]>
Authored: Wed Feb 17 16:57:17 2016 +0530
Committer: sathwik <[email protected]>
Committed: Wed Feb 17 16:57:17 2016 +0530

----------------------------------------------------------------------
 .../CorrelationMultiScopeEarlyMessageTest.java  | 32 +++++++++++--
 .../1/TestCorrelationMultiScopeComplex.bpel     | 25 +++++-----
 ...stCorrelationMultiScopeComplexArtifacts.wsdl | 11 ++++-
 .../1/second_complete.soap                      | 29 ++++++++++++
 .../1/second_initiate.soap                      | 29 ++++++++++++
 .../1/second_receive2.soap                      | 29 ++++++++++++
 .../1/second_receive3.soap                      | 29 ++++++++++++
 .../1/third_complete.soap                       | 29 ++++++++++++
 .../1/third_initiate.soap                       | 29 ++++++++++++
 .../1/third_receive2.soap                       | 29 ++++++++++++
 .../1/third_receive3.soap                       | 29 ++++++++++++
 .../2/TestCorrelationMultiScopeComplex.bpel     | 25 +++++-----
 ...stCorrelationMultiScopeComplexArtifacts.wsdl | 11 ++++-
 .../org/apache/ode/bpel/engine/BpelProcess.java | 50 ++++++++++----------
 14 files changed, 328 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/java/org/apache/ode/axis2/correlation/CorrelationMultiScopeEarlyMessageTest.java
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/java/org/apache/ode/axis2/correlation/CorrelationMultiScopeEarlyMessageTest.java
 
b/axis2-war/src/test/java/org/apache/ode/axis2/correlation/CorrelationMultiScopeEarlyMessageTest.java
index 0dc6339..7fc5d04 100644
--- 
a/axis2-war/src/test/java/org/apache/ode/axis2/correlation/CorrelationMultiScopeEarlyMessageTest.java
+++ 
b/axis2-war/src/test/java/org/apache/ode/axis2/correlation/CorrelationMultiScopeEarlyMessageTest.java
@@ -49,29 +49,51 @@ public class CorrelationMultiScopeEarlyMessageTest extends 
Axis2TestBase impleme
             log.info("response from instance 1 {}",instance1Response);
             assertTrue(instance1Response.contains("iid"));
 
+            String instance2Response = 
server.sendRequestFile(endpoint,bundleName + "/1", "second_initiate.soap");
+            log.info("response from instance 2 {}",instance2Response);
+            assertTrue(instance2Response.contains("iid"));
+
+            String instance3Response = 
server.sendRequestFile(endpoint,bundleName + "/1", "third_initiate.soap");
+            log.info("response from instance 3 {}",instance3Response);
+            assertTrue(instance3Response.contains("iid"));
+
             //deploy version 2
             server.deployProcess(bundleName + "/2");
 
             //create and instance of version 2
-            String instance2Response = 
server.sendRequestFile(endpoint,bundleName + "/2", "initiate.soap");
-            log.info("response from instance 2 {}",instance2Response);
-            assertTrue(instance2Response.contains("iid"));
+            String instance4Response = 
server.sendRequestFile(endpoint,bundleName + "/2", "initiate.soap");
+            log.info("response from instance 4 {}",instance4Response);
+            assertTrue(instance4Response.contains("iid"));
 
-            //early message to instance of retired process version 1
+            //early messages to instance of retired process version 1
             server.sendRequestFile(endpoint,bundleName + "/1", 
"receive3.soap");
+            server.sendRequestFile(endpoint,bundleName + "/1", 
"second_receive3.soap");
+            server.sendRequestFile(endpoint,bundleName + "/1", 
"third_receive3.soap");
+
             //early message to instance of active process version 2
             server.sendRequestFile(endpoint,bundleName + "/2", 
"receive3.soap");
 
             server.sendRequestFile(endpoint,bundleName + "/1", 
"receive2.soap");
+            server.sendRequestFile(endpoint,bundleName + "/1", 
"second_receive2.soap");
+            server.sendRequestFile(endpoint,bundleName + "/1", 
"third_receive2.soap");
+
             server.sendRequestFile(endpoint,bundleName + "/2", 
"receive2.soap");
 
             instance1Response = server.sendRequestFile(endpoint,bundleName + 
"/1", "complete.soap");
             log.info("response from instance 1 {}",instance1Response);
             assertTrue(instance1Response.contains("iid"));
 
-            instance2Response = server.sendRequestFile(endpoint,bundleName + 
"/2", "complete.soap");
+            instance2Response = server.sendRequestFile(endpoint,bundleName + 
"/1", "second_complete.soap");
             log.info("response from instance 2 {}",instance2Response);
             assertTrue(instance2Response.contains("iid"));
+
+            instance3Response = server.sendRequestFile(endpoint,bundleName + 
"/1", "third_complete.soap");
+            log.info("response from instance 3 {}",instance3Response);
+            assertTrue(instance3Response.contains("iid"));
+
+            instance4Response = server.sendRequestFile(endpoint,bundleName + 
"/2", "complete.soap");
+            log.info("response from instance 4 {}",instance4Response);
+            assertTrue(instance4Response.contains("iid"));
         } finally {
             if (server.isDeployed(bundleName+"/1")) 
                 server.undeployProcess(bundleName + "/1");

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplex.bpel
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplex.bpel
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplex.bpel
index 39cf400..94d9075 100644
--- 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplex.bpel
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplex.bpel
@@ -54,13 +54,17 @@
             </bpel:variables>
             <bpel:correlationSets>
                 <bpel:correlationSet name="CorrSet1" 
properties="tns:corrProperty1"></bpel:correlationSet>
+                <bpel:correlationSet name="CorrSet2" 
properties="tns:corrProperty1 tns:corrProperty2"></bpel:correlationSet>
+                <bpel:correlationSet name="CorrSet3" 
properties="tns:corrProperty1 tns:corrProperty2 
tns:corrProperty3"></bpel:correlationSet>
             </bpel:correlationSets>
             <bpel:sequence name="ancestorSequence">
-                   <bpel:receive name="initiateRequest" partnerLink="client" 
operation="initiate" portType="tns:TestCorrelationMultiScopeComplexPort" 
variable="initiateRequest" createInstance="yes">
-                       <bpel:correlations>
-                           <bpel:correlation initiate="yes" 
set="CorrSet1"></bpel:correlation>
-                       </bpel:correlations>
-                   </bpel:receive>
+            <bpel:receive name="initiateRequest" partnerLink="client" 
operation="initiate" portType="tns:TestCorrelationMultiScopeComplexPort" 
variable="initiateRequest" createInstance="yes">
+                <bpel:correlations>
+                    <bpel:correlation initiate="yes" 
set="CorrSet1"></bpel:correlation>
+                    <bpel:correlation initiate="yes" 
set="CorrSet2"></bpel:correlation>
+                    <bpel:correlation initiate="yes" 
set="CorrSet3"></bpel:correlation>
+                </bpel:correlations>
+            </bpel:receive>
             <bpel:assign validate="no" name="AssignPID">
                 <bpel:copy>
                     <bpel:from><bpel:literal><tns:initiateResponse 
xmlns:tns="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
@@ -82,14 +86,12 @@
 
                 <bpel:scope name="grandParentScope">
                     <bpel:variables><bpel:variable name="receive2Request" 
messageType="tns:receive2Request"></bpel:variable></bpel:variables>
-                    <bpel:correlationSets>
-                        <bpel:correlationSet name="CorrSet2" 
properties="tns:corrProperty2"></bpel:correlationSet>
-                    </bpel:correlationSets>
                     <bpel:sequence name="grandParentSequence">
                         <bpel:receive name="receive2Request" 
partnerLink="client" operation="receive2" 
portType="tns:TestCorrelationMultiScopeComplexPort" variable="receive2Request">
                         <bpel:correlations>
                             <bpel:correlation initiate="no" 
set="CorrSet1"></bpel:correlation>
-                            <bpel:correlation initiate="yes" 
set="CorrSet2"></bpel:correlation>
+                            <bpel:correlation initiate="no" 
set="CorrSet2"></bpel:correlation>
+                            <bpel:correlation initiate="no" 
set="CorrSet3"></bpel:correlation>
                         </bpel:correlations>
                     </bpel:receive>
 
@@ -97,15 +99,12 @@
                             <bpel:variables>
                                 <bpel:variable name="receive3Request" 
messageType="tns:receive3Request"></bpel:variable>
                             </bpel:variables>
-                            <bpel:correlationSets>
-                                <bpel:correlationSet name="CorrSet3" 
properties="tns:corrProperty3"></bpel:correlationSet>
-                            </bpel:correlationSets>
                             <bpel:sequence name="parentSequence">
                                 <bpel:receive name="receive3Request" 
partnerLink="client" operation="receive3" 
portType="tns:TestCorrelationMultiScopeComplexPort" variable="receive3Request">
                                     <bpel:correlations>
                                         <bpel:correlation initiate="no" 
set="CorrSet1"></bpel:correlation>
                                         <bpel:correlation initiate="no" 
set="CorrSet2"></bpel:correlation>
-                                        <bpel:correlation initiate="yes" 
set="CorrSet3"></bpel:correlation>
+                                        <bpel:correlation initiate="no" 
set="CorrSet3"></bpel:correlation>
                                     </bpel:correlations>
                                 </bpel:receive>
 

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplexArtifacts.wsdl
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplexArtifacts.wsdl
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplexArtifacts.wsdl
index 3abae1a..14f6575 100644
--- 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplexArtifacts.wsdl
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/TestCorrelationMultiScopeComplexArtifacts.wsdl
@@ -43,6 +43,9 @@
   </vprop:propertyAlias>
 
   <vprop:property name="corrProperty2" type="p:string"/>
+  <vprop:propertyAlias messageType="tns:initiateRequest" part="parameters" 
propertyName="tns:corrProperty2">
+    <vprop:query><![CDATA[/corr2]]></vprop:query>
+  </vprop:propertyAlias>
   <vprop:propertyAlias messageType="tns:receive2Request" part="parameters" 
propertyName="tns:corrProperty2">
     <vprop:query><![CDATA[/corr2]]></vprop:query>
   </vprop:propertyAlias>
@@ -54,11 +57,17 @@
   </vprop:propertyAlias>
   
   <vprop:property name="corrProperty3" type="p:string"/>
-  <vprop:propertyAlias messageType="tns:completeRequest" part="parameters" 
propertyName="tns:corrProperty3">
+  <vprop:propertyAlias messageType="tns:initiateRequest" part="parameters" 
propertyName="tns:corrProperty3">
+    <vprop:query><![CDATA[/corr3]]></vprop:query>
+  </vprop:propertyAlias>
+  <vprop:propertyAlias messageType="tns:receive2Request" part="parameters" 
propertyName="tns:corrProperty3">
     <vprop:query><![CDATA[/corr3]]></vprop:query>
   </vprop:propertyAlias>
   <vprop:propertyAlias messageType="tns:receive3Request" part="parameters" 
propertyName="tns:corrProperty3">
     <vprop:query><![CDATA[/corr3]]></vprop:query>
+</vprop:propertyAlias>
+  <vprop:propertyAlias messageType="tns:completeRequest" part="parameters" 
propertyName="tns:corrProperty3">
+    <vprop:query><![CDATA[/corr3]]></vprop:query>
   </vprop:propertyAlias>
   
     <types>

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_complete.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_complete.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_complete.soap
new file mode 100644
index 0000000..c0e9ff1
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_complete.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:complete>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>C</corr3>
+      </tes:complete>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_initiate.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_initiate.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_initiate.soap
new file mode 100644
index 0000000..3928e02
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_initiate.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:initiate>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>C</corr3>
+      </tes:initiate>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive2.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive2.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive2.soap
new file mode 100644
index 0000000..b0cbd36
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive2.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:receive2>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>C</corr3>
+      </tes:receive2>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive3.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive3.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive3.soap
new file mode 100644
index 0000000..4976aa6
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/second_receive3.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:receive3>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>C</corr3>
+      </tes:receive3>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_complete.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_complete.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_complete.soap
new file mode 100644
index 0000000..c6ee9fa
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_complete.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:complete>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>E</corr3>
+      </tes:complete>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_initiate.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_initiate.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_initiate.soap
new file mode 100644
index 0000000..f1c5dfe
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_initiate.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:initiate>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>E</corr3>
+      </tes:initiate>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive2.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive2.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive2.soap
new file mode 100644
index 0000000..cc55b6e
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive2.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:receive2>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>E</corr3>
+      </tes:receive2>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive3.soap
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive3.soap
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive3.soap
new file mode 100644
index 0000000..d5e1c6b
--- /dev/null
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/1/third_receive3.soap
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ 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.
+  -->
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:tes="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>
+   <soapenv:Header/>
+   <soapenv:Body>
+      <tes:receive3>
+         <corr1>A</corr1>
+         <corr2>D</corr2>
+         <corr3>E</corr3>
+      </tes:receive3>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplex.bpel
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplex.bpel
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplex.bpel
index 39cf400..94d9075 100644
--- 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplex.bpel
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplex.bpel
@@ -54,13 +54,17 @@
             </bpel:variables>
             <bpel:correlationSets>
                 <bpel:correlationSet name="CorrSet1" 
properties="tns:corrProperty1"></bpel:correlationSet>
+                <bpel:correlationSet name="CorrSet2" 
properties="tns:corrProperty1 tns:corrProperty2"></bpel:correlationSet>
+                <bpel:correlationSet name="CorrSet3" 
properties="tns:corrProperty1 tns:corrProperty2 
tns:corrProperty3"></bpel:correlationSet>
             </bpel:correlationSets>
             <bpel:sequence name="ancestorSequence">
-                   <bpel:receive name="initiateRequest" partnerLink="client" 
operation="initiate" portType="tns:TestCorrelationMultiScopeComplexPort" 
variable="initiateRequest" createInstance="yes">
-                       <bpel:correlations>
-                           <bpel:correlation initiate="yes" 
set="CorrSet1"></bpel:correlation>
-                       </bpel:correlations>
-                   </bpel:receive>
+            <bpel:receive name="initiateRequest" partnerLink="client" 
operation="initiate" portType="tns:TestCorrelationMultiScopeComplexPort" 
variable="initiateRequest" createInstance="yes">
+                <bpel:correlations>
+                    <bpel:correlation initiate="yes" 
set="CorrSet1"></bpel:correlation>
+                    <bpel:correlation initiate="yes" 
set="CorrSet2"></bpel:correlation>
+                    <bpel:correlation initiate="yes" 
set="CorrSet3"></bpel:correlation>
+                </bpel:correlations>
+            </bpel:receive>
             <bpel:assign validate="no" name="AssignPID">
                 <bpel:copy>
                     <bpel:from><bpel:literal><tns:initiateResponse 
xmlns:tns="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
@@ -82,14 +86,12 @@
 
                 <bpel:scope name="grandParentScope">
                     <bpel:variables><bpel:variable name="receive2Request" 
messageType="tns:receive2Request"></bpel:variable></bpel:variables>
-                    <bpel:correlationSets>
-                        <bpel:correlationSet name="CorrSet2" 
properties="tns:corrProperty2"></bpel:correlationSet>
-                    </bpel:correlationSets>
                     <bpel:sequence name="grandParentSequence">
                         <bpel:receive name="receive2Request" 
partnerLink="client" operation="receive2" 
portType="tns:TestCorrelationMultiScopeComplexPort" variable="receive2Request">
                         <bpel:correlations>
                             <bpel:correlation initiate="no" 
set="CorrSet1"></bpel:correlation>
-                            <bpel:correlation initiate="yes" 
set="CorrSet2"></bpel:correlation>
+                            <bpel:correlation initiate="no" 
set="CorrSet2"></bpel:correlation>
+                            <bpel:correlation initiate="no" 
set="CorrSet3"></bpel:correlation>
                         </bpel:correlations>
                     </bpel:receive>
 
@@ -97,15 +99,12 @@
                             <bpel:variables>
                                 <bpel:variable name="receive3Request" 
messageType="tns:receive3Request"></bpel:variable>
                             </bpel:variables>
-                            <bpel:correlationSets>
-                                <bpel:correlationSet name="CorrSet3" 
properties="tns:corrProperty3"></bpel:correlationSet>
-                            </bpel:correlationSets>
                             <bpel:sequence name="parentSequence">
                                 <bpel:receive name="receive3Request" 
partnerLink="client" operation="receive3" 
portType="tns:TestCorrelationMultiScopeComplexPort" variable="receive3Request">
                                     <bpel:correlations>
                                         <bpel:correlation initiate="no" 
set="CorrSet1"></bpel:correlation>
                                         <bpel:correlation initiate="no" 
set="CorrSet2"></bpel:correlation>
-                                        <bpel:correlation initiate="yes" 
set="CorrSet3"></bpel:correlation>
+                                        <bpel:correlation initiate="no" 
set="CorrSet3"></bpel:correlation>
                                     </bpel:correlations>
                                 </bpel:receive>
 

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplexArtifacts.wsdl
----------------------------------------------------------------------
diff --git 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplexArtifacts.wsdl
 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplexArtifacts.wsdl
index 3abae1a..9c2af44 100644
--- 
a/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplexArtifacts.wsdl
+++ 
b/axis2-war/src/test/resources/TestCorrelationMultiScopeComplex/2/TestCorrelationMultiScopeComplexArtifacts.wsdl
@@ -43,6 +43,9 @@
   </vprop:propertyAlias>
 
   <vprop:property name="corrProperty2" type="p:string"/>
+  <vprop:propertyAlias messageType="tns:initiateRequest" part="parameters" 
propertyName="tns:corrProperty2">
+    <vprop:query><![CDATA[/corr2]]></vprop:query>
+  </vprop:propertyAlias>
   <vprop:propertyAlias messageType="tns:receive2Request" part="parameters" 
propertyName="tns:corrProperty2">
     <vprop:query><![CDATA[/corr2]]></vprop:query>
   </vprop:propertyAlias>
@@ -54,12 +57,18 @@
   </vprop:propertyAlias>
   
   <vprop:property name="corrProperty3" type="p:string"/>
-  <vprop:propertyAlias messageType="tns:completeRequest" part="parameters" 
propertyName="tns:corrProperty3">
+  <vprop:propertyAlias messageType="tns:initiateRequest" part="parameters" 
propertyName="tns:corrProperty3">
+    <vprop:query><![CDATA[/corr3]]></vprop:query>
+  </vprop:propertyAlias>
+  <vprop:propertyAlias messageType="tns:receive2Request" part="parameters" 
propertyName="tns:corrProperty3">
     <vprop:query><![CDATA[/corr3]]></vprop:query>
   </vprop:propertyAlias>
   <vprop:propertyAlias messageType="tns:receive3Request" part="parameters" 
propertyName="tns:corrProperty3">
     <vprop:query><![CDATA[/corr3]]></vprop:query>
   </vprop:propertyAlias>
+  <vprop:propertyAlias messageType="tns:completeRequest" part="parameters" 
propertyName="tns:corrProperty3">
+    <vprop:query><![CDATA[/corr3]]></vprop:query>
+  </vprop:propertyAlias>
   
     <types>
                <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
targetNamespace="http://ode/bpel/unit-test/TestCorrelationMultiScopeComplex";>

http://git-wip-us.apache.org/repos/asf/ode/blob/a5644671/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
----------------------------------------------------------------------
diff --git 
a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java 
b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
index 1a7ca92..92aad6f 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
@@ -26,6 +26,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -39,7 +40,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.ode.agents.memory.SizingAgent;
 import org.apache.ode.bpel.common.CorrelationKey;
-import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.common.ProcessState;
 import org.apache.ode.bpel.dao.BpelDAOConnection;
@@ -290,6 +290,7 @@ public class BpelProcess {
         boolean routed = false;
         boolean enqueue = true;
         List<PartnerLinkMyRoleImpl.RoutingInfo> routings = null;
+        LinkedHashSet<ProcessInstanceDAO> intersectionInstanceSet = new 
LinkedHashSet<ProcessInstanceDAO>();
 
         /* try to find the active instance that is waiting on the correlated 
value and then associate the corresponding
          * processDAO,correlator on the mex and enqueue for later processing.
@@ -308,36 +309,35 @@ public class BpelProcess {
 
                 if (routing != null) {
 
-                    for( Iterator<CorrelationKeySet> aSubSetItr = 
routing.wholeKeySet.findSubSets().iterator();
-                            (aSubSetItr.hasNext() && !routed);) {
+                    for( Iterator<CorrelationKey> keyItr = 
routing.wholeKeySet.iterator();
+                            (keyItr.hasNext() && !routed);) {
 
-                        CorrelationKeySet aSubSet = aSubSetItr.next();
+                        CorrelationKey key = keyItr.next();
+                        __log.info("noRoutingMatch: Finding active instance 
correlated with {} and process pid {}",key,_pid);
 
-                        for(Iterator<CorrelationKey> keyItr = 
aSubSet.iterator();
-                                (keyItr.hasNext() && !routed);) {
+                        // We need to make sure the PID of process of the 
instance is same as that of the
+                        // partnerlink's associated process in the iteration. 
Otherwise we might end up
+                        // associating wrong correlator with the mex.
+                        Collection<ProcessInstanceDAO> instanceDaoList = 
getProcessDAO().findInstance(key,ProcessState.STATE_ACTIVE);
 
-                            CorrelationKey key = keyItr.next();
-                            __log.info("noRoutingMatch: Finding active 
instance correlated with {} and process pid {}",new Object[]{key,_pid});
+                        if (!(instanceDaoList.isEmpty())) {
+                            //find the intersection
+                            if(!intersectionInstanceSet.isEmpty())
+                                
intersectionInstanceSet.retainAll(instanceDaoList);
+                            else
+                                
intersectionInstanceSet.addAll(instanceDaoList);
 
-                            // Assumption is, process instance is uniquely 
identifiable by any single initiated correlation key across multiple versions
-                            // of a same process type.
-
-                            // We need to make sure the PID of process of the 
instance is same as that of the
-                            // partnerlink's associated process in the 
iteration. Otherwise we might end up
-                            // associating wrong correlator with the mex.
-                            Collection<ProcessInstanceDAO> instanceDaoList = 
getProcessDAO().findInstance(key,ProcessState.STATE_ACTIVE);
-
-                            if (!instanceDaoList.isEmpty()) {
-                                ProcessInstanceDAO instance = 
instanceDaoList.iterator().next();
-                                mex.getDAO().setProcess(instance.getProcess());
-                                target.noRoutingMatch(mex, routing);
-                                routed = true;
+                            __log.debug("noRoutingMatch: intersection Instance 
set : {} ",intersectionInstanceSet);
+                        }
+                    }
 
-                                __log.info("noRoutingMatch: Active instance 
found instanceID: {} correlated with {} and process pid {}",
-                                        new 
Object[]{instance.getInstanceId(),key,_pid});
+                    if(!(intersectionInstanceSet.isEmpty())) {
+                        ProcessInstanceDAO instance = 
intersectionInstanceSet.iterator().next();
+                        mex.getDAO().setProcess(instance.getProcess());
+                        target.noRoutingMatch(mex, routing);
+                        routed = true;
 
-                            }
-                        }
+                        __log.info("noRoutingMatch: Active instance found 
instanceID: {} and process pid {}",instance.getInstanceId(),_pid);
                     }
                 }
             }

Reply via email to