Author: midon
Date: Wed May 27 21:40:05 2009
New Revision: 779320
URL: http://svn.apache.org/viewvc?rev=779320&view=rev
Log:
ode-613
Modified:
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
ode/trunk/axis2/src/main/wsdl/pmapi.wsdl
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
Modified:
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java?rev=779320&r1=779319&r2=779320&view=diff
==============================================================================
---
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
(original)
+++
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
Wed May 27 21:40:05 2009
@@ -30,6 +30,9 @@
import org.apache.ode.axis2.service.ServiceClientUtil;
import org.apache.ode.tools.sendsoap.cline.HttpSoapSender;
import org.apache.ode.utils.Namespaces;
+import org.apache.ode.il.OMUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.IteratorUtils;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -40,8 +43,9 @@
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Iterator;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertTrue;
public class InstanceManagementTest extends Axis2TestBase {
@@ -50,13 +54,26 @@
private ServiceClientUtil _client;
private String _deployedName;
+ private static int instanceNb(OMElement response){
+ return instances(response).size();
+ }
+
+ private static List<OMElement> instances(OMElement response){
+ return IteratorUtils.toList(OMUtils.getFirstChildWithName(response,
"instance-info-list").getChildrenWithName(new
QName(Namespaces.ODE_PMAPI_TYPES_NS, "instance-info")));
+ }
+
+ private static OMElement instance(OMElement response){
+ Iterator it = response.getChildrenWithName(new QName("",
"instance-info"));
+ return it.hasNext()? (OMElement) it.next(): null;
+ }
+
+
@Test
public void testListInstances() throws Exception {
OMElement listRoot = _client.buildMessage("listInstances", new
String[] {"filter", "order", "limit"},
new String[] {"name=DynPartnerMain", "", "10"});
OMElement result = sendToIM(listRoot);
- // Ensures that there's only 2 process-info string (ending and closing
tags) and hence only one process
- assert(result.toString().split("instance-info").length == 3);
+ assertTrue("Ensures that there's only one process instance",
instanceNb(result) ==1);
// Another query with more options
Calendar notSoLongAgo = Calendar.getInstance();
@@ -230,7 +247,7 @@
OMElement listRoot = _client.buildMessage("listProcesses", new
String[] {"filter", "orderKeys"},
new String[] {"name=DynPartnerMain", ""});
OMElement result = sendToPM(listRoot);
- assert(result.toString().indexOf("process-info") < 0);
+ assertTrue("No process expected",
result.toString().matches(".*<process-info-list\\s*/>.*"));
super.tearDown();
}
Modified: ode/trunk/axis2/src/main/wsdl/pmapi.wsdl
URL:
http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/wsdl/pmapi.wsdl?rev=779320&r1=779319&r2=779320&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/wsdl/pmapi.wsdl (original)
+++ ode/trunk/axis2/src/main/wsdl/pmapi.wsdl Wed May 27 21:40:05 2009
@@ -41,11 +41,6 @@
<xsd:element name="element" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
- <xsd:complexType name="iidsType">
- <xsd:all>
- <xsd:element name="iid" type="xsd:long"/>
- </xsd:all>
- </xsd:complexType>
<xsd:element name="ManagementFault" type="xsd:string"/>
</xsd:schema>
</types>
@@ -212,7 +207,7 @@
<part name="filter" type="xsd:string"/>
</message>
<message name="deleteOutput">
- <part name="iids" type="tns:iidsType"/>
+ <part name="list" type="tns:listType"/>
</message>
<message name="recoverActivityInput">
<part name="iid" type="xsd:long"/>
Modified:
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?rev=779320&r1=779319&r2=779320&view=diff
==============================================================================
---
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
(original)
+++
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
Wed May 27 21:40:05 2009
@@ -673,7 +673,7 @@
ProcessInstanceDAO instance = conn.getInstance(iid);
if (instance == null)
- throw new InstanceNotFoundException("" + iid);
+ throw new
InstanceNotFoundException("InstanceNotFoundException " + iid);
// TODO: deal with "ERROR" state information.
fillInstanceInfo(ii, instance);
return null;