You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2006/11/15 00:57:56 UTC
svn commit: r475064 - in /incubator/ode/trunk/bpel-runtime/src:
main/java/org/apache/ode/bpel/runtime/ test/java/org/apache/ode/bpel/runtime/
Author: assaf
Date: Tue Nov 14 15:57:55 2006
New Revision: 475064
URL: http://svn.apache.org/viewvc?view=rev&rev=475064
Log:
Implemented cancelled/failure for activity guard and implement scope, now passing all test cases for activity recovery
Modified:
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ActivityRecoveryTest.java
incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ACTIVITYGUARD.java Tue Nov 14 15:57:55 2006
@@ -234,9 +234,9 @@
public void cancelled() {
sendEvent(new ActivityExecEndEvent());
+ dpe(_oactivity.outgoingLinks);
dpe(_oactivity.sourceLinks);
- _self.parent.cancelled();
- // Bubble up: for implicitScope.
+ // Implicit scope can tell the difference between cancelled and completed.
_self.parent.cancelled();
}
@@ -256,7 +256,6 @@
completed(faultData, CompensationHandler.emptySet());
return;
}
- // If maximum number of retries, enter activity recovery state.
if (failureHandling == null || _failure.retryCount >= failureHandling.retryFor) {
requireRecovery();
return;
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/COMPENSATIONHANDLER_.java Tue Nov 14 15:57:55 2006
@@ -93,8 +93,8 @@
ret.ret();
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
});
}
});
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java Tue Nov 14 15:57:55 2006
@@ -224,8 +224,8 @@
}
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
}.or(new EventHandlerControlChannelListener(_cc) {
private static final long serialVersionUID = -3873619538789039424L;
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java Tue Nov 14 15:57:55 2006
@@ -198,8 +198,8 @@
instance(WAITING.this);
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
});
}
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FLOW.java Tue Nov 14 15:57:55 2006
@@ -113,8 +113,8 @@
instance(ACTIVE.this);
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
});
}
object(false,mlSet);
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java Tue Nov 14 15:57:55 2006
@@ -158,8 +158,8 @@
instance(ACTIVE.this);
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
});
}
object(false,mlSet);
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java Tue Nov 14 15:57:55 2006
@@ -172,11 +172,18 @@
}
public void cancelled() {
+ // Implicit scope holds links of the enclosed activity,
+ // they only get cancelled when we propagate upwards.
if (_oscope.implicitScope)
_self.parent.cancelled();
+ else
+ completed(null, CompensationHandler.emptySet());
}
- public void failure(String reason, Element data) { }
+ public void failure(String reason, Element data) {
+ completed(createFault(OFailureHandling.FAILURE_FAULT_NAME, _self.o, null),
+ CompensationHandler.emptySet());
+ }
});
}
@@ -216,8 +223,8 @@
instance(ACTIVE.this);
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
});
}
object(false, mlSet);
@@ -313,8 +320,8 @@
_self.parent.completed(fault, CompensationHandler.emptySet());
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
});
}
} else /* completed ok */ {
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SEQUENCE.java Tue Nov 14 15:57:55 2006
@@ -108,8 +108,8 @@
}
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
}));
}
Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/WHILE.java Tue Nov 14 15:57:55 2006
@@ -138,8 +138,8 @@
instance(WHILE.this);
}
- public void cancelled() { }
- public void failure(String reason, Element data) { }
+ public void cancelled() { completed(null, CompensationHandler.emptySet()); }
+ public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
}));
}
}
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=475064&r1=475063&r2=475064
==============================================================================
--- 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 Tue Nov 14 15:57:55 2006
@@ -55,7 +55,7 @@
boolean _responseSent;
MockBpelServer _server;
BpelManagementFacade _management;
-/*
+
public void testSuccessfulInvoke() throws Exception {
execute("FailureToRecovery", 0);
assertCompleted(true, 1, null);
@@ -83,7 +83,7 @@
recover("fault");
assertCompleted(false, 4, OFailureHandling.FAILURE_FAULT_NAME);
}
-*/
+
public void testCancelRecoveryAction() throws Exception {
execute("FailureToCancel", 4);
assertRecovery(3, ACTIONS);
@@ -92,7 +92,7 @@
recover("cancel");
assertCompleted(true, 4, null);
}
-/*
+
public void testImmediateFailure() throws Exception {
execute("FailureNoRetry", 1);
assertRecovery(1, ACTIONS);
@@ -107,7 +107,7 @@
execute("FailureInheritence", 2);
assertCompleted(true, 3, null);
}
-*/
+
protected void setUp() throws Exception {
_server = new MockBpelServer() {
protected MessageExchangeContext createMessageExchangeContext() {
@@ -124,8 +124,9 @@
} else {
mex.replyWithFailure(MessageExchange.FailureType.COMMUNICATION_ERROR, "BangGoesInvoke", null);
}
- } else if (mex.getOperation().getName().equals("respond"))
- _responseSent = true;
+ } else if (mex.getOperation().getName().equals("respond")) {
+ _responseSent = true;
+ }
}
public void onAsyncReply(MyRoleMessageExchange myRoleMex) { }
@@ -163,7 +164,6 @@
TInstanceInfo instance = _management.listAllInstances().getInstanceInfoList().getInstanceInfoArray(0);
TInstanceInfo.Failures failures = instance.getFailures();
assertTrue(failures == null || failures.getCount() == 0);
-System.out.println(instance.getFaultInfo() != null ? instance.getFaultInfo().getName() : instance.getStatus());
if (successful) {
assertTrue(instance.getStatus() == TInstanceStatus.COMPLETED);
assertTrue(_responseSent);
@@ -196,7 +196,7 @@
TActivityInfo.Failure failure = recoveries.get(0).getFailure();
assertTrue(failure.getRetries() == invoked - 1);
assertTrue(failure.getReason().equals("BangGoesInvoke"));
- assertTrue(failure.getDtFailure().getTime().getTime() / 100000 == System.currentTimeMillis() / 100000);
+ assertTrue(failure.getDtFailure() != null);
java.util.HashSet<String> actionSet = new java.util.HashSet<String>();
for (String action : failure.getActions().split(" "))
actionSet.add(action);
Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java?view=diff&rev=475064&r1=475063&r2=475064
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java Tue Nov 14 15:57:55 2006
@@ -134,7 +134,7 @@
public void waitForBlocking() {
try {
- long delay = 10000;
+ long delay = 1000;
while (true) {
// Be warned: ugly hack and not safe for slow CPUs.
long cutoff = System.currentTimeMillis() - delay;