Author: assaf
Date: Wed Nov 15 18:05:24 2006
New Revision: 475526
URL: http://svn.apache.org/viewvc?view=rev&rev=475526
Log:
Added activity failure aggregate information to instance summary
Modified:
incubator/ode/trunk/bpel-api/src/main/xsd/pmapi.xsd
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessDAO.java
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
Modified: incubator/ode/trunk/bpel-api/src/main/xsd/pmapi.xsd
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/xsd/pmapi.xsd?view=diff&rev=475526&r1=475525&r2=475526
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/xsd/pmapi.xsd (original)
+++ incubator/ode/trunk/bpel-api/src/main/xsd/pmapi.xsd Wed Nov 15 18:05:24 2006
@@ -323,6 +323,7 @@
<attribute name="count" type="xs:int" use="required"/>
</complexType>
</element>
+ <element name="failures" type="pmapi:tFailuresInfo" minOccurs="0"/>
</sequence>
</complexType>
<complexType name="tScopeInfo">
@@ -426,37 +427,40 @@
completed.</documentation>
</annotation>
</element>
- <element name="failure" minOccurs="0">
- <complexType>
- <annotation>
- <documentation>Indicates activity is in the failure
state and requires recovery.</documentation>
- </annotation>
- <sequence>
- <element name="dt-failure" type="xs:dateTime">
- <annotation>
- <documentation>The date/time when failure
occurred.</documentation>
- </annotation>
- </element>
- <element name="retries" type="xs:int">
- <annotation>
- <documentation>Number of retries.</documentation>
- </annotation>
- </element>
- <element name="reason" type="xs:string">
- <annotation>
- <documentation>Reason for
failure.</documentation>
- </annotation>
- </element>
- <element name="actions" type="xs:string">
- <annotation>
- <documentation>Allowed recovery actions (space
separated list of action names).</documentation>
- </annotation>
- </element>
- </sequence>
- </complexType>
+ <element name="failure" type="pmapi:tFailureInfo" minOccurs="0">
+ <annotation>
+ <documentation>Indicates activity is in the failure state
and requires recovery.</documentation>
+ </annotation>
</element>
</sequence>
</complexType>
+ <complexType name="tFailureInfo">
+ <annotation>
+ <documentation>Indicates activity is in the failure state and
requires recovery.</documentation>
+ </annotation>
+ <sequence>
+ <element name="dt-failure" type="xs:dateTime">
+ <annotation>
+ <documentation>The date/time when failure
occurred.</documentation>
+ </annotation>
+ </element>
+ <element name="retries" type="xs:int">
+ <annotation>
+ <documentation>Number of retries.</documentation>
+ </annotation>
+ </element>
+ <element name="reason" type="xs:string">
+ <annotation>
+ <documentation>Reason for failure.</documentation>
+ </annotation>
+ </element>
+ <element name="actions" type="xs:string">
+ <annotation>
+ <documentation>Allowed recovery actions (space separated
list of action names).</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ </complexType>
<complexType name="tVariableInfo">
<annotation>
<documentation>Information about a variable (basically the value)
@@ -564,26 +568,7 @@
instance failed. </documentation>
</annotation>
</element>
- <element name="failures" minOccurs="0">
- <complexType>
- <annotation>
- <documentation>Indicates one or more activities are in
the failure
- state and require recovery.</documentation>
- </annotation>
- <sequence>
- <element name="dt-failure" type="xs:dateTime">
- <annotation>
- <documentation>Date/time of last
failure.</documentation>
- </annotation>
- </element>
- <element name="count" type="xs:int">
- <annotation>
- <documentation>Number of activities in failure
state.</documentation>
- </annotation>
- </element>
- </sequence>
- </complexType>
- </element>
+ <element name="failures" type="pmapi:tFailuresInfo" minOccurs="0"/>
<element name="myElement" type="string"/>
</sequence>
</complexType>
@@ -619,6 +604,24 @@
<any namespace="##other" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
+ </element>
+ </sequence>
+ </complexType>
+ <complexType name="tFailuresInfo">
+ <annotation>
+ <documentation>Indicates one or more activities are in the failure
+ state and require recovery.</documentation>
+ </annotation>
+ <sequence>
+ <element name="dt-failure" type="xs:dateTime">
+ <annotation>
+ <documentation>Date/time of last failure.</documentation>
+ </annotation>
+ </element>
+ <element name="count" type="xs:int">
+ <annotation>
+ <documentation>Number of activities in failure
state.</documentation>
+ </annotation>
</element>
</sequence>
</complexType>
Modified:
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessDAO.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessDAO.java?view=diff&rev=475526&r1=475525&r2=475526
==============================================================================
---
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessDAO.java
(original)
+++
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessDAO.java
Wed Nov 15 18:05:24 2006
@@ -22,7 +22,7 @@
import javax.xml.namespace.QName;
import java.util.Collection;
-
+import java.util.Date;
/**
* BPEL process data access objects. Contains references to active process
@@ -100,5 +100,5 @@
void addCorrelator(String correlator);
- int getNumInstances();
+ int getNumInstances();
}
Modified:
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java?view=diff&rev=475526&r1=475525&r2=475526
==============================================================================
---
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java
(original)
+++
incubator/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ProcessInstanceDAO.java
Wed Nov 15 18:05:24 2006
@@ -36,223 +36,222 @@
*/
public interface ProcessInstanceDAO {
- /**
- * Get the time when the process instance was created.
- * @return time of instance creation
- */
- public Date getCreateTime();
-
- /**
- * Get the time when the process instance was last active (re-hydrated).
- * @return time of activity
- */
- public Date getLastActiveTime();
-
- /**
- * Set last activity time for the process instance
- * @param dt tiem of activity
- */
- void setLastActiveTime(Date dt);
-
- /**
- * The un-caught fault associated with the process. This will be
- * <code>null</code> if no fault occurred or if all faults are caught and
- * processed.
- * @param fault the fault
- */
- void setFault(FaultDAO fault);
-
- void setFault(QName faultName, String explanation, int faultLineNo, int
activityId, Element faultMessage);
-
- /**
- * The un-caught fault associated with the process. This will be
- * <code>null</code> if no fault occurred or if all faults are caught and
- * processed.
- *
- * @return the fault
- */
- FaultDAO getFault();
-
- /**
- * Get the (opaque) instance execution state.
- * @return opaque execution state
- */
- byte[] getExecutionState();
-
- /**
- * Set the (opaque) instance execution state.
- * @param execState execuction state
- */
- void setExecutionState(byte[] execState);
-
- /**
- * Get the process.
- *
- * @return process reference.
- */
- ProcessDAO getProcess();
-
- /**
- * Get the root (global) scope for the process.
- *
- * @return the root scope
- */
- ScopeDAO getRootScope();
-
- /**
- * Set the state of the process instance; one of the <code>STATE_XXX</code>
- * constants defined in ProcessState.
- *
- * This should automatically populate the previous state.
- *
- * @param state new state of the process instance
- */
- void setState(short state);
-
- /**
- * Get the state of the process instance; one of the <code>STATE_XXX</code>
- * constants defined in ProcessState.
- *
- * @return state of process instance
- */
- short getState();
-
- /**
- * Returns the next to last state.
- * @return
- */
- short getPreviousState();
-
- /**
- * Creates a new scope.
- *
- * @param parentScope parent scope of the new scope, or null if this is the
- * root scope.
- * @param name scope name
- *
- * @return the newly created scope
- */
- ScopeDAO createScope(ScopeDAO parentScope, String name, int scopeModelId);
-
- /**
- * Get the instance identifier.
- * @return the instance identifier
- */
- Long getInstanceId();
-
- /**
- * Returns a scope using its instance id.
- * @param scopeInstanceId
- * @return
- */
- ScopeDAO getScope(Long scopeInstanceId);
-
- /**
- * Returns all the scopes with the associated name.
- * @param scopeName
- * @return
- */
- Collection<ScopeDAO> getScopes(String scopeName);
-
- /**
- * Returns all the scopes belonging to this isntance.
- * @param scopeName
- * @return
- */
- Collection<ScopeDAO> getScopes();
-
- /**
- * Return the correlator which results in the instantiation of the process
instance.
- * @return
- */
- CorrelatorDAO getInstantiatingCorrelator();
-
- /**
- * Returns all variable instances matching the variable name for a
specified scope.
- */
- XmlDataDAO[] getVariables(String variableName, int scopeModelId);
-
- /**
- * Get all the correlation sets for this process.
- * @return [EMAIL PROTECTED] Set} of [EMAIL PROTECTED] CorrelationSetDAO}
objects
- */
- Set<CorrelationSetDAO> getCorrelationSets();
-
- /**
- * Get a correlation set by its name from this process
- * @param name
- * @return a [EMAIL PROTECTED] CorrelationSetDAO} object
- */
- CorrelationSetDAO getCorrelationSet(String name);
-
- /**
- * A simple callback to allow the ProcessInstance to perform post-completion
duties.
- * The DAO's state indicates whether any fault has occured.
- */
- void finishCompletion();
-
- /**
- * Delete the process instance object from the database.
- */
- void delete();
-
- /**
- * Insert a BPEL event to the database (associating with this process).
- * @param event BPEL event
- */
- void insertBpelEvent(ProcessInstanceEvent event);
-
- /**
- * Get a triple containing the first
- * @return
- */
- EventsFirstLastCountTuple getEventsFirstLastCount();
-
- /**
- * Get the next number from a monotonically increasing sequence.
- * @return next number in seqeunce
- */
- public long genMonotonic();
-
- public BpelDAOConnection getConnection();
-
- /**
- * Get number of activities in the failure state.
- */
- int getActivityFailureCount();
-
- /**
- * Get date/time of last activity failure.
- */
- Date getActivityFailureDateTime();
-
- /**
- * Returns all activity recovery objects for this process instance.
- */
- Collection<ActivityRecoveryDAO> getActivityRecoveries();
-
- /**
- * Create an activity recovery object for a given activity instance.
- * Specify the reason and optional data associated with the failure.
- * Date/time failure occurred, and the recovery channel and available
- * recovery actions.
- */
- void createActivityRecovery(String channel, long activityId, String reason,
Date dateTime, Element data, String[] actions, int retries);
-
- /**
- * Delete previously registered activity recovery.
- */
- void deleteActivityRecovery(String channel);
-
- /**
- * Transport object holding the date of the first and last instance event
- * along with the number events.
- */
- public class EventsFirstLastCountTuple {
- public Date first;
- public Date last;
- public int count;
- }
-
+ /**
+ * Get the time when the process instance was created.
+ * @return time of instance creation
+ */
+ public Date getCreateTime();
+
+ /**
+ * Get the time when the process instance was last active (re-hydrated).
+ * @return time of activity
+ */
+ public Date getLastActiveTime();
+
+ /**
+ * Set last activity time for the process instance
+ * @param dt tiem of activity
+ */
+ void setLastActiveTime(Date dt);
+
+ /**
+ * The un-caught fault associated with the process. This will be
+ * <code>null</code> if no fault occurred or if all faults are caught and
+ * processed.
+ * @param fault the fault
+ */
+ void setFault(FaultDAO fault);
+
+ void setFault(QName faultName, String explanation, int faultLineNo, int
activityId, Element faultMessage);
+
+ /**
+ * The un-caught fault associated with the process. This will be
+ * <code>null</code> if no fault occurred or if all faults are caught and
+ * processed.
+ *
+ * @return the fault
+ */
+ FaultDAO getFault();
+
+ /**
+ * Get the (opaque) instance execution state.
+ * @return opaque execution state
+ */
+ byte[] getExecutionState();
+
+ /**
+ * Set the (opaque) instance execution state.
+ * @param execState execuction state
+ */
+ void setExecutionState(byte[] execState);
+
+ /**
+ * Get the process.
+ *
+ * @return process reference.
+ */
+ ProcessDAO getProcess();
+
+ /**
+ * Get the root (global) scope for the process.
+ *
+ * @return the root scope
+ */
+ ScopeDAO getRootScope();
+
+ /**
+ * Set the state of the process instance; one of the <code>STATE_XXX</code>
+ * constants defined in ProcessState.
+ *
+ * This should automatically populate the previous state.
+ *
+ * @param state new state of the process instance
+ */
+ void setState(short state);
+
+ /**
+ * Get the state of the process instance; one of the <code>STATE_XXX</code>
+ * constants defined in ProcessState.
+ *
+ * @return state of process instance
+ */
+ short getState();
+
+ /**
+ * Returns the next to last state.
+ * @return
+ */
+ short getPreviousState();
+
+ /**
+ * Creates a new scope.
+ *
+ * @param parentScope parent scope of the new scope, or null if this is the
+ * root scope.
+ * @param name scope name
+ *
+ * @return the newly created scope
+ */
+ ScopeDAO createScope(ScopeDAO parentScope, String name, int scopeModelId);
+
+ /**
+ * Get the instance identifier.
+ * @return the instance identifier
+ */
+ Long getInstanceId();
+
+ /**
+ * Returns a scope using its instance id.
+ * @param scopeInstanceId
+ * @return
+ */
+ ScopeDAO getScope(Long scopeInstanceId);
+
+ /**
+ * Returns all the scopes with the associated name.
+ * @param scopeName
+ * @return
+ */
+ Collection<ScopeDAO> getScopes(String scopeName);
+
+ /**
+ * Returns all the scopes belonging to this isntance.
+ * @param scopeName
+ * @return
+ */
+ Collection<ScopeDAO> getScopes();
+
+ /**
+ * Return the correlator which results in the instantiation of the process
instance.
+ * @return
+ */
+ CorrelatorDAO getInstantiatingCorrelator();
+
+ /**
+ * Returns all variable instances matching the variable name for a
specified scope.
+ */
+ XmlDataDAO[] getVariables(String variableName, int scopeModelId);
+
+ /**
+ * Get all the correlation sets for this process.
+ * @return [EMAIL PROTECTED] Set} of [EMAIL PROTECTED] CorrelationSetDAO}
objects
+ */
+ Set<CorrelationSetDAO> getCorrelationSets();
+
+ /**
+ * Get a correlation set by its name from this process
+ * @param name
+ * @return a [EMAIL PROTECTED] CorrelationSetDAO} object
+ */
+ CorrelationSetDAO getCorrelationSet(String name);
+
+ /**
+ * A simple callback to allow the ProcessInstance to perform
post-completion duties.
+ * The DAO's state indicates whether any fault has occured.
+ */
+ void finishCompletion();
+
+ /**
+ * Delete the process instance object from the database.
+ */
+ void delete();
+
+ /**
+ * Insert a BPEL event to the database (associating with this process).
+ * @param event BPEL event
+ */
+ void insertBpelEvent(ProcessInstanceEvent event);
+
+ /**
+ * Get a triple containing the first
+ * @return
+ */
+ EventsFirstLastCountTuple getEventsFirstLastCount();
+
+ /**
+ * Get the next number from a monotonically increasing sequence.
+ * @return next number in seqeunce
+ */
+ public long genMonotonic();
+
+ public BpelDAOConnection getConnection();
+
+ /**
+ * Get number of activities in the failure state.
+ */
+ int getActivityFailureCount();
+
+ /**
+ * Get date/time of last activity failure.
+ */
+ Date getActivityFailureDateTime();
+
+ /**
+ * Returns all activity recovery objects for this process instance.
+ */
+ Collection<ActivityRecoveryDAO> getActivityRecoveries();
+
+ /**
+ * Create an activity recovery object for a given activity instance.
+ * Specify the reason and optional data associated with the failure.
+ * Date/time failure occurred, and the recovery channel and available
+ * recovery actions.
+ */
+ void createActivityRecovery(String channel, long activityId, String
reason, Date dateTime, Element data, String[] actions, int retries);
+
+ /**
+ * Delete previously registered activity recovery.
+ */
+ void deleteActivityRecovery(String channel);
+
+ /**
+ * Transport object holding the date of the first and last instance event
+ * along with the number events.
+ */
+ public class EventsFirstLastCountTuple {
+ public Date first;
+ public Date last;
+ public int count;
+ }
}
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?view=diff&rev=475526&r1=475525&r2=475526
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
Wed Nov 15 18:05:24 2006
@@ -595,6 +595,7 @@
genInstanceSummaryEntry(isum.addNewInstances(),TInstanceStatus.FAILED, proc);
genInstanceSummaryEntry(isum.addNewInstances(),TInstanceStatus.SUSPENDED, proc);
genInstanceSummaryEntry(isum.addNewInstances(),TInstanceStatus.TERMINATED,
proc);
+ getInstanceSummaryActivityFailure(isum, proc);
}
TProcessInfo.Documents docinfo = info.addNewDocuments();
@@ -679,6 +680,29 @@
instances.setCount(count);
}
+ private void getInstanceSummaryActivityFailure(TInstanceSummary summary,
ProcessDAO proc) {
+ String queryStatus =
InstanceFilter.StatusKeys.valueOf(TInstanceStatus.ACTIVE.toString()).toString().toLowerCase();
+ InstanceFilter instanceFilter = new InstanceFilter("status=" +
queryStatus
+ + " name=" + proc.getType().getLocalPart()
+ + " namespace=" + proc.getType().getNamespaceURI());
+ int failureCount = 0;
+ Date lastFailureDt = null;
+ for (ProcessInstanceDAO instance :
_db.getConnection().instanceQuery(instanceFilter)) {
+ int count = instance.getActivityFailureCount();
+ if (count > 0) {
+ failureCount += count;
+ Date failureDt = instance.getActivityFailureDateTime();
+ if (lastFailureDt == null || lastFailureDt.before(failureDt))
+ lastFailureDt = failureDt;
+ }
+ }
+ if (failureCount > 0) {
+ TFailuresInfo failures = summary.addNewFailures();
+ failures.setDtFailure(toCalendar(lastFailureDt));
+ failures.setCount(failureCount);
+ }
+ }
+
private void fillInstanceInfo(TInstanceInfo info, ProcessInstanceDAO
instance) {
info.setIid("" + instance.getInstanceId());
// TODO: add process QName to instance-info schema
@@ -719,7 +743,7 @@
eventInfo.setCount(flc.count);
if (instance.getActivityFailureCount() > 0) {
- TInstanceInfo.Failures failures = info.addNewFailures();
+ TFailuresInfo failures = info.addNewFailures();
failures.setDtFailure(toCalendar(instance.getActivityFailureDateTime()));
failures.setCount(instance.getActivityFailureCount());
}
@@ -769,7 +793,7 @@
for (ActivityInfoDocument ai : b.getActivities()) {
for (ActivityRecoveryDAO recovery : recoveries) {
if
(String.valueOf(recovery.getActivityId()).equals(ai.getActivityInfo().getAiid()))
{
- TActivityInfo.Failure failure =
ai.getActivityInfo().addNewFailure();
+ TFailureInfo failure =
ai.getActivityInfo().addNewFailure();
failure.setReason(recovery.getReason());
failure.setDtFailure(toCalendar(recovery.getDateTime()));
failure.setActions(recovery.getActions());
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java?view=diff&rev=475526&r1=475525&r2=475526
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
Wed Nov 15 18:05:24 2006
@@ -16,7 +16,7 @@
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
+import java.util.Date;
/**
* A very simple, in-memory implementation of the [EMAIL PROTECTED]
ProcessDAO} interface.
@@ -129,11 +129,19 @@
//TODO Check requirement for persisting.
}
- public int getNumInstances() {
- return _instances.size();
- }
+ public int getNumInstances() {
+ return _instances.size();
+ }
public ProcessInstanceDAO getInstanceWithLock(Long iid) {
- return getInstance(iid);
+ return getInstance(iid);
+ }
+
+ public int getActivityFailureCount() {
+ return 0;
+ }
+
+ public Date getActivityFailureDateTime() {
+ return null;
}
}
Modified:
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java?view=diff&rev=475526&r1=475525&r2=475526
==============================================================================
---
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
(original)
+++
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
Wed Nov 15 18:05:24 2006
@@ -37,6 +37,8 @@
import org.apache.ode.bpel.pmapi.TActivityInfo;
import org.apache.ode.bpel.pmapi.TActivityStatus;
import org.apache.ode.bpel.pmapi.TFaultInfo;
+import org.apache.ode.bpel.pmapi.TFailureInfo;
+import org.apache.ode.bpel.pmapi.TFailuresInfo;
import org.apache.ode.bpel.pmapi.TInstanceInfo;
import org.apache.ode.bpel.pmapi.TInstanceStatus;
import org.apache.ode.bpel.pmapi.TScopeInfo;
@@ -55,6 +57,7 @@
boolean _responseSent;
MockBpelServer _server;
BpelManagementFacade _management;
+ QName _processQName;
public void testSuccessfulInvoke() throws Exception {
execute("FailureToRecovery", 0);
@@ -115,7 +118,7 @@
public void invokePartner(final PartnerRoleMessageExchange
mex) throws ContextException {
if (mex.getOperation().getName().equals("invoke")) {
- // Failing invocation.
+ // First fail, then succeed, that's the nature of
a test case.
++_invoked;
if (_invoked > _failFor) {
Message response =
mex.createMessage(mex.getOperation().getOutput().getMessage().getQName());
@@ -125,6 +128,7 @@
mex.replyWithFailure(MessageExchange.FailureType.COMMUNICATION_ERROR,
"BangGoesInvoke", null);
}
} else if
(mex.getOperation().getName().equals("respond")) {
+ // Happens when the process completes its last
activity.
_responseSent = true;
}
}
@@ -149,7 +153,8 @@
protected void execute(String process, int failFor) throws Exception {
_failFor = failFor;
_server.getBpelManagementFacade().delete(null);
- _server.invoke(new QName(NAMESPACE, process), "instantiate",
+ _processQName = new QName(NAMESPACE, process);
+ _server.invoke(_processQName, "instantiate",
DOMUtils.newDocument().createElementNS(NAMESPACE,
"tns:RequestElement"));
_server.waitForBlocking();
}
@@ -162,7 +167,10 @@
protected void assertCompleted(boolean successful, int invoked, QName
faultName) {
assertTrue(_invoked == invoked);
TInstanceInfo instance =
_management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
- TInstanceInfo.Failures failures = instance.getFailures();
+ // Process has completed, so no activities in the failure state.
+ TFailuresInfo failures = instance.getFailures();
+ assertTrue(failures == null || failures.getCount() == 0);
+ failures =
_management.getProcessInfo(_processQName).getProcessInfo().getInstanceSummary().getFailures();
assertTrue(failures == null || failures.getCount() == 0);
if (successful) {
assertTrue(instance.getStatus() == TInstanceStatus.COMPLETED);
@@ -182,18 +190,21 @@
* Asserts that the process has one activity in the recovery state.
*/
protected void assertRecovery(int invoked, String[] actions) {
- // Test in aggregate to see how many activities we have in this state.
+ // Process is still active, none of the completed states.
TInstanceInfo instance =
_management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
assertTrue(instance.getStatus() == TInstanceStatus.ACTIVE);
assertFalse(_responseSent);
- TInstanceInfo.Failures failures = instance.getFailures();
+ // Tests here will only generate one failure.
+ TFailuresInfo failures = instance.getFailures();
+ assertTrue(failures != null && failures.getCount() == 1);
+ failures =
_management.getProcessInfo(_processQName).getProcessInfo().getInstanceSummary().getFailures();
assertTrue(failures != null && failures.getCount() == 1);
// Look for individual activities inside the process instance.
@SuppressWarnings("unused")
TScopeInfo rootScope =
_management.getScopeInfoWithActivity(instance.getRootScope().getSiid(),
true).getScopeInfo();
ArrayList<TActivityInfo> recoveries = getRecoveriesInScope(instance,
null, null);
assertTrue(recoveries.size() == 1);
- TActivityInfo.Failure failure = recoveries.get(0).getFailure();
+ TFailureInfo failure = recoveries.get(0).getFailure();
assertTrue(failure.getRetries() == invoked - 1);
assertTrue(failure.getReason().equals("BangGoesInvoke"));
assertTrue(failure.getDtFailure() != null);