Author: mszefler
Date: Mon Aug 6 15:38:35 2007
New Revision: 563315
URL: http://svn.apache.org/viewvc?view=rev&rev=563315
Log:
BART, some additinal refactorings. New model to fix concurrency problems in
Partner invokes.
Modified:
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java
Modified:
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java
URL:
http://svn.apache.org/viewvc/ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java?view=diff&rev=563315&r1=563314&r2=563315
==============================================================================
---
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java
(original)
+++
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/BPELTestAbstract.java
Mon Aug 6 15:38:35 2007
@@ -42,6 +42,8 @@
import org.apache.ode.bpel.iapi.InvocationStyle;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
+import org.apache.ode.bpel.iapi.MessageExchange.AckType;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.ProcessStore;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
@@ -151,7 +153,7 @@
}
});
_server.setConfigProperties(getConfigProperties());
- _server.registerBpelEventListener(new DebugBpelEventListener());
+ //_server.registerBpelEventListener(new DebugBpelEventListener());
_server.init();
_server.start();
}
@@ -254,11 +256,12 @@
inv.target = target;
inv.operation = operation;
inv.request = DOMUtils.stringToDOM(request);
- inv.expectedStatus = null;
if (responsePattern != null) {
- inv.expectedFinalStatus = MessageExchange.Status.ACK;
+ inv.expectedFinalStatus = AckType.RESPONSE;
+
inv.expectedResponsePattern = Pattern.compile(responsePattern,
Pattern.DOTALL);
- }
+ } else
+ inv.expectedFinalStatus = AckType.ONEWAY;
_invocations.add(inv);
return inv;
@@ -502,11 +505,10 @@
/** If non-null, expect an exception of this class (or subclass) on
invoke. */
public Class expectedInvokeException = null;
- /** If non-null, expecte this status right after invoke. */
- public MessageExchange.Status expectedStatus = null;
/** If non-null, expect this status after response received. */
- public MessageExchange.Status expectedFinalStatus =
MessageExchange.Status.COMPLETED;
+ public AckType expectedFinalStatus = AckType.RESPONSE;
+
/** If non-null, expect this correlation status right after invoke. */
public CorrelationStatus expectedCorrelationStatus = null;
@@ -556,18 +558,14 @@
try {
mex =
_server.createMessageExchange(InvocationStyle.UNRELIABLE, _invocation.target,
_invocation.operation, new GUID()
.toString());
- mexContext.clearCurrentResponse();
Message request = mex.createMessage(_invocation.requestType);
request.setMessage(_invocation.request);
_invocation.invokeTime = System.currentTimeMillis();
mex.setRequest(request);
- Status status = mex.invokeBlocking();
+ mex.invokeBlocking();
CorrelationStatus cstatus = mex.getCorrelationStatus();
- if (_invocation.expectedStatus != null &&
!status.equals(_invocation.expectedStatus))
- failure(_invocation, "Unexpected message exchange status",
_invocation.expectedStatus, status);
-
if (_invocation.expectedCorrelationStatus != null &&
!cstatus.equals(_invocation.expectedCorrelationStatus))
failure(_invocation, "Unexpected correlation status",
_invocation.expectedCorrelationStatus, cstatus);
@@ -580,6 +578,9 @@
return;
}
+ if (mex.getStatus() != Status.ACK)
+ failure(_invocation, "No ACK status", Status.ACK.toString(),
mex.getStatus().toString());
+
if (isFailed())
return;
@@ -595,8 +596,8 @@
if (isFailed())
return;
- Status finalstat = mex.getStatus();
- if (_invocation.expectedFinalStatus != null &&
!_invocation.expectedFinalStatus.equals(finalstat))
+ AckType finalstat = mex.getAckType();
+ if (_invocation.expectedFinalStatus != null &&
_invocation.expectedFinalStatus != finalstat)
failure(_invocation, "Unexpected final message exchange
status", _invocation.expectedFinalStatus, finalstat);
Modified:
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java
URL:
http://svn.apache.org/viewvc/ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java?view=diff&rev=563315&r1=563314&r2=563315
==============================================================================
---
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java
(original)
+++
ode/branches/bart/bpel-test/src/main/java/org/apache/ode/test/MessageExchangeContextImpl.java
Mon Aug 6 15:38:35 2007
@@ -73,8 +73,7 @@
// Probe Service is a simple concatination service
private static final QName probePT = new
QName(PROBE_NS,"probeMessagePT");
private static final QName faultPT = new
QName(FAULT_NS,"faultMessagePT");
-
- private Message currentResponse;
+
public void invokePartner(PartnerRoleMessageExchange mex)
throws ContextException {
@@ -92,23 +91,7 @@
public void onMyRoleMessageExchangeStateChanged(MyRoleMessageExchange
myRoleMex)
throws BpelEngineException {
-
-
- Status mStat = myRoleMex.getStatus();
-
- if ( mStat == Status.ACK ) {
-
- currentResponse = myRoleMex.getResponse();
-
-
- //String resp =
DOMUtils.domToString(getCurrentResponse().getMessage());
- //System.out.println(resp);
-
- }
-
- myRoleMex.complete();
-
}
private void invokeProbeService(PartnerRoleMessageExchange prmx) {
@@ -175,14 +158,7 @@
}
}
-
- public Message getCurrentResponse() {
- return currentResponse;
- }
-
- public void clearCurrentResponse() {
- currentResponse = null;
- }
+
public void cancel(PartnerRoleMessageExchange mex) throws ContextException
{
// TODO Auto-generated method stub