This document details the testing to be performed for each API method based on the JSR95 specification and the corresponding API javadoc. It is centered around the assertions in these documents. Each API method and the corresponding assertions are detailed together with a description of the proposed tests.
public void ActivityCoordinator.addAction(Action action, String signalSetName, int priority)
The following assertions are taken from the javadoc
Establishes an interest relationship between the specifiedRead in conjunction with the following assertionAction
andSignalSet
for the Activity represented by the targetActivityCoordinator
.
When aThis assertion is saying that whenever signalSetName is producing Signals, either during completion (ie it is the completion SignalSet) or during broadcast, they will be sent to action's processSignal method. This will be tested (implicitly) with the tests forSignal
which is a member of theSignalSet
is sent, theprocessSignal
method of theAction
will be invoked with thatSignal
.
UserActivity.complete
and
UserActivity.broadcast
.
If multipleThis can be tested by registering two Actions with different priorities and ensuring that the higher priority one is called first. If this test is done with just two Actions, then the ordering may just work coincidentally. In order to ensure that ordering is as specified, either the test can be repeated with the priorities reversed or else the test must use at least 3 Actions.Actions
are registered, thenpriority
may be used to place an order on how they will be invoked whenSignals
are sent: higher priorityActions
will occur first in theAction
list, and hence be invoked before other, lower priority,Actions
.
The priority value must be a positive value; a value of zero means that the Activity Service implementation is free to place thePositive values will have been used in the previous test; test it now with a negative value.Action
at any point in theAction
list.
The case of zero is essentially untestable, as different implementations may choose to place different ordering on priority 0 Actions. These Actions of course must still be called, and this will have been tested previously.
If the specifiedNote also that the Action may also be added as a global action.Action
is registered multiple times for the sameSignalSet
then it will be invoked multiple times with theSignals
from thatSignalSet
.
SignalSetUnknownException Thrown if the specified signalSetName
is not recognized.
Test using a SignalSet that the ServiceManager does not support.
The ServiceManager should throw the SignalSetUnknownException under these conditions.
IllegalStateException Thrown if the Activity represented by the
target ActivityCoordinator
has begun completion or has completed.
Testing this after the Activity has completed should be straighforward.
Testing during completion will require the method to be called either from a second
thread which does not have the Activity context (if there were a second thread
with context, then completion would fail)
or from within the completion process, for example from an Action.processSignal
call.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500034 | Priority | Begin Activity; register Action1 with SignalSet s1 priority p1; register Action2 with SignalSet s1 priority p2 (where p2 > p1); call UserActivity.broadcast (s1) | Action1.processSignal is called before Action2.processSignal |
jsr9500035 | Priority | Begin Activity; register Action1 with SignalSet s1 priority p1; register Action2 with SignalSet s1 priority p2 (where p2 < p1); call UserActivity.broadcast (s1) | Action2.processSignal is called before Action1.processSignal |
jsr9500036 | Negative Priority | Begin Activity; register Action1 with SignalSet s1 priority p1 (where p1 is negative); | SystemException is thrown |
jsr9500037 | SignalSet unknown | Begin Activity; register Action1 with SignalSet s1 priority p1 (where s1 is not supported by the ServiceManager); | SignalSetUnknownException is thrown |
jsr9500038 | Activity completed | Begin Activity; extract coordinator ; complete Activity; register Action1 with SignalSet s1 priority p1 | IllegalStateException is thrown |
jsr9500039 | Activity completing | Begin Activity; extract coordinator ; register Action1 with SignalSet s1 priority p1 (where s1 is the completion SignalSet); complete Activity (Action1.processSignal will register Action2 with SignalSet s1 priority p1) | IllegalStateException is thrown |
jsr9500040 | Add same Action more than once | Begin Activity; register Action1 with SignalSet s1 priority p1; register Action1 with SignalSet s1 priority p2; call UserActivity.broadcast (s1) | Action1.processSignal is called twice for each Signal in s1. |
public void ActivityCoordinator.addGlobalAction(Action action, int priority)
The following assertions are taken from the javadoc.
Establishes an interest relationship between the specifiedRead in conjunction with the following assertionAction
and allSignalSets
used by the Activity represented by the targetActivityCoordinator
.
When aThis assertion is saying that whenever any SignalSet is producing Signals, either during completion (ie it is the completion SignalSet) or during broadcast, they will be sent to action's processSignal method.Signal
which is a member of any of theSignalSets
is sent, theprocessSignal
method of theAction
will be invoked with thatSignal
.
If multipleImplicit in this assertion is the interaction with non-global Actions. The priority in both cases must be respected. Hence this test should include both global and non-global Actions.Actions
are registered, thenpriority
may be used to place an order on how they will be invoked whenSignals
are sent: higher priorityActions
will occur first in theAction
list, and hence be invoked before other, lower priority,Actions
.
The priority value must be a positive value; a value of zero means that the Activity Service implementation is free to place thePositive values will have been used in the previous test; test it now with a negative value.Action
at any point in theAction
list.
The case of zero is essentially untestable, as different implementations may choose to place different ordering on priority 0 Actions. These Actions of course must still be called, and this has been tested previously.
If the specifiedAs for non-global Actions.Action
is registered multiple times with the targetActivityCoordinator
then it will be invoked multiple times with eachSignal
.
IllegalStateException Thrown if the Activity represented by the
target ActivityCoordinator
has begun completion or has completed.
Testing during completion will require the method to be called either from a second
thread which does not have the Activity context (if there were a second thread
with context, then completion would fail)
or from within the completion process, for example from an Action.processSignal
call.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500041 | Any Signal | Begin Activity; addGlobalAction Action1 priority 0; complete Activity (with suitable completion SignalSet) | Action1.processSignal is called for preCompletion, completion Signals and postCompletion. |
jsr9500042 | Priority | Begin Activity; addGlobalAction Action1 priority p1; addAction Action2 with SignalSet s1 priority p2 ; addGlobalAction Action3 priority p3; (where p2 > p1 > p3); call UserActivity.broadcast (s1) | Action2.processSignal is called before Action1.processSignal which is called before Action3.processSignal |
jsr9500043 | Negative Priority | Begin Activity; addGlobalAction Action1 priority p1 (where p1 is negative); | SystemException is thrown |
jsr9500044 | Activity completed | Begin Activity; extract coordinator ; complete Activity; addGlobalAction Action1 priority p1 | IllegalStateException is thrown |
jsr9500045 | Activity completing | Begin Activity; extract coordinator ; addGlobalAction Action1 priority p1; complete Activity (Action1.processSignal will call addGlobalAction Action2 priority p2) | IllegalStateException is thrown |
jsr9500046 | Add same Action more than once | Begin Activity; addGlobalAction Action1 priority p1; addAction Action1 with SignalSet s1 priority p2; addGlobalAction Action1 priority p3; call UserActivity.broadcast (s1) | Action1.processSignal is called 3 times for each Signal in s1. |
public void ActivityCoordinator.removeAction(Action action, String signalSetName)
The following assertions are taken from the javadoc.
Removes the interest relationship between the specifiedThe Action will no longer be called during a broadcast or complete operation.Action
andSignalSet
for the Activity represented by the targetActivityCoordinator
.
IfTest by registering an Action with multiple SignalSets.signalSetName
is an empty String then the interest relationship is removed between the specifiedAction
and allSignalSets
in the target Activity.
This operation has no effect on any global actions.Including the same Action registered as a global action.
If the specifiedTo remove all instances, call this method the same number of times thatAction
was registered multiple times with the targetActivityCoordinator
then only a single instance of this Action is removed by each call to this method.
addAction
was called.
ActionNotFoundException Thrown if the specified Action
is not recognized.
Test by trying to remove an Action from an Activity that has just been started.
Repeat after adding and removing an Action.
IllegalStateException Thrown if the Activity represented by the
target ActivityCoordinator
has begun completion or has completed.
Testing this after the Activity has completed should be straighforward.
Testing during completion will require the method to be called either from a second
thread which does not have the Activity context (if there were a second thread
with context, then completion would fail)
or from within the completion process, for example from an Action.processSignal
call.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500050 | all SignalSets | Begin Activity; addAction Action1 SignalSet s1 priority 0; addAction Action1 SignalSet s1 priority 0; addAction Action1 SignalSet s2 priority 0; addAction Action1 SignalSet s3 priority 0; removeAction Action1 SignalSet ""; broadcast SignalSet s1; broadcast SignalSet s2 broadcast SignalSet s3 | Action1.processSignal is called once for each Signal of SignalSet s1 |
jsr9500051 | removes Action | Begin Activity; addAction Action1 SignalSet s1 priority 0; addAction Action1 SignalSet s1 priority 0; addAction Action1 SignalSet s1 priority 0; addAction Action1 SignalSet s2 priority 0; removeAction Action1 SignalSet s1; removeAction Action1 SignalSet s1; removeAction Action1 SignalSet s1; broadcast SignalSet s1; broadcast SignalSet s2 | Action1.processSignal is only called for s2 |
jsr9500052 | global Action unaffected | Begin Activity; addAction Action1 SignalSet s1 priority 0; addGlobal Action Action1 priority 0; removeAction Action1 SignalSet s1; broadcast SignalSet s1 | Action1.processSignal is called once for each Signal in s1 |
jsr9500053 | Action not registered | Begin Activity; removeAction Action1 Signalset s1; addAction Action2 SignalSet s1 priority 0; removeAction Action2 SignalSet s1; removeAction Action2 SignalSet s1 | ActionNotFoundException is thrown twice. |
jsr9500054 | Activity completed | Begin Activity; extract coordinator ; addAction Action1 SignalSet s1 priority p1; complete Activity; removeAction Action1 SignalSet s1 | IllegalStateException is thrown |
jsr9500055 | Activity completing | Begin Activity; extract coordinator ; addGlobalAction Action1 priority p1; complete Activity (where Action1.processSignal will call removeAction Action1 SignalSet s1) | IllegalStateException is thrown |
public void ActivityCoordinator.removeGlobalAction(Action action)
The following assertions are taken from the javadoc.
Removes the interest relationship between the specifiedThe Action will on longer be called during a broadcast or complete operation.Action
and allSignalSets
for the Activity represented by the targetActivityCoordinator
.
This operation has no effect on any non-global actions.Including the same Action registered as a non-global action.
If the specifiedTo remove all instances, call this method the same number of times thatAction
was registered multiple times with the targetActivityCoordinator
then only a single instance of this Action is removed by each call to this method.
addGlobalAction
was called. No details given of priority, so which
instance is removed by a single call cannot be tested.
ActionNotFoundException Thrown if the specified Action
is not recognized.
Test by trying to remove a global Action from an Activity that has just been started.
Repeat after adding and removing a global Action.
IllegalStateException Thrown if the Activity represented by the
target ActivityCoordinator
has begun completion or has completed.
Testing this after the Activity has completed should be straighforward.
Testing during completion will require the method to be called either from a second
thread which does not have the Activity context (if there were a second thread
with context, then completion would fail)
or from within the completion process, for example from an Action.processSignal
call.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500056 | removes Action | Begin Activity; addGlobalAction Action1 priority 0; addGlobalAction Action1 priority 0; removeGlobalAction Action1 broadcast SignalSet s1 | Action1.processSignal is called once for each Signal of SignalSet s1 |
jsr9500057 | Not non-global | Begin Activity; addAction Action1 SignalSet s1 priority 0; addGlobal Action Action1 priority 0; removeGlobalAction Action1 broadcast SignalSet s1 | Action1.processSignal is called once for each Signal in s1 |
jsr9500058 | Action not registered | Begin Activity; removeGlobalAction Action1; addGlobalAction Action2 priority 0; removeGlobalAction Action2; removeGlobalAction Action2 | ActionNotFoundException is thrown twice. |
jsr9500059 | Activity completed | Begin Activity; extract coordinator ; addGlobalAction Action1 priority p1; complete Activity; removeGlobalAction Action1 | IllegalStateException is thrown |
jsr9500060 | Activity completing | Begin Activity; extract coordinator ; addGlobalAction Action1 priority p1; complete Activity (where Action1.processSignal will call removeGlobalAction Action1) | IllegalStateException is thrown |
public void ActivityCoordinator.getNumberRegisteredActions(String signalSetName)
The following assertions are taken from the javadoc.
Returns the number of Actions, including global Actions, registered with the targetEach instance of an Action that is registered multiple times will count towards this total.ActivityCoordinator
with an interest in the specifiedSignalSet
.
SignalSetUnknownException Thrown if the specified signalSetName
is not recognized.
If the signalSetName is not supported by the ServiceManager, then the ServiceManager
will throw a SignalSetUnknownException.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500061 | SignalSet unknown | Begin Activity; call ActivityCoordinator.getNumberRegisteredActions with an unknown SignalSet name | SignalSetUnknownException is thrown. |
jsr9500062 | total count | Begin Activity; addAction a1 SignalSet s1 priority p1; addAction a1 SignalSet s1 priority p2; addAction a2 SignalSet s1 priority p3; addGlobalAction a3 priority p4; addAction a1 SignalSet s2 priority p5; ActivityCoordinator.getNumberRegisteredActions for s1 | returns 4 |
public void ActivityCoordinator.setCompletionSignalSetName(String signalSetName)
The following assertions are taken from the javadoc.
Sets the name of the SignalSet that should be used for the distribution of completion signals when the current Activity completes.Which thus overrides the default supplied by the HLS.
This method can be called multiple times during the lifetime of an Activity, before the Activity starts completion processing. The last value specified before completion processing starts is used during completion processing.Test this assertion.
SignalSetUnknownException Thrown if the specified signalSetName is not recognized.Test this assertion.
IllegalStateException Thrown if the Activity represented by the target ActivityCoordinator has begun completion or has completed.Possible to test.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500080 | Set SignalSetName | Begin Activity; call ActivityCoordinator.setCompletionSignalSetName with non-default SignalSet name; complete Activity | Correct SignalSet is used for completion. |
jsr9500081 | Multiple calls | Begin Activity; call ActivityCoordinator.setCompletionSignalSetName twice with non-default SignalSet name; complete Activity | Correct SignalSet is used for completion. |
jsr9500082 | Invalid (null) name | Begin Activity; call ActivityCoordinator.setCompletionSignalSetName with non-default SignalSet name; call ActivityCoordinator.setCompletionSignalSetName with null; complete Activity | SignalSetUnknownException thrown for second setname; Correct SignalSet is used for completion. |
jsr9500083 | Activity completed | Begin Activity; extract ActivityCoordinator; complete Activity; call ActivityCoordinator.setCompletionSignalSetName with non-default SignalSet name; | IllegalStateException thrown for setname; |
jsr9500084 | Activity completing | Begin Activity; addGlobalAction Action1 priority p1; complete Activity (Action1.processSignal will call setCompletionSignalSetName ); complete Activity | IllegalStateException thrown for setname; |
public String ActivityCoordinator.getCompletionSignalSetName()
The following assertions are taken from the javadoc.
Returns the name of the SignalSet, if any, that will be used for the distribution of completion signals when the current Activity completes.Test after setting a suitable name.
If no CompletionSignalSet has been set then null is returned.Test before setting name.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500088 | getCompletionSignalSetName | Begin Activity; call ActivityCoordinator.setCompletionSignalSetName with a suitable name; getCompletionSignalSetName; complete Activity; getCompletionSignalSetName | Correct name is returned in both cases. |
jsr9500089 | No name set | Begin Activity; getCompletionSignalSetName; complete Activity; getCompletionSignalSetName | Null is returned in both cases. |
public ActivityCoordinator ActivityCoordinator.getParent()
The following assertions are taken from the javadoc.
Returns the parentThis method should work regardless of association of Activity to thread.ActivityCoordinator
ornull
if the targetActivityCoordinator
represents a top-level Activity.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500063 | Active | Begin Activity; get coordinator; getParent; begin child Activity; get coordinator; getParent; use isSameActivity to check first Coordinator is parent of second | first getParent returns null; isSameActivity returns true; |
jsr9500064 | Suspended | Begin Activity; get coordinator; suspend; getParent; resume; begin child Activity; get coordinator; suspend parent; getParent; use isSameActivity to check first Coordinator is parent of second | first getParent returns null; isSameActivity returns true; |
jsr9500065 | New parent | Begin Activity; get coordinator; begin child Activity; get coordinator; getParent; use isSameActivity to check first Coordinator is parent of second; complete parent (CompletionStatusFail); getParent | isSameActivity returns true; second getParent returns null; |
public GlobalId ActivityCoordinator.getGlobalId()
The following assertions are taken from the javadoc.
Returns the GlobalId of the
Activity represented by the target ActivityCoordinator
.
Nothing testable.
public int ActivityCoordinator.getStatus()
The following assertions are taken from the javadoc.
Returns the Status
of the Activity represented by the target ActivityCoordinator
.
There are six Status enumerations; StatusActive, StatusCompleted,
StatusCompleting, StatusNoActivity, StatusError and StatusUnknown.
With StatusNoActivity, there will not be an ActivityCoordinator, so this
value can not be returned by the ActivityCoordinator.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500066 | StatusActive | Begin Activity; get coordinator; getStatus; suspend; getStatus | returns StatusActive both times |
jsr9500067 | StatusCompleting | Begin Activity; get coordinator; addAction a1 completion SignalSet; complete Activity, a1 will call getStatus | returns StatusCompleting |
jsr9500068 | StatusCompleted | Begin Activity; get coordinator; complete Activity; getStatus | returns StatusCompleted |
public int ActivityCoordinator.getParentStatus()
The following assertions are taken from the javadoc.
Returns the Status
of the Activity represented by the target ActivityCoordinator's
parent.
Straightforward to test status of active parent.
Note that OMG specification states that "The completing Activity is active on the thread when preCompletion is
sent. However, it is inactive on the thread when postCompletion is
generated ...". This call should be valid for the parent up until the point that postCompletion is sent.
If the targetOnce the parent is complete, then this function is equivalent to getStatus.ActivityCoordinator
represents a top-level Activity, then theStatus
of this top-level Activity is returned.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500069 | StatusActive | Begin Activity; begin child Activity; get coordinator; getParentStatus | returns StatusActive |
jsr9500071 | no parent | Begin Activity; get coordinator; getParentStatus | returns StatusActive |
jsr9500072 | parent completed | Begin Activity; begin child Activity; get coordinator; complete parent Activity (CompletionStatusFail); getParentStatus | returns StatusActive |
public String ActivityCoordinator.getName()
The following assertions are taken from the javadoc.
Returns a printable string describing the Activity represented by the target
ActivityCoordinator
.
Nothing testable.
public RecreateData ActivityCoordinator.hibernate()
The following assertions are taken from the javadoc.
On completion of this method the Activity is not associated with the thread and the target ActivityCoordinator instance is no longer valid.Thread association can be tested.
The HLS may call this method at any time prior to completion of an ActivityElse IllegalStateException results.
An Activity hierarchy that contains a transaction cannot be hibernated.Testing of transactions is not covered in the TCK.
Any active child Activities must be hibernated before the target Activity may be hibernatedElse ContextPendingException. Suspended child contexts ok.
ActivityPendingException - Thrown if the target Activity is associated with a thread other than the one on which the request is made. The HLS response should be to try again later when any asynchronous work on other threads has been suspendedThis could be because the activity is active on multiple threads (including the current thread) or a single thread that is not the current thread.
ContextPendingException - Thrown if the target Activity encompasses a child Activity that is not already hibernated or if the target Activity encompasses a transaction. The HLS response should be to complete any encompassed transaction and either complete or hibernate any encompassed child ActivitiesTest with active child activities (from the same HLS and different HLS in same ContextGroup). Testing of transactions is not covered here.
java.lang.IllegalStateException - Thrown if the Activity represented by the target ActivityCoordinator is not in a state where it can be hibernated.As above, if the activity is completing or completed (or hibernated).
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500301 | Thread Association | Begin Activity; get coordinator; hibernate; getStatus | returns StatusNoActivity |
jsr9500302 | ActivityCompleted | Begin Activity; get coordinator; Complete; hibernate | throws IllegalStateException |
jsr9500303 | ActivityCompleting | Begin Activity; get coordinator; addAction action1, synchronization SignalSet; Complete; from preCompletion Signal, call hibernate | throws IllegalStateException |
jsr9500304 | Active Child | Begin Activity; get coordinator; begin Activity (same HLS); hibernate; getStatus | hibernate throws ContextPendingException; getStatus returns StatusActive |
jsr9500305 | Active Child (same ContextGroup) | Begin Activity1 (HLS1, gp 1); get coordinator; Begin Activity2 (HLS2, gp 1); hibernate | throws ContextPendingException |
jsr9500306 | Suspended Child | Begin Activity1; get coordinator; Begin Activity2; suspend; hibernate | completes ok |
jsr9500308 | Context Active on multiple threads | Begin Activity; get coordinator; suspend Activity; resume Activity; resume Activity on thread 2; hibernate; getStatus | hibernate throws ActivityPendingException; getStatus returns StatusActive |
jsr9500309 | Context Active on different thread | Begin Activity; get coordinator; suspend Activity; resume Activity on thread 2; on thread 1, hibernate | throws ActivityPendingException |
public boolean ActivityCoordinator.isSameActivity(ActivityCoordinator coord)
The following assertions are taken from the javadoc.
ReturnsTest with the same coordinator and a different one.true
if the specifiedcoord
represents the same Activity as the targetActivityCoordinator
.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500075 | same Activity | Begin Activity; get coordinator; call isSameActivity on itself | returns true |
jsr9500076 | different Activity | Begin Activity; get coordinator; Begin second Activity; get coordinator; call isSameActivity with first coordinator | returns false |
public Action[] ActivityCoordinator.getActions(String signalSetName)
The following assertions are taken from the javadoc.
Returns all the Actions that have been registered with an interest in the specified signalSetName.Some Actions may be registered multiple times.
Only Actions registered with an interest in this SignalSet are returned by this operation.So Actions registered with other SignalSets or as Global Actions should not appear.
If there are none, then a zero element array is returned.Test for non-null empty array.
If this parameter is null then all global Actions are returned.Ensure non global Actions are not returned.
SignalSetUnknownException Thrown if the specified signalSet is not recognized.Check with names not supported by HLS.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500290 | Returns Actions | Begin Activity; get coordinator; add Actions to SignalSet1; add different Actions to SignalSet2; getActions(SignalSet1); getActions(SignalSet2); | returns correct Actions in each case. |
jsr9500291 | Effect of Global Actions | Begin Activity; get coordinator; add Actions to SignalSet1; add different Actions as global Actions; getActions(SignalSet1); getActions(null); | returns correct Actions in each case. |
jsr9500292 | No Actions registered | Begin Activity; get coordinator; getActions(SignalSet1); getActions(null); | returns EMPTY list in each case. |
jsr9500293 | Global Actions | Begin Activity; get coordinator; add Actions as global Actions; getActions(SignalSet1); getActions(null); | returns correct Actions in each case. |
jsr9500294 | Unknown SignalSet | Begin Activity; get coordinator; getActions(SignalSet1) where SignalSet1 is not supported by ServiceManager; | Throws SignalSetUnknownException |
public RecreateData ActivityCoordinator.setPersistent()
The following assertions are taken from the javadoc.
Indicates to the Activity service that any essential state
and future state transitions for the Activity
represented by the target ActivityCoordinator
needs to be logged.
The point, if any, at which the Activity needs to become recoverable is determined exclusively by the HLS that is using the Activity service.Testing of recovery functions is not covered in this document.
public Outcome ActivityCoordinator.completeActivity(int completionStatus)
The following assertions are taken from the javadoc.
Causes the Activity associated with the target ActivityCoordinator to complete with the specified CompletionStatus.Thus similar tests to those for UserActivity.complete could be used. Note however, the potential differences because this method may be called when the context is not associated with a thread.
The Activity service sets the Status to StatusCompleting before asking any completion SignalSet to start producing Signals.As with the UserActivity method, this state is set before any Synchronization Signals are produced (preCompletion precedes the completion SignalSet).
If there are any child active or suspended Activities or transactions and the CompletionStatus is CompletionStatusFail or CompletionStatusFailOnly then those child Activites will have their CompletionStatuses set to CompletionStatusFailOnly and any child transaction will be called to setRollbackOnlyAs the completing Activity may not be associated with a thread by virtue of being recreated (after a failure or hibernate operation), this assertion should also apply to child activities that have been recreated.
The UserActivity interface should be used in preference to the ActivityCoordinator for completing Activities in most circumstances. This method is provided primarily for use after recovery when the Activity to be completed is not associated with the calling thread.Testing of this function will therefore be limited to Activities that have been hibernated and recreated with resume=false (ie no thread association).
completionStatus - the CompletionStatus with which the target Activity should endThe CompletionStatus influences which Signals are sent.
The Outcome returned is both set by and given meaning by the SignalSet used for completionEnsure correct Outcome returned.
In the absence of a CompletionSignalSet a null Outcome object reference is returnedTest this assertion.
ActivityPendingException - Thrown if the thread from which the completion is initiated is not the only thread associated with the target Activity.Not applicable as there will be no thread association in these tests.
ContextPendingException - Thrown if the CompletionStatus is CompletionStatusSuccess and the target Activity encompasses active or suspended Activities or transactionsAs above, the child Activities may also be recreated.
NotOriginatorException - Thrown if an attempt is made by an application to end an Activity in a different execution environment from that in which the Activity was begun.Distributed Activities are not tested.
InvalidStateException - Thrown if the target Activity cannot be completed with the requested CompletionStatus, for example because the CompletionStatus may not be changed from CompletionStatusFailOnly to any other value, or if a null or invalid value is specified by completionStatus.Test these example scenarios.
ActivityNotProcessedException - Thrown if the signals required to complete this operation could not be produced. The Activity's final Status is StatusErrorThis is applicable to the case of distributed objects, where communication failures may occur. It will not be tested here.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500341 | completed Activity | Begin Activity; getCoord; get GlobalId; setPersistent; hibernate; recreate; completeActivity (CompletionStatusSuccess); getStatus | returns StatusCompleted |
jsr9500342 | completion SignalSet | Begin Activity; register Action1, Action2 and Action3 with completion SignalSet (using priorities to ensure they are called in sequence); Completion SignalSet has two Signals Signal1 and Signal2; Action1 responds to Signal1 with Outcome1 etc; completion SignalSet responds to Outcome1 with CoordinationInformation indicating isActionInterested false, useNextSignal false; completion SignalSet responds to Outcome2 with CoordinationInformation indicating isActionInterested true, useNextSignal true; completion SignalSet responds to Outcome3 with CoordinationInformation indicating isActionInterested true, useNextSignal true; gtGlobalId; setPersistent; hibernate; recreate; completeActivity (CompletionStatusFail) | Action1 is called for Signal1 only; Action2 is called for Signal1 and Signal2; Action3 is called for Signal2 only |
jsr9500343 | Encompassed Activity InvalidState | Begin Activity1 (HLS1, gp1); get Coord; get Globalid gid1; setPersistent; hibernate; recreate(parent=null, resume=false); begin Activity2 (HLS2, gp1); get Coord; get GlobalId gid2; setPersistent; hibernate; recreate(parent=gid1, resume=false); gid1 completeActivity (CompletionStatusFailOnly); gid2 completeActivity (CompletionStatusSuccess); | InvalidStateException |
jsr9500344 | Outcome from SignalSet | Begin Activity (HLS1, completion SignalSet returns Outcome1); register Action which responds with Outcome2; get GlobalId; setPersistent; hibernate; recreate; completeActivity (completionStatusFail); | Outcome1 is returned |
jsr9500346 | null Outcome | Begin Activity (HLS1, no completion SignalSet); get GlobalId; setPersistent; hibernate; recreate; completeActivity (CompletionStatusFail); | null is returned |
jsr9500347 | context pending | Begin Activity1 (HLS1, gp1); get GlobalId gid1; setPersistent; hibernate; recreate; begin Activity2 (HLS2, gp1); get GlobalId gid2; setPersistent; hibernate; recreate(parent=gid1); gid1 completeActivity (CompletionStatusSuccess) | ContextPendingException is thrown |
jsr9500348 | invalid state | Begin Activity1; get GlobalId; setPersistent; hibernate; recreate; completeActivity (-999) | InvalidStateException is thrown |
jsr9500349 | CompletionStatus passed to SignalSet | Begin Activity1; get GlobalId; setPersistent; hibernate; recreate; completeActivity (CompletionStatusSuccess) | SignalSet setCompletionStatus is called with CompletionStatusSuccess |
jsr9500350 | StatusCompleting | Begin Activity; addAction a1 completion SignalSet; get GlobalId; setPersistent; hibernate; recreate; completeActivity, a1 calls getStatus during processSignal; | returns StatusCompleting |
public Outcome ActivityCoordinator.heuristicComplete(int completionStatus)
The following assertions are taken from the javadoc.
Causes the Activity associated with the target ActivityCoordinator to complete with the specified CompletionStatus, but in a manner that acknowledges that the completion request has been driven heuristically.Test as for completeActivity.
The Activity service sets the Status to StatusCompletingHeuristic before asking any completion SignalSet to start producing Signals.Similar test to completeActivity.
This method may be used in an environment that is different from that in which the Activity to be completed was started. It is otherwise identical to completeActivity.As these tests do not cover distributed operation, the expected behaviour should be identical to completeActivity. Therefore the same tests can be repeated here.
Further assertions are identical to those of completeActivity, with the exception of the NotOriginatorException which is not thrown by heuristicComplete.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500361 | completed Activity | Begin Activity; getCoord; get GlobalId; setPersistent; hibernate; recreate; heuristicComplete (CompletionStatusSuccess); getStatus | returns StatusCompleted |
jsr9500362 | completion SignalSet | Begin Activity; register Action1, Action2 and Action3 with completion SignalSet (using priorities to ensure they are called in sequence); Completion SignalSet has two Signals Signal1 and Signal2; Action1 responds to Signal1 with Outcome1 etc; completion SignalSet responds to Outcome1 with CoordinationInformation indicating isActionInterested false, useNextSignal false; completion SignalSet responds to Outcome2 with CoordinationInformation indicating isActionInterested true, useNextSignal true; completion SignalSet responds to Outcome3 with CoordinationInformation indicating isActionInterested true, useNextSignal true; gtGlobalId; setPersistent; hibernate; recreate; heuristicComplete (CompletionStatusFail) | Action1 is called for Signal1 only; Action2 is called for Signal1 and Signal2; Action3 is called for Signal2 only |
jsr9500363 | Encompassed Activity InvalidState | Begin Activity1 (HLS1, gp1); get Coord; get Globalid gid1; setPersistent; hibernate; recreate(parent=null, resume=false); begin Activity2 (HLS2, gp1); get Coord; get GlobalId gid2; setPersistent; hibernate; recreate(parent=gid1, resume=false); gid1 heuristicComplete (CompletionStatusFailOnly); gid2 completeActivity (CompletionStatusSuccess); | InvalidStateException |
jsr9500364 | Outcome from SignalSet | Begin Activity (HLS1, completion SignalSet returns Outcome1); register Action which responds with Outcome2; get GlobalId; setPersistent; hibernate; recreate; heuristicComplete (completionStatusFail); | Outcome1 is returned |
jsr9500366 | null Outcome | Begin Activity (HLS1, no completion SignalSet); get GlobalId; setPersistent; hibernate; recreate; heuristicComplete (CompletionStatusFail); | null is returned |
jsr9500367 | context pending | Begin Activity1 (HLS1, gp1); get GlobalId gid1; setPersistent; hibernate; recreate; begin Activity2 (HLS2, gp1); get GlobalId gid2; setPersistent; hibernate; recreate(parent=gid1); gid1 heuristicComplete (CompletionStatusSuccess) | ContextPendingException is thrown |
jsr9500368 | invalid state | Begin Activity1; get GlobalId; setPersistent; hibernate; recreate; heuristicComplete (-999) | InvalidStateException is thrown |
jsr9500369 | CompletionStatus passed to SignalSet | Begin Activity1; get GlobalId; setPersistent; hibernate; recreate; heuristicComplete (CompletionStatusSuccess) | SignalSet setCompletionStatus is called with CompletionStatusSuccess |
jsr9500370 | StatusCompletingHeuristic | Begin Activity; addAction a1 completion SignalSet; get GlobalId; setPersistent; hibernate; recreate; heuristicComplete, a1 calls getStatus during processSignal; | returns StatusCompletingHeuristic |
public Outcome ActivityCoordinator.processSignalSet(String signalSetName, int completionStatus)
The following assertions are taken from the javadoc.
Causes the SignalSet specified by signalSetName to start producing signals for all registered Actions at times other than during completion.Test by registering Actions with a suitable SignalSet.
No specific information is given about whether the Activity context needs to be associated with the thread of execution, so no testing of this is possible.
signalSetName - the name of the SignalSet that is to produce signalsEnsure the named SignalSet is used.
The completionStatus may influence the signals that are produced.So it must be passed to the SignalSet, as with completeActivity.
The Outcome returned is both set by and given meaning by the specified SignalSet. It may be null.Test as for completeActivity.
SignalSetUnknownException - Thrown if the specified signalSetName is not recognizedSignalSet is not supported by the HLS ServiceManager.
ActivityNotProcessedException - Thrown if the signals required to complete this operation could not be produced. The Activity's final Status is StatusErrorThis is applicable to the case of distributed objects, where communication failures may occur. It will not be tested here.
InvalidActivityException - Thrown if the SignalSet is already producing signals or if the Activity has completed.Both cases can be tested.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500381 | CompletionStatus unaffected | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1 (where act1 throws ActionErrorException); processSignalSet(s1, success); getCompletionStatus | returns CompletionStatusSuccess; |
jsr9500382 | Status unaffected | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1 (where act1 throws ActionErrorException); processSignalSet(s1, success); getStatus | returns StatusActive; |
jsr9500383 | Use specified SignalSet | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1; addAction act2, SignalSet s2 (completion SignalSet); processSignalSet(s1, success); | action act1 is called; act2 is not. |
jsr9500384 | No completion | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1; addAction act2, Synchronization SignalSet; processSignalSet(s1, success); coord getStatus | act2 is not called. status is StatusActive |
jsr9500385 | Unknown SignalSet | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; processSignalSet(s1, success); | SignalSetUnknownException is thrown |
jsr9500386 | Returned Outcome | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; SignalSet s1 returns outcome O1; processSignalSet(s1, success); | Outcome O1 is returned (even though no Signals produced) |
jsr9500387 | Returned Outcome Null | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; SignalSet s1 returns outcome null; processSignalSet(s1, success); | null Outcome returned. |
jsr9500388 | Multiple Calls | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1 (completion SignalSet); processSignalSet(s1, success); processSignalSet(s1, success); complete | act1 is called three times for each Signal from s1 |
jsr9500389 | CompletionStatus passed to SignalSet | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1 (completion SignalSet); processSignalSet(s1, success); | s1 receives call to setCompletionStatus |
jsr9500390 | InvalidActivity - completed | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1 (completion SignalSet); complete; processSignalSet(s1, success); | InvalidActivityException thrown |
jsr9500391 | InvalidActivity already processing | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1; act1 will call processSignalSet(s1, success) when called; processSignalSet(s1, success); | InvalidActivityException from act1 call. |
jsr9500392 | Processing TWO SignalSets | Begin Activity; setCompletionStatus CompletionStatusSuccess; getCoord; addAction act1, SignalSet s1; addAction act2, SignalSet s2; act1 will call processSignalSet(s2, success) when called; processSignalSet(s1, success); | All Signals processed from both SignalSets |
public ActivityToken ActivityManager.suspend()
The following assertions are taken from the javadoc.
Suspends the association of the current Activity from the calling thread of execution along with any child Activities of the same ContextGroup nested within that ActivityChild contexts are those Activities that belong to the same ContextGroup and were started when the current Activity was active. They may belong to different HLS/ServiceManagers.
There are a number of implications to this statement
If the suspended Activity is nested within a parent then the parent Activity becomes associated with the thread on completion of this methodBecause of the cooperative management of Activities within the same ContextGroup, the suspend operation may affect the current Activity of all HLS/ServiceManagers that belong to the ContextGroup of the suspending HLS.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
Any existing Activities are not affected.
if the calling thread is not associated with any Activity then null is returnedTest this assertion.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500090 | Service not registered | suspend (); | ServiceNotRegisteredException thrown. |
jsr9500101 | context and child contexts suspended | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp2); begin Activity3 (HLS3, gp1); suspend (HLS1); HLS1.getStatus; HLS2.getStatus; HLS3.getStatus | HLS1 StatusNoActivity; HLS2 StatusActive; HLS3 StatusNoActivity |
jsr9500102 | context on other threads | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp2); begin Activity3 (HLS3, gp1); suspend (HLS1); resume (HLS1); suspend (HLS2); resume (HLS2); resume (HLS1) on thread2; resume (HLS2) on thread2; suspend (HLS1) thread1; HLS1.getStatus on thread2; HLS2.getStatus on thread2; HLS3.getStatus on thread2 | HLS1 StatusActive; HLS2 StatusActive; HLS3 StatusActive |
jsr9500103 | parent context | Begin Activity1 (HLS1, gp1); get coordinator coord1; begin Activity2 (HLS1, gp1); get coordinator coord2; coord2.isSameActivity (coord1); begin Activity3 (HLS2, gp1); suspend (HLS1); getStatus (HLS2); get coordinator coord3 (HLS1); coord3.isSameActivity (coord1) | isSameActivity false; HLS2 StatusNoActivity; isSameActivity true |
jsr9500104 | null context | suspend; | null is returned |
public void ActivityManager.resume(ActivityToken activity)
The following assertions are taken from the javadoc.
Resumes the association of the Activity and any nested Activities and transactions, represented by the ActivityToken with the calling thread of execution.This is the complement to suspend. The resume operation may be performed on any thread.
If there is an Activity associated with the thread prior to the method invocation then the re-associated Activity is resumed as a child of the Activity that is already on the thread.This must be read in conjunction with the next assertion
Any such parent Activity must be the same parent Activity within which the child Activity was originally begun.This means that the Activity hierarchy is fixed and cannot be changed through the use of suspend/resume. Note also that in order to resume an Activity on a different thread, the same parent context must exist on that thread.
The exception to this is when the parent Activity has completed, in which case the parent's parent becomes the new context into which the suspended Activity is resumed.
If the specified ActivityToken is null, then no new association is made
InvalidActivityException - May be thrown if the specified ActivityToken was not obtained by a prior call to suspend or if the ActivityToken does not represent a valid Activity or Activity hierarchy. No new association is madeThis may happen when a suspended Activity has been completed so that the ActivityToken no longer represents a valid Activity or activity hierarchy.
This may also occur if
the token used was the result of a suspendGroup
or
suspendAll
operation.
InvalidParentContextException - thrown if the parent Activity is different from that in which the resumed Activity was begun. No new association is madeSee above
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
None of the Activities in the token will be resumed.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500091 | Service not registered | resume null | ServiceNotRegisteredException thrown. |
jsr9500105 | different thread | Begin Activity1 (HLS1, gp1); get coordinator coord1; begin Activity2 (HLS2, gp1); get coordinator coord2; suspend (HLS1) resume on thread 2; thread2, HLS1 get coordinator coord3; thread2, HLS2 get coordinator coord4; coord3.isSameActivity(coord1); coord4.isSameActivity(coord2); | isSameActivity returns true for both cases. |
jsr9500106 | invalid parent | Begin Activity1 (HLS1, gp1); get coordinator coord1; suspend; resume; resume thread2; thread1 begin Activity2 (HLS2, gp1); thread1 begin Activity3 (HLS1); thread1 begin Activity4 (HLS2); thread1 suspend (HLS1); thread2 resume; thread2, HLS1 get coordinator coord2; coord2.isSameActivity (coord1) | thread2 resume fails with InvalidParentException thrown; isSameActivity returns true |
jsr9500107 | invalid parent | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); suspend HLS2; begin Activity3 (HLS1); resume HLS2; | InvalidParentException thrown |
jsr9500108 | null token | resume null; getStatus | StatusNoActivity returned |
jsr9500109 | invalid activity | begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 suspend; HLS1 resume; HLS2 complete; on thread2; HLS1 resume; HLS1 getStatus; | InvalidActivityException thrown on resume on thread 2; getStatus returns StatusNoActivity |
jsr9500110 | new parent | begin Activity (HLS1, gp1); begin Activity (HLS2, gp1); suspend HLS2; complete HLS1; resume HLS2; | no exceptions thrown |
public ActivityToken ActivityManager.suspendGroup()
The following assertions are taken from the javadoc.
Suspends the association of the current Activity from the calling thread of execution along with any Activities belonging to the same ContextGroup.This method will suspend all Activity contexts belonging to the ContextGroup from the thread.
Transaction context is also suspended if the Activity belongs to the default ContextGroup.Transaction testing is not covered in this document.
If the calling thread is not associated with any Activity then null is returnedTest assertion.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
Any existing Activities are not affected.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500092 | Service not registered | suspendGroup | ServiceNotRegisteredException thrown. |
jsr9500112 | suspends all | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); begin Activity3 (HLS3, gp1); begin Activity4 (HLS4, gp2); HLS2 suspendGroup; HLS1 getStatus; HLS2 getStatus; HLS3 getStatus; HLS4 getStatus | Status for HLS1, 2 & 3 is StatusNoActivity; Status for HLS4 is StatusActive |
jsr9500115 | No Activity | begin Activity (HLS1, gp1); HLS2 (gp2) suspendGroup; | returns null |
public void ActivityManager.resumeGroup(ActivityToken activity)
The following assertions are taken from the javadoc.
Resumes the association of the hierarchy of Activities and transactions represented by the ActivityToken with the calling thread of execution.This is the complement to suspendGroup. The resume operation may be performed on any thread.
The ActivityToken represents a hierarchy of Activities in a single ContextGroup and must have been obtained by a prior call to suspendGroupInvalidActivityException, see below.
There must be no Activity belonging to this ContextGroup active on the thread at the initiation of this operationInvalidParentContextException thrown
If the specified ActivityToken is null, then no new association is madeTest assertion.
InvalidActivityException - May be thrown if the specified ActivityToken
was not obtained by a prior call to suspendGroup
or if the ActivityToken does not represent a valid Activity or Activity hierarchy.
No new association is made
As in the case of resume
if any of the Activities represented
by the token have been completed, then this exception is thrown and no
context is resumed.
InvalidParentContextException - thrown if an Activity belonging to the same ContextGroup as the resuming Activities is already associated with the thread of execution. No new association is madeThis is covered above.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
None of the Activities in the token will be resumed.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500093 | Service not registered | resumeGroup null | ServiceNotRegisteredException thrown. |
jsr9500116 | resumes all | begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 get coordinator coord1; HLS2 get coordinator coord2; HLS1 suspendGroup; HLS1 resumeGroup; on thread 2; HLS1 resumeGroup; HLS1 getStatus; HLS2 getStatus; HLS1 get coordinator coord3; HLS2 get coordinator coord4; coord1.isSameActivity coord3; coord2.isSameActivity coord4; | status is StatusActive in both cases; isSameActivity returns true in both cases. |
jsr9500117 | invalid parent | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 suspendGroup; begin Activity3 (HLS3, gp1); HLS1 resumeGroup; | InvalidParentException thrown |
jsr9500118 | invalid parent | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 suspendGroup; begin Activity3 (HLS3, gp2); HLS1 resumeGroup; | resumeGroup succeeds |
jsr9500119 | null token | HLS1 resumeGroup passing nulltoken; HLS1 getStatus; | returns StatusNoActivity; |
jsr9500120 | invalid activity | begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 suspendGroup; HLS1 resumeGroup; HLS2 complete; on thread2; HLS1 resumeGroup; HLS1 getStatus; | InvalidActivityException thrown on resumeGroup; getStatus returns StatusNoActivity |
public ActivityToken ActivityManager.suspendAll()
The following assertions are taken from the javadoc.
Suspends the association of all transaction and Activities from the calling thread of execution On completion of this method, no transaction or Activity remains associated with the threadTest assertion.
If the calling thread is not associated with any Activity then null is returnedSpecial case
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
Any existing Activities are not affected.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500094 | Service not registered | suspendAll | ServiceNotRegisteredException thrown. |
jsr9500121 | all context suspended | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp2); begin Activity3 (HLS3, gp1); begin Activity4 (HLS1); HLS5 (gp3) suspendAll; HLS1 getStatus; HLS2 getStatus; HLS3 getStatus; | suspendAll does not return null; All getStatus calls return StatusNoActivity |
jsr9500122 | no Activity | HLS1 suspendAll; | suspendAll returns null; |
public void ActivityManager.resumeAll(ActivityToken
activity)
The following assertions are taken from the javadoc.
Resumes the association of all transactions and Activities represented by the ActivityToken with the calling thread of execution.This is the complement to suspendAll. The resume operation may be performed on any thread.
There must be no transaction or Activity active on the thread at the initiation of this operation.This will result in the InvalidParentContextException (see below).
If the specified ActivityToken is null, then no new association is madenull token is equivalent to no Activity.
InvalidActivityException - May be thrown if the specified ActivityToken was not obtained by a prior call to suspendAll or if the ActivityToken does not represent a valid hierarchy of transactions and Activities. No new association is madeAs mentioned previously, this could be the case if the ActivityToken represents an Activity or hierarchy in which (one of) the suspended Activity has been completed and is thus no longer a valid Activity. Note that none of the Activities are resumed, even if just one of them is invalid.
This exception will also be thrown if
the token used was the result of a suspendGroup
or
suspend
operation.
InvalidParentContextException - thrown if a transaction or Activity is already associated with the thread of execution. No new association is madesee above.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
None of the Activities in the token will be resumed.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500095 | Service not registered | resumeAll null | ServiceNotRegisteredException thrown. |
jsr9500124 | all context resumed | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp2); HLS1 get coordinator coord1; HLS2 get coordinator coord2; begin Activity3 (HLS3, gp1); begin Activity4 (HLS1); HLS5 suspendAll; thread2 HLS5 resumeAll; HLS1 getStatus; HLS2 getStatus; HLS1 complete; HLS1 get coordinator coord3; HLS2 get coordinator coord4; coord1.isSameActivity coord3; coord2.isSameActivity coord4; | status is StatusActive in both cases; isSameActivity returns true in both cases. |
jsr9500125 | Invalid Parent | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp2); HLS1 suspendAll; begin Activity (HLS3, gp3); HLS1 resumeAll; HLS1.getStatus; HLS2 getStatus | InvalidParentException thrown on resumeAll; getStatus calls result in StatusNoActivity |
jsr9500126 | null token | HLS1 resumeAll (null); HLS1 getStatus; | StatusNoActivity returned. |
jsr9500127 | invalid Activity | begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp2); begin Activity3 (HLS3, gp2); HLS1 suspendAll; HLS1 resumeAll; HLS3 complete; on thread2; HLS1 resumeAll; HLS1 getStatus; | InvalidActivityException thrown on resumeAll; getStatus returns StatusNoActivity |
ActivityToken
CompletionStatus
public boolean GlobalId.equals(GlobalId gid)
The following assertions are taken from the javadoc.
This object's equals method returns true if the parameter object represents the same Activity as the target object.Test with self and different Activity and null.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500130 | same Activity | Begin Activity1 (HLS1); getGlobalId gid; gid.isEqual (gid) | returns true; |
jsr9500131 | different Activity | Begin Activity1 (HLS1); getGlobalId gid1; Begin Activity2 (HLS2); getGlobalId gid2; gid1.isEqual (gid2) | returns false; |
jsr9500132 | null GlobalId | Begin Activity1 (HLS1); getGlobalId gid; gid.isEqual (null) | returns false; |
Status
There are no tests specified for this interface.
Some general assertions:
The UserActivity interface defines the methods offered to a high-level service (HLS) constructed on top of the Activity service framework.
These methods control the demarcation scope of an Activity associated with the calling thread of execution.
The specific behaviour of an individual HLS is encapsulated by a ServiceManager.
An instance
of the UserActivity interface has a ServiceManager
registered
with it prior to any Activities being begun by that instance.
Each Activity started by a UserActivity instance is an
Activity instance of the HLS represented by the registered
ServiceManager
.
Methods of the UserActivity interface that operate on the active Activity context are operating on the HLS Activity instance most recently associated with the calling thread.Specific tests that relate to these assertions are detailed below.
public void UserActivity.begin(int timeout)
The following assertions are taken from the javadoc.
Create a new Activity and associates it with the current thread.Subsequent UserActivity methods will operate on this new Activity (until another begin is called). Activities begun by other HLSs, whether in the same ContextGroup or not, will not change the current context for this UserActivity/HLS instance.
timeout can have the following possible values: any positive value; -1; 0.Indicating valid values. See OMG assertions below for meaning of these values.
InvalidStateException - Thrown if the parent Activity has been marked as CompletionStatusFailOnlyThis marking can be done explicitly, via setCompletionStatus or indirectly if the parent's parent completes with CompletionStatusFail.
Note that the parent Activity may be from another HLS in the same ContextGroup.
TimeoutRangeException - Thrown if timeout is less than -1 or if it is outside an administratively configured range in the deployed systemOnly values less than -1 can be tested here.
ServiceNotRegisteredException - Thrown if no ServiceManager has been registeredNo new Activity created.
The following assertions come from the OMG spec.
timeout of -1 indicates Activity will never timeoutIndicating that -1 is a valid value.
timeout of 0 indicates the last value specified using the setTimeout method is usedZero is also a valid value.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500151 | new Activity | Begin Activity1 (HLS1, gp1); get coordinator coord1; begin Activity2 (HLS2, gp1); HLS1 get coordinator coord2; begin Activity3 (HLS3, gp2); HLS1 get coordinator coord3; coord1.isSameActivity (coord2); coord1.isSameActivity (coord3); | coord1 is non null; isSameActivity returns true in both cases. |
jsr9500152 | parent Activity failed | Begin Activity1 (HLS1, gp1); setCompletionStatus (CompletionStatusFailOnly); begin Activity2 (HLS2, gp1); HLS2 getStatus; begin Activity3 (HLS1); | begin Activity2 fails with InvalidStateException; getStatus returns StatusNoActivity; begin Activity3 fails with InvalidStateException; |
jsr9500153 | timeout < -1 | Begin Activity1, timeout -2; | TimeoutRangeException thrown |
jsr9500154 | timeout values | Begin Activity1, timeout -1; begin Activity2, timeout 0; | both begins succeed. |
jsr9500155 | no service | Begin Activity1 before ServiceManager registered | ServiceNotRegisteredException thrown |
public Outcome UserActivity.complete()
The following assertions are taken from the javadoc.
Causes the active Activity context to be completed with its current CompletionStatusA completed Activity is no longer associated with any thread. The CompletionStatus influences which Signals are sent by the Synchronization SignalSet and the completion SignalSet. For example, the preCompletion Signal is only sent if the CompletionStatus is CompletionStatusSuccess.
If a CompletionSignalSet is used by the registered ServiceManager, then it will be driven by the Activity service to obtain completion signals to distribute to any registered Actions.In addition, the Outcome returned by each Action in response to a Signal is passed back to the SignalSet (using the setResponse method) which in turn returns a
CoordinationInformation
object to the Activity Service to indicate
how to proceed.
If the Activity is nested within a parent, then the parent Activity becomes associated with the thread.The parent Activity is the Activity in the same ContextGroup that was associated with the thread at the time the completing Activity was begun. This parent Activity must already be associated with the thread (it may come from a different HLS).
If there are any child active or suspended Activities or transactions and the CompletionStatus is CompletionStatusFail or CompletionStatusFailOnly then those child Activites will have their CompletionStatus set to CompletionStatusFailOnly and any child transaction will be called to setRollbackOnly.The case of transactions will be ignored.
The Outcome returned is both set by and given meaning by the SignalSet used for completion.There is no stipulation that any Actions need to have registered or been called by the SignalSet.
In the absence of a CompletionSignalSet a null Outcome object reference is returned.The ServiceManager.getCompletionSignalSetName javadoc specifies that a null return value indicates that no CompletionSignalSet has been set.
NoActivityException - Thrown if there is no Activity associated with the calling thread of execution.No Activity created by the HLS/UserActivity that is calling complete.
ActivityPendingException - Thrown if the thread from which the completion is initiated is not the only thread associated with the target Activity.Ensure that it is only active threads that result in an exception. If an Activity was active on a second thread, but has been suspended, then the completion should proceed.
ContextPendingException - Thrown if the CompletionStatus is CompletionStatusSuccess and the target Activity encompasses active or suspended Activities or transactionsAgain, the case of transactions will be ignored in these tests.
NotOriginatorException - Thrown if an attempt is made by an application to end an Activity in a different execution environment from that in which the Activity was begun.Distributed Activities are not tested.
ActivityNotProcessedException - Thrown if the signals required to complete this operation could not be produced. The Activity's finalThis is applicable to the case of distributed objects, where communication failures may occur. It will not be tested here.Status
isStatusError
.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
Test assertion.
The following are taken from the OMG spec
causes the Activity associated with the current thread to complete with its current CompletionStatus or CompletetionStatusFail if none has been specified using setCompletionStatus.Detailing the default value of an Activity's CompletionStatus
The following are taken from the JSR95 spec.
ActionError: this pre-defined Outcome is created by the ActivityCoordinator and returned to a SignalSet if the ActivityCoordinator receives an ActionErrorException on an Action.processSignal() request.The ActionErrorException can be tested by registering a suitable Action with the coordinator and ensuring that the correct Outcome is passed to the SignalSet during setResponse.
ActionSystemException: this pre-defined Outcome is created by the ActivityCoordinator and returned to a SignalSet if the ActivityCoordinator receives a system exception on an Action.processSignal() request.A system exception is an 'unchecked' runtime exception (such as NullPointerException).
The received exception is passed back to the SignalSet in the extended data of the Outcome and can be retrieved via the getExtendedValue method.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500001 | Action Error | Begin Activity; register Action with completion SignalSet (Action throws ActionErrorException on receipt of Signal); setCompletionStatus CompletionStatusSuccess; complete | Completion SignalSet receives org.omg.CosActivity.ActionError Outcome on setResponse |
jsr9500006 | ActionSystemException | Begin Activity; register Action with completion SignalSet (Action throws java.lang.Exception on receipt of Signal); setCompletionStatus CompletionStatusSuccess; complete | Completion SignalSet receives org.omg.CosActivity.ActionSystemException Outcome on setResponse; Outcome.getExtendedValue returns the Exception thrown by the Action. |
jsr9500007 | Pre-defined SignalSets invoked | Begin Activity; register Action with org.omg.CosActivity.Synchronization; setCompletionStatus CompletionStatusSuccess; complete | Action is called with preCompletion then postCompletion Signals |
jsr9500160 | completed Activity | Begin Activity; setCompletionStatus; complete; getStatus | returns StatusNoActivity |
jsr9500161 | completion SignalSet | Begin Activity; register Action1, Action2 and Action3 with completion SignalSet (using priorities to ensure they are called in sequence); Completion SignalSet has two Signals Signal1 and Signal2; Action1 responds to Signal1 with Outcome1 etc; completion SignalSet responds to Outcome1 with CoordinationInformation indicating isActionInterested false, useNextSignal false; completion SignalSet responds to Outcome2 with CoordinationInformation indicating isActionInterested true, useNextSignal true; completion SignalSet responds to Outcome3 with CoordinationInformation indicating isActionInterested true, useNextSignal true; complete | Action1 is called for Signal1 only; Action2 is called for Signal1 and Signal2; Action3 is called for Signal2 only |
jsr9500162 | parent Activity | Begin Activity1 (HLS1); get coordinator coord1; begin Activity2 (HLS1); complete; get coordinator coord2; coord1.isSameActivity (coord2) | returns true |
jsr9500163 | Encompassed Activity | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS2 setCompletionStatus (CompletionStatus.CompletionStatusSuccess); HLS1 setCompletionStatus.CompletionStatusFailOnly; HLS1 complete; HLS2 getCompletionStatus | CompletionStatus should be CompletionStatusFailOnly |
jsr9500164 | Encompassed Activity | Begin Activity (HLS1, gp1); begin Activity (HLS2, gp1); HLS2 setCompletionStatus (CompletionStatus.CompletionStatusSuccess); HLS2 suspend Activity; HLS1 complete (default CompletionStatus CompletionStatusFail); HLS2 resume Activity; HLS2 getCompletionStatus | HLS2 CompletionStatus is CompletionStatusFailOnly |
jsr9500165 | Outcome from SignalSet | Begin Activity (HLS1, completion SignalSet returns Outcome1); register Action which responds with Outcome2; complete; | Outcome1 is returned |
jsr9500166 | Outcome from SignalSet | Begin Activity (HLS1, completion SignalSet returns Outcome1); complete; | Outcome1 is returned |
jsr9500167 | null Outcome | Begin Activity (HLS1, no completion SignalSet); complete; | null is returned |
jsr9500168 | No Activity | complete; | NoActivityException is thrown |
jsr9500169 | No Activity | begin Activity (HLS1, gp1); HLS2 (gp1) complete; | NoActivityException is thrown |
jsr9500170 | More than 1 active thread | Begin Activity; suspend Activity; resume Activity; resume Activity on thread 2; complete; | ActivityPendingException is thrown |
jsr9500171 | More than 1 active thread | Begin Activity; suspend Activity; resume Activity; resume Activity on thread 2; suspend Activity on thread 2; complete (thread1) | Normal completion |
jsr9500172 | More than 1 active thread | Begin Activity; suspend Activity; resume Activity on thread 2; complete on thread 2 | Normal completion |
jsr9500173 | context pending | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 setCompletionStatus CompletionStatusSuccess; HLS1 complete; | ContextPendingException is thrown |
jsr9500174 | context pending | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); suspend Activity2; HLS1 setCompletionStatus CompletionStatusSuccess; HLS1 complete; | ContextPendingException is thrown |
jsr9500159 | context pending | Begin Activity1 (HLS1, gp1); suspend Activity1; resume Activity1; thread2, resume Activity1; thread2, begin Activity2 (HLS2, gp1); thread2 suspend Activity1; HLS1 setCompletionStatus CompletionStatusSuccess; thread1, HLS1 complete; | ContextPendingException is thrown |
jsr9500156 | Service not registered | complete | ServiceNotRegisteredException is thrown |
public Outcome UserActivity.completeWithStatus(int completionStatus)
complete
method, with additions detailed below.
Thus, the same set of tests can be used, with some supplementary tests
to cover the additional assertions.
The following assertions are taken from the javadoc.
InvalidStateException - thrown if the target Activity cannot be completed with the requestednull is not applicable here, but invalid CompletionStatus values must be tested.CompletionStatus
, for example because theCompletionStatus
may not be changed fromCompletionStatusFailOnly
to any other value, or if a null or invalid value is specified by completionStatus.
From the OMG spec
causes the Activity associated with the current thread to complete and use the CompletionStatus provided if this does not conflict with any that has previously been set using setCompletionStatusJust reiterating the InvalidStateException
if the Activity cannot complete in the status required then the ACTIVITY_COMPLETED exception will be thrown
The following is from the JSR95 spec, figure 7 showing sequence of operations during completion processing
9. It sets this CompletionStatus into the completion SignalSet, to influence the completion Signals produced.Ensure the Activity Service does pass the completion status to the SignalSet. This also applies to the
complete
method.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500175 | completed Activity | Begin Activity; completeWithStatus (CompletionStatusSuccess); getStatus | returns StatusNoActivity |
jsr9500176 | completion SignalSet | Begin Activity; register Action1, Action2 and Action3 with completion SignalSet (using priorities to ensure they are called in sequence); Completion SignalSet has two Signals Signal1 and Signal2; Action1 responds to Signal1 with Outcome1 etc; completion SignalSet responds to Outcome1 with CoordinationInformation indicating isActionInterested false, useNextSignal false; completion SignalSet responds to Outcome2 with CoordinationInformation indicating isActionInterested true, useNextSignal true; completion SignalSet responds to Outcome3 with CoordinationInformation indicating isActionInterested true, useNextSignal true; completeWithStatus (CompletionStatusFail) | Action1 is called for Signal1 only; Action2 is called for Signal1 and Signal2; Action3 is called for Signal2 only |
jsr9500177 | parent Activity | Begin Activity1 (HLS1); get coordinator coord1; begin Activity2 (HLS1); completeWithStatus (CompletionStatusFail); get coordinator coord2; coord1.isSameActivity (coord2) | returns true |
jsr9500178 | Encompassed Activity | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS2 setCompletionStatus (CompletionStatus.CompletionStatusSuccess); HLS1 completeWithStatus (CompletionStatusFailOnly); HLS2 getCompletionStatus | CompletionStatus should be CompletionStatusFailOnly |
jsr9500179 | Encompassed Activity | Begin Activity (HLS1, gp1); begin Activity (HLS2, gp2); HLS2 setCompletionStatus (CompletionStatus.CompletionStatusSuccess); HLS2 suspend Activity; HLS1 completeWithStatus (CompletionStatusFail); HLS2 resume Activity; HLS2 getCompletionStatus | HLS2 CompletionStatus is CompletionStatusFailOnly |
jsr9500180 | Outcome from SignalSet | Begin Activity (HLS1, completion SignalSet returns Outcome1); register Action which responds with Outcome2; completeWithStatus (completionStatusFail); | Outcome1 is returned |
jsr9500181 | Outcome from SignalSet | Begin Activity (HLS1, completion SignalSet returns Outcome1); completeWithStatus (CompletionStatusFail); | Outcome1 is returned |
jsr9500182 | null Outcome | Begin Activity (HLS1, no completion SignalSet); completeWithStatus (CompletionStatusFail); | null is returned |
jsr9500183 | No Activity | completeWithStatus (CompletionStatusSuccess) | NoActivityException is thrown |
jsr9500184 | No Activity | Begin Activity (HLS1, gp1); HLS2 (gp1) completeWithStatus (CompletionStatusFailOnly); | NoActivityException is thrown |
jsr9500185 | More than 1 active thread | Begin Activity; suspend Activity; resume Activity; resume Activity on thread 2; completeWithStatus (CompletionStatusSuccess) | ActivityPendingException is thrown |
jsr9500186 | More than 1 active thread | Begin Activity; suspend Activity; resume Activity; resume Activity on thread 2; suspend Activity on thread 2; completeWithStatus (CompletionStatusSuccess) (thread1) | Normal completion |
jsr9500187 | More than 1 active thread | Begin Activity; suspend Activity; resume Activity on thread 2; completeWithStatus (CompletionStatusFail) on thread 2 | Normal completion |
jsr9500188 | context pending | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); HLS1 completeWithStatus (CompletionStatusSuccess) | ContextPendingException is thrown |
jsr9500189 | context pending | Begin Activity1 (HLS1, gp1); begin Activity2 (HLS2, gp1); suspend Activity2; HLS1 completeWithStatus (CompletionStatusSuccess) | ContextPendingException is thrown |
jsr9500190 | invalid state | Begin Activity; setCompletionStatus (CompletionStatusFailOnly); completeWithStatus (CompletionStatusSuccess) | InvalidStateException is thrown |
jsr9500191 | invalid state | Begin Activity1; completeWithStatus (-999) | InvalidStateException is thrown |
jsr9500192 | CompletionStatus passed to SignalSet | Begin Activity1; completeWithStatus (CompletionStatusSuccess) | SignalSet setCompletionStatus is called with CompletionStatusSuccess |
jsr9500157 | Service not registered | completeWithStatus (CompletionStatusSuccess) | ServiceNotRegisteredException is thrown |
public void UserActivity.setCompletionStatus(int completionStatus)
The following assertions are taken from the javadoc.
Sets the CompletionStatus of the active ActivityWhich should be visible using getCompletionStatus from any thread where the Activity is active.
This method may be called multiple times before the Activity is completed, and the CompletionStatus may be changed between CompletionStatusSuccess and CompletStatusFail to indicate a point in time value.From the same or different threads.
Once the CompletionStatus has been set to CompletionStatusFailOnly, it may not be changed againInvalidStateException (see below)
NoActivityException - Thrown if there is no Activity associated with the calling thread of execution.As with previous methods.
InvalidStateException - Thrown if an attempt is made to update a CompletionStatus of CompletionStatusFailOnly or if a null or invalid value is specified by completionStatus.Tests used for
completeWithStatus
are appropriate here.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
if this method is not called during the Activity's lifetime, the defult status is CompletionStatusFailDefault value of CompletionStatus
if the completionStatus is CompletionStatusFailOnly and an attempt is made to change the status to anything other the CompletionStatusFailOnly, the InvalidState exception will be thrownReiterating the assertion in the javadoc
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500195 | set CompletionStatus | Begin Activity; suspend Activity; resume Activity; (thread2) resume Activity; (thread2) setCompletionStatus (CompletionStatusSuccess); (thread1) getCompletionStatus | returns CompletionStatusSuccess |
jsr9500196 | multiple calls | Begin Activity; suspend Activity; resume Activity; (thread2) resume Activity; (thread1) setCompletionStatus (CompletionStatusSuccess); (thread1) setCompletionStatus (CompletionStatusSuccess); (thread2) setCompletionStatus (CompletionStatusSuccess); (thread1) setCompletionStatus (CompletionStatusFail); (thread1) setCompletionStatus (CompletionStatusFail); (thread2) getCompletionStatus | returns CompletionStatusFail |
jsr9500197 | no activity | setCompletionStatus (CompletionStatusSuccess); | NoActivityException is thrown |
jsr9500198 | invalid state | Begin Activity; setCompletionStatus (CompletionStatusFailOnly); setCompletionStatus (CompletionStatusSuccess) | InvalidStateException is thrown |
jsr9500199 | invalid state | Begin Activity; setCompletionStatus (999); | InvalidStateException is thrown |
jsr9500194 | default state | Begin Activity; getCompletionStatus | returns CompletionStatusFail |
jsr9500158 | Service not registered | setCompletionStatus (CompletionStatusSuccess) | ServiceNotRegisteredException is thrown |
public int UserActivity.getCompletionStatus()
The following assertions are taken from the javadoc.
Returns the current value of the CompletionStatus of the active Activity.This has been tested in previous methods
NoActivityException - Thrown if there is no Activity associated with the calling thread of execution.As with previous methods.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500200 | no activity | getCompletionStatus | NoActivityException is thrown |
jsr9500193 | Service not registered | getCompletionStatus | ServiceNotRegisteredException is thrown |
public int UserActivity.getStatus()
The following assertions are taken from the javadoc.
Returns the current value of the Status of the active Activity.There are six Status enumerations; StatusActive, StatusCompleted, StatusCompleting, StatusNoActivity, StatusError and StatusUnknown.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
From the OMG spec
if there is no Activity associated it the calling thread, the StatusNoActivity value is returnedNo Activity created by the HLS/UserActivity that is calling getStatus.
The effect of this is equivalent to performing the getStatus operation on the corresponding ActivityCoordinator objectSlightly different in that a coordinator can not return StatusNoActivity.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500201 | StatusActive | Begin Activity; getStatus | returns StatusActive |
jsr9500202 | StatusCompleting | Begin Activity; addAction a1 completion SignalSet complete Activity, a1 calls getStatus during processSignal; | returns StatusCompleting |
jsr9500203 | StatusNoActivity | getStatus | returns StatusNoActivity |
jsr9500204 | Service not registered | getStatus | ServiceNotRegisteredException is thrown |
public String UserActivity.getName()
The following assertions are taken from the javadoc.
Returns a printable string describing the active ActivityImplementation dependant and so not testable.
If no Activity is associated with the calling thread then null is returned.Simple test
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
the effect of this request is equivalent to performing the getActivityName operation on the corresponding ActivityCoordinator objectCan compare the String returned in both cases
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500205 | No Activity | getName | returns null |
jsr9500206 | compare with coordinator name | Begin Activity; get coordinator coord1; getName string1; coord1.getName string2; string1.isEqual (string2) | returns true |
jsr9500211 | Service not registered | getName | ServiceNotRegisteredException is thrown |
public void UserActivity.setTimeout(int timeout)
The following assertions are taken from the javadoc.
Sets the default timeout, in seconds, after which an Activity may be automatically completed by the Activity service.Operates on the UserActivity instance.
A value of -1 indicates no timeout-1 is a valid value.
A value of 0 for the default timeout indicates that a system-managed value or implementation-specific default should be used0 is also a valid value
TimeoutRangeException - Thrown if timeout is less than -1 or if it is outside an administratively configured range in the deployed system.As with the
begin
method, only the -1 limit can be tested.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500207 | timeout < -1 | setTimeout -2; | TimeoutRangeException thrown |
jsr9500208 | timeout values | setTimeout 999; setTimeout -1; setTimeout 0; | all calls succeed. |
jsr9500209 | Service independance | ServiceManager 1, setTimeout 45; ServiceManager 2, setTimeout 99; ServiceManager 1, getTimeout | returns 45 |
jsr9500213 | Service not registered | setTimeout 33 | ServiceNotRegisteredException is thrown |
public int UserActivity.getTimeout()
The following assertions are taken from the javadoc.
Returns the default timeout value, in secondsNot the timeout value of any specific Activity.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500210 | timeout | setTimeout (60); begin Activity (timeout 10); getTimeout () | returns 60 |
jsr9500214 | Service not registered | getTimeout | ServiceNotRegisteredException is thrown |
public GlobalId UserActivity.getGlobalId()
The following assertions are taken from the javadoc.
The GlobalId of the active Activity, or null if there is no Activity associated with the threadTest null case.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500212 | No Activity | getGlobalId | returns null |
jsr9500215 | Service not registered | getGlobalId | ServiceNotRegisteredException is thrown |
public Outcome UserActivity.broadcast(String signalSetName)
The following assertions are taken from the javadoc.
Causes the specified SignalSet to start producing signals for all registered ActionsThis is covered by the testing of the ActivityCoordinator
addAction
and addGlobalAction
methods. However this is
extended to include the effect of the SignalSet producing CoordinationInformation objects
in response to Action Outcomes.
In particular, the following assertion is from the
CoordinationInformation.isActionInterested()
method.
Returns a boolean to indicate to the callingOnce an Action has indicated that it does not want to receive Signals, it will not be sent any, even from subsequentActivityCoordinator
whether a particularAction
should receive any further signals during the lifetime of the current Activity.
broadcast
or complete
operations.
The implementation of the Activity service must ensure that pre-defined SignalSets, such as Synchronization, are not used.Test for Synchronization and ChildLifetime.
The Outcome returned is both set by and given meaning by the SignalSet.The Activity Service is obliged to request the SignalSet from the Service Manager, even if no Actions have registered for the SignalSet, since this Outcome is required to be returned.
A null Outcome object reference may be returned if the SignalSet does not produce an OutcomeTest assertion.
NoActivityException - Thrown if there is no Activity associated with the calling thread of executionAs with other method calls.
SignalSetUnknown - Thrown if the named SignalSet is not recognizedTest assertion.
InvalidActivityException - Thrown if an attempt is made to use the Synchronization or ChildLifetime SignalSets, or if the Activity is in the process of completion.Test broadcast during completion using the Synchronization SignalSet.
ActivityNotProcessedException - Thrown if the signals required to complete this operation could not be produced. The Activity's finalThis is applicable to the case of distributed objects, where communication failures may occur. It will not be tested here.Status
isStatusError
.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
Actions are required to use the ActionError exception to indicate that some failure occurred during Signal processing. This exception is mapped onto the pre-defined Outcome "ActionError"The ActionErrorException can be tested by registering a suitable Action with the coordinator and ensuring that the correct Outcome is passed to the SignalSet during setResponse.
if the Action throws ActionError or any system exception, then this may be mapped into either of the pre-defined Outcomes "ActionError" or "ActionSystemException" respectively and passed to the SignalSetActionError is covered in the previous assertion.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500025 | Action Error | Begin Activity; register Action with named SignalSet (Action throws ActionErrorException on receipt of Signal); call UserActivity.broadcast (s1) | Named SignalSet receives org.omg.CosActivity.ActionError Outcome on setResponse |
jsr9500032 | Multiple calls ok | Begin Activity; call UserActivity.broadcast (s1) call UserActivity.broadcast (s1) | Normal return |
jsr9500220 | SignalSet produces Signals | Begin Activity; register Action1, Action2 and Action3 with SignalSet s1 (using priorities to ensure they are called in sequence); SignalSet s1 has two Signals Signal1 and Signal2; Action1 responds to Signal1 with Outcome1 etc; SignalSet s1 responds to Outcome1 with CoordinationInformation indicating isActionInterested false, useNextSignal false; SignalSet s1 responds to Outcome2 with CoordinationInformation indicating isActionInterested true, useNextSignal true; SignalSet s1 responds to Outcome3 with CoordinationInformation indicating isActionInterested true, useNextSignal true; broadcast (s1) | Action1 is called for Signal1 only; Action2 is called for Signal1 and Signal2; Action3 is called for Signal2 only |
jsr9500221 | Outcome from SignalSet | Begin Activity; SignalSet s1 returns Outcome1; register Action with s1 which responds with Outcome2; broadcast (s1); | Outcome1 is returned |
jsr9500222 | Outcome from SignalSet | Begin Activity; SignalSet s1 returns null Outcome; broadcast (s1) | null is returned |
jsr9500224 | no activity | broadcast (s1) | NoActivityException thrown |
jsr9500225 | SignalSet unknown | Begin Activity; broadcast (unknown) | SignalSetUnknownException thrown |
jsr9500226 | Synchronization | Begin Activity; broadcast (org.omg.CosActivity.Synchronization) | InvalidActivityException thrown |
jsr9500227 | ChildBegin | Begin Activity; broadcast (org.omg.CosActivity.ChildBegin) | InvalidActivityException thrown |
jsr9500229 | completing | Begin Activity; addAction a1 SignalSet org.omg.CosActivity.Synchronization; complete (a1.processSignal calls broadcast) | InvalidActivityException thrown |
jsr9500219 | Service not registered | broadcast (s1) | ServiceNotRegisteredException is thrown |
jsr9500228 | isActionInterested false | Begin Activity; register Action1 with SignalSet s1; SignalSet s1 has Signal Signal1; Action1 responds to Signal1 with Outcome1; SignalSet s1 responds to Outcome1 with CoordinationInformation indicating isActionInterested false, useNextSignal false; broadcast (s1); broadcast (s1) | Action1 is called with Signal1 for first broadcast, but not for second. |
public ActivityCoordinator UserActivity.getCoordinator()
The following assertions are taken from the javadoc.
Returns the ActivityCoordinator
of the active Activity, or null
if there is no Activity
associated with the calling thread.
Covered in testing of ActivityCoordinator interface
public ActivityCoordinator UserActivity.getParentCoordinator()
The following assertions are taken from the javadoc.
Returns the ActivityCoordinator of the parent of the active Activity, or null if the active Activity is a top-level ActivityTest assertion.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500235 | no activity | getCoordinator; getParentCoordinator | returns null in both cases |
jsr9500236 | no parent | Begin Activity; getCoordinator; getParentCoordinator | returns null in latter case only |
jsr9500237 | parent | Begin Activity; getCoordinator coord1; begin Activity; getParentCoordinator coord2; coord1.isSameActivity coord2 | returns true |
jsr9500234 | Service not registered | getCoordinator | ServiceNotRegisteredException is thrown |
jsr9500233 | Service not registered | getParentCoordinator | ServiceNotRegisteredException is thrown |
public PropertyGroup UserActivity.getPropertyGroup(String name)
The following assertions are taken from the javadoc.
Returns the instance of the type of PropertyGroup, identified by name, scoped to the active ActivityThe
PropertyGroup
and PropertyGroupManager
interfaces
are not implemented by the Activity Service, but may be optionally implemented
by the HLS. There are a number of interactions that are specified here and
these are detailed later
The PropertyGroup identified by name must be supported by the ServiceManager for this UserActivity instanceThe ServiceManager provides a list of PropertyGroup names that it supports and also provides the PropertyGroupManagers associated with those names. When an Activity is begun, the PropertyGroupManagers are used to create the appropriate PropertyGroups to be associated with the Activity. Thus the Activity does not need to reference the ServiceManager to determine whether the name is supported.
PropertyGroupUnknownException - Thrown if the named PropertyGroup type is not recognizedSee above. This method will never return a null value.
NoActivityException - thrown if there is no Activity associated with the calling thread of execution.Test.
ServiceNotRegisteredException Thrown if no ServiceManager
has been registered.
As in previous tests.
From the OMG spec
if there is no Activity associated with the calling thread, then NoActivity exception will be thrownSee above.
public PropertyGroup PropertyGroupManager.create (PropertyGroup parent,
GlobalId globalId)
This method is called by the Activity Service when a new Activity, with the specified GlobalId, is begun.This can be tested.
parent - the PropertyGroup
object associated with the most recent ancestor Activity from the same HLS as
the new Activity. For example, if the parent Activity is from the same HLS as
the new Activity then this will be that parent Activity's
PropertyGroup
.
Even if there is an intervening Activity from a different HLS which supports
the same PropertyGroup.
A value of null indicates that the new Activity has no ancestor Activities from the same HLS.Again, even if there are other ancestor Activities from different HLS's which support the given PropertyGroup.
public void PropertyGroup.completed ()
This method is called by the Activity as part of its completion process to give the PropertyGroup the opportunity to perform any necessary clean-up work.This is called for all CompletionStatus values, whether a completion SignalSet is used or not and whether completion is initiated from UserActivity or ActivityCoordinator interfaces.
The Activity with which this PropertyGroup is associated is not active on the thread when this call is made.Test using isSameActivity or by comparing GlobalIds
Any parent Activity will then become active.
public void PropertyGroup.suspended ()
This method is called to inform the PropertyGroup that the Activity it represents has been suspended.Called during ActivityManager.suspend, suspendGroup or suspendAll processing.
The Activity with which this PropertyGroup is associated is still active on the thread when this call is made, but will be removed immediately after all suspended methods of registered PropertyGroups have been called.Test using isSameActivity or by comparing GlobalIds
Any parent Activity will then become active.
public void PropertyGroup.resumed ()
This method is called to inform the PropertyGroup that the Activity it represents has been resumed.Called during ActivityManager.resume, resumeGroup or resumeAll processing.
The Activity with which this PropertyGroup is associated is already resumed on the thread when this call is made.Test using isSameActivity or by comparing GlobalIds
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500240 | name PropertyGroup | Begin Activity (HLS1 which defines PropertyGroupManager pg1); getPropertyGroup (pg1); pg1.getPropertyGroupName | returns pg1 |
jsr9500241 | unknown group | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1); getPropertyGroup (unknown); | PropertyGroupUnknownException thrown |
jsr9500242 | active Activity | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1); Begin Activity (HLS2 gp1 which defines PropertyGroupManager pg2 (not pg1)); getPropertyGroup (pg1); | PropertyGroupUnknownException thrown |
jsr9500243 | parent for top level | Begin Activity (HLS1, gp1 which defines PropertyGroupManager pg1); Begin Activity (HLS2, gp1 which also defines PropertyGroupManager pg1); | PropertyGroupManager pg1.create is called with null parent parameter in both cases |
jsr9500253 | parent for child PropertyGroup | Begin Activity1 (HLS1, gp1 which defines PropertyGroupManager pg1); Begin Activity2 (HLS2, gp1 no PropertyGroupManagers); Begin Activity3 (HLS1, gp1) | PropertyGroupManager pg1.create is called with null parent parameter for first activity, and non null for third. |
jsr9500244 | completed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1 and no completion SignalSet); setCompletionStatus (CompletionStatusSuccess); complete | pg1.completed called |
jsr9500245 | completed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1 and completion SignalSet s1); setCompletionStatus (CompletionStatusFail); complete | pg1.completed called |
jsr9500246 | completed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1 and completion SignalSet s1); setCompletionStatus CompletionStatusFailOnly; complete | pg1.completed called |
jsr9500247 | no Activity during completed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1 and completion SignalSet s1); setCompletionStatus CompletionStatusSuccess; complete; in PropertyGroup.completed method call getStatus | StatusNoActivity returned |
jsr9500248 | suspended, resumed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1); suspend; in PropertyGroup.suspended method call getStatus; resume; in PropertyGroup.resumed method call getStatus | suspended called; getStatus returns StatusActive; resumed called; getStatus returns StatusActive; |
jsr9500249 | suspended, resumed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1); suspendGroup; in PropertyGroup.suspended method call getStatus; resumeGroup; in PropertyGroup.resumed method call getStatus | suspended called; getStatus returns StatusActive; resumed called; getStatus returns StatusActive; |
jsr9500250 | suspended, resumed | Begin Activity (HLS1 gp1 which defines PropertyGroupManager pg1); suspendAll; in PropertyGroup.suspended method call getStatus; resumeAll; in PropertyGroup.resumed method call getStatus | suspended called; getStatus returns StatusActive; resumed called; getStatus returns StatusActive; |
jsr9500251 | No Activity | call getPropertyGroup | NoActivityException thrown |
jsr9500239 | Service not registered | getPropertyGroup pg1 | ServiceNotRegisteredException is thrown |
public void UserActivity.registerService(String serviceName,
ServiceManager service)
The following assertions are taken from the javadoc.
Registers a ServiceManager
for the type of high-level service (HLS) whose activities are to be demarcated
through the target UserActivity
instance.
This registers the service with the UserActivity instance.
It does not preclude the same service being registered with multiple instances.
The Activity service uses the properties of the registered ServiceManager to create and operate on Activities specific to that serviceThese are SignalSets, PropertyGroups, ContextGroup and ActivityType. Previous tests have covered most of these, but it is worth mentioning that the ServiceManager implementation(s) used in the various test cases should return a valid value from the
getActivityType
method, as ActivityService implementations may check this value.
The UserActivity (or specialised ActivityManager) instance requires a ServiceManager to be registered with it before it may be used to begin new Activities.Tested in the
begin
method.
PropertyGroupUnknownException - thrown if the ServiceManager cannot obtain a PropertyGroupManager for one or more of the PropertyGroups it uses.Test by having ServiceManager throw this exception on getPropertyGroupManager
ServiceAlreadyRegisteredException Thrown if a ServiceManager has already been registered with the UserActivity instance.Test assertion.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500260 | ServiceRegisteredException | call UserActivity.registerService (name1, sm1); call UserActivity.registerService (name2, sm2); call UserActivity.registerService (name1, sm1); | ServiceRegisteredException thrown twice |
jsr9500261 | PropertyGroupUnknownException | call UserActivity.registerService (name1, sm1), where sm1 throws PropertyGroupUnknownException on getPropertyGroupManager | PropertyGroupUnknownException thrown |
public ServiceManager UserActivity.getService()
The following assertions are taken from the javadoc.
The ServiceManager for this UserActivity instance, or null if none has been registeredSimple test
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500262 | return value | call UserActivity.getService (); call UserActivity.registerService (name1, sm1); call UserActivity.getService (); | first getService returns null; second getService returns sm1 |
public ActivityCoordinator UserActivity.recreate(GlobalId activity, GlobalId parent, boolean resume, RecreateData recData)
The following assertions are taken from the javadoc.
Recreates an Activity after a failure or after the activity has been hibernatedRecovery testing is not covered in this document, but recreation following hibernation should be tested. There is no restriction placed on hibernating/recreating an Activity multiple times.
The Activity to be recreated is identified by the activity parameterThat is the GlobalId of the hibernated Activity.
Activity context hierarchies may be recreated by an HLS in two ways ...
... By specifying the parent, if any, of each recreated Activity. Activities so created are not associated with the calling thread on completion of this operationAs the recreated Activity is not associated with the calling thread, there is no requirement for the parent to be associated with the thread. Activities created in this way can never be 'resumed' onto a thread, and so must be completed via the ActivityCoordinator.completeActivity method.
As the parent need not be associated with the thread, then it follows that the parent may also be a recreated Activity (and indeed for recovery this will most likely be the case).
Whereas for UserActivity.begin, the operation fails if the parent Activity has a CompletionStatus of CompletionStatusFailOnly, no such restriction is placed on this operation.
If the parent has already completed or is in the process of completing, then an exception is required.
... By specifying true for the resume flag to associate each recreated Activity with the calling thread. An Activity recreated in this way is recreated as a child of any Activity already associated with the calling thread. The parent parameter must be null when using this approach.As above, the CompletionStatus of the parent (on the thread) is not restricted.
The Activity service contacts the registered ServiceManager to recreate the Actions and SignalSets for the Activity identified by the GlobalId parameterThis can be tested.
parent - the GlobalId of the parent of the Activity to be recreated.If null and resume is false, must create a root activity (no parent).
resume - specifies whether or not the recreated Activity context becomes associated with the calling thread. This parameter is used only when the parent is null. A value of true combined with a non-null parent is an illegal combination and results in an IllegalArgumentExceptionSee below.
returns the ActivityCoordinator for the recreated Activity.Ensure this has the correct GlobalId, Actions etc. The CompletionStatus of the recreated Activity is not specified. The default for an Activity is CompletionStatusFail and this should be expected.
ServiceNotRegisteredException - Thrown if no ServiceManager has been registered or if the ServiceManager for a recreated Activity is not availableTest when not registered.
ActivityCompletedException - Thrown if the Activity service and ServiceManager have no knowledge of the specified globalId - for example if the Activity it identifies has already completed or if it never got as far as logging persistent stateTest.
java.lang.IllegalArgumentException - Thrown if an illegal combination of parent and resume values is specified.Test.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500320 | GlobalId | begin Activity; get coord1; get GlobalId gid1; setPersistent; hibernate; recreate(gid1) returning coord2; get GlobalId gid2 | GlobalIds are equal |
jsr9500321 | Off Thread | begin Activity; get coord1; get GlobalId gid1; setPersistent; hibernate; getStatus; recreate(gid1, resume=false); getStatus | getStatus returns StatusNoActivity in both cases |
jsr9500322 | Off Thread with Parent | begin Activity a1; get coord1; setCompletionStatus success; get GlobalId gid1; begin Activity a2; get coord2; get GlobalId gid2; setPersistent; hibernate; recreate(gid2, resume=false, parent=gid1); getParent getGlobalId gid3; | gid1 equals gid3 |
jsr9500323 | Resume | begin Activity a1; setCompletionStatus success; get coord1; get GlobalId gid1; setPersistent; hibernate; recreate(gid1, resume=true); getParent; UserActivity.getGlobalId gid2; | getParent returns null; gid1 equals gid2 |
jsr9500324 | Resume with Parent | begin Activity a1; get coord1; get GlobalId gid1; setPersistent; hibernate; begin Activity a2; get coord2; get GlobalId gid2; recreate(gid1, resume=true); getParent getGlobalId gid3; | gid2 equals gid3 |
jsr9500325 | CompletionStatus | begin Activity a1; get coord1; setCompletionStatus success; get GlobalId gid1; setPersistent; hibernate; recreate(gid1, resume=true); UserActivity.getCompletionStatus | returns CompletionStatusFail |
jsr9500326 | Parent CompletionStatus | begin Activity a1; get coord1; setCompletionStatus success; get GlobalId gid1; setPersistent; hibernate; begin Activity a2; setCompletionStatus CompletionStatusFailOnly; recreate(gid1, resume=true); | no exceptions |
jsr9500327 | Already Completed | begin Activity a1; get coord1; setCompletionStatus success; get GlobalId gid1; setPersistent; complete; recreate(gid1, resume=true); | ActivityCompletedException thrown |
jsr9500328 | Not Persistent | begin Activity a1; get coord1; setCompletionStatus success; get GlobalId gid1; hibernate; recreate(gid1, resume=true); | ActivityCompletedException thrown |
jsr9500329 | Check Actions | begin Activity a1; get coord1; get GlobalId gid1; addAction action1, SignalSet s1; setPersistent; hibernate; recreate(gid1, resume=true); getActions(s1) | action1 is returned |
jsr9500330 | Check Global Actions | begin Activity a1; get coord1; get GlobalId gid1; addGlobalAction action1; setPersistent; hibernate; recreate(gid1, resume=true); getActions(null) | action1 is returned |
jsr9500331 | Check Synchronization Actions | begin Activity a1; get coord1; get GlobalId gid1; addAction action1, SignalSet org.omg.CosActivity.Synchronization; setPersistent; hibernate; recreate(gid1, resume=true); getActions(org.omg.CosActivity.Synchronization) | action1 is returned |
jsr9500332 | Check Action Priority | begin Activity a1; get coord1; get GlobalId gid1; addAction action1, SignalSet s1, priority p1; addAction action2, SignalSet s1, priority p2; addAction action3, SignalSet s1, priority p3; setPersistent; hibernate; recreate(gid1, resume=true); getActions(s1); broadcast(s1); | actions are called in order of their priority |
jsr9500333 | Resume non-null Parent | begin Activity a1; get coord1; get GlobalId gid1; setPersistent; hibernate; begin Activity a2; get coord2; get GlobalId gid2; recreate(gid1, resume=true, parent=gid2); | IllegalArgumentException thrown; |
jsr9500335 | Service Not Registered | begin Activity a1; get coord1; get GlobalId gid1; setPersistent; hibernate; get new UserActivity; recreate(gid1, resume=true); | ServiceNotRegisteredException thrown; |
jsr9500336 | Parent also recreated | begin Activity a1; get coord1; get GlobalId gid1; setPersistent; hibernate; begin Activity a2; get coord2; get GlobalId gid2; setPersistent; hibernate; recreate(gid1, resume=false); recreate(gid2, resume=false, parent=gid1); getParent getGlobalId gid3; | gid1 equals gid3 |
public void UserActivity.forget(GlobalId globalId)
The following assertions are taken from the javadoc.
Driven by a HLS for each GlobalId returned by the recover method for which the HLS has no knowledge.
Such Activities may be assumed to have completed successfully already or may be assumed never to have performed any recoverable work.Recovery testing is not covered in this document.
public GlobalId[] UserActivity.recover()
The following assertions are taken from the javadoc.
Driven by a HLS, after a failure, to retrieve a list of GlobalIds that the Activity service itself has logged information about ...
An Activity service implementation that does not log information of its own returns null when this method is called.Recovery testing is not covered in this document.
The following assertions are taken from the JSR95 spec.
preCompletion - sent prior to distributing Signals from the CompletionSignalSet if the CompletionStatus is CompletionStatusSuccess.Not sent if CompletionStatusFail/FailOnly.
postCompletion - sent after all Signals produced by the CompletionSignalSet have been distributed.Always sent (even if CompletionStatus is not success)
ChildBegin. is sent to interested Actions when a child Activity context is started. This signal is sent after the child Activity and all its PropertyGroups have been created, when the child Activity context is the active context on the thread.Actions need to be registered with the parent Activity.
TheSystem (pre-defined) SignalSets are part of the Activity Service implementation and as such, this behaviour needs to be tested. See OMG spec assertions below for more detailsjavax.activity.ActivityInformation
class is provided by the Activity service to assist an Action that has registered interest with a system SignalSet to extract the information from Signals produced by that SignalSet. Such Signals contain anorg.omg.CosActivity.ActivityInformation
structure encoded in anorg.omg.CORBA.Any
.
Actions registered with an interest in the Synchronization SignalSet, such as all global actions, do not receive an explicitThe corollary is stated belowdestroy
call but should instead use thepostComplete
Signal as the indication that they will receive no further calls.
Actions that are not registered with the Synchronization SignalSet get
explicitly told to destroy
themselves at the end of the
Activity.
From the javadoc
An object of this type is encoded in the extendedData
of
the postComplete signal sent by the system SynchronizationSignalSet.
The OMG spec gives more detail on this. An ActivityInformation object is
encoded in all system Signals, but only the postComplete Signal has the
finalOutcome field set.
childBegin: The ActivityInformation final_outcome is nil for this SignalTest
preCompletion: The ActivityInformation final_outcome is nil for this SignalTest
postCompletion: The Activity's completion status, final Outcome and its identity are encoded with the Signal via the ActivityInformation structureTest
org.omg.CosActivity.ChildLifetime - there are no pre-defined Outcomes introduced by this SignalSet.Nothing to test.
If an Action error occurs during ChildBegin (eg the ActionError exception is thrown), then the child's Activity completion status will be set to CompletionStatusFailOnly.Test.
The child Activity is active on the thread when childBegin is issued.Confirming previous assertion.
If an Action error occurs during preCompletion (eg the ActionError exception is thrown), then the Activity completion status will be set to CompletionStatusFailOnly.Test.
If an Action fails to respond to preCompletion or a failure occurs, or the Synchronization SignalSet receives the preCompletionFailed Outcome from an Action, the completion status of the Activity is changed to CompletionStatusFailOnlyTest with preCompletionFailed.
The completing activity is active on the thread when preCompletion is sent.To be read with the following assertion
However, it is inactive on the thread when postCompletion is generated by the SignalSet.Test using the UserActivity interface to access the current Activity. The following assertion is from the
SignalSet.setCompletionStatus
javadoc
Once completion of an Activity has begun, control of theThe SignalSet is informed of the current CompletionStatus at the beginning of completion (so it can act accordingly) and it also may change the CompletionStatus (which will be reflected in the extended data of theCompletionStatus
belongs to the completionSignalSet
and cannot be overridden by any other entity.
postCompletion
signal).
Explicitly setting the CompletionStatus during completion is forbidden so no other entity could override this.
Test Case ID | Assertion | Procedure | Expected result |
---|---|---|---|
jsr9500269 | ChildBegin | register service which supports propertyGroup pg1; Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.ChildBegin; begin Activity2; | a1 is called with ChildBegin Signal and calling getPropertyGroup pg1 returns the required propertyGroup |
jsr9500270 | Signal ordering | Begin Activity; register Action a1 with org.omg.CosActivity.Synchronization; register Action a2 with Completion SignalSet s1; setCompletionStatus CompletionStatusSuccess; complete | Action a1 called with Signal preCompletion before a2 is called with all completion Signals which is before a1 is called again with postCompletion. |
jsr9500271 | preCompletion when Fail | Begin Activity; register Action a1 with org.omg.CosActivity.Synchronization; setCompletionStatus CompletionStatusFail; complete | Action a1 not called with Signal preCompletion but is called with postCompletion |
jsr9500272 | ChildBegin | Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.ChildBegin; begin Activity2; | a1 is called with ChildBegin Signal and calling coord1.isSameActivity (getParentCoordinator) from a1 returns true |
jsr9500273 | ActivityInformation ChildBegin | Begin Activity1; get coordinator coord1; getGlobalId g1; register Action a1 with org.omg.CosActivity.ChildBegin; begin Activity2; getGlobalId g2; | a1 is called with ChildBegin; construct ActivityInformation ai1 from Signal.getExtendedAny; ai1.getCompletionStatus () equals CompletionStatusFail; ai1.getFinalOutcome () returns null; g2.isEqual (ai1.getGlobalId ()) returns true; |
jsr9500274 | ActivityInformation Synchronization | Begin Activity1 (HLS1 with completion SignalSet which returns outcome1); get coordinator coord1; getGlobalId g1; register Action a1 with org.omg.CosActivity.Synchronization; setCompletionStatus CompletionStatusSuccess; complete |
a1 is called with preCompletion;
construct ActivityInformation ai1 from Signal.getExtendedDataAny
(or use Signal.getExtendedDataValue and cast to ActivityInformation);
a11.getCompletionStatus () returns CompletionStatusSuccess;
ai1.getFinalOutcome () returns null;
g1.isEqual (ai1.getGlobalId ()) returns true;
a1 is called with postCompletion; construct ActivityInformation ai2 from Signal.getExtendedDataAny (or use Signal.getExtendedDataValue and cast to ActivityInformation); a12.getCompletionStatus () returns CompletionStatusSuccess; ai2.getFinalOutcome () returns outcome1; g1.isEqual (ai2.getGlobalId ()) returns true; |
jsr9500275 | destroy called | Begin Activity; register Action a1 with org.omg.CosActivity.Synchronization; register global Action a2; register Action a3 with Completion SignalSet s1; complete | Actions a1 and a3 do not have destroy called; Action a2 does have destroy called. |
jsr9500276 | ChildBegin ActionError | Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.ChildBegin; Action a1 throws ActionErrorException on receipt of ChildBegin; begin Activity2; getCompletionStatus | returns CompletionStatusFailOnly |
jsr9500277 | preCompletion ActionError | Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.Synchronization; Action a1 throws ActionErrorException on receipt of preCompletion; completeWithStatus CompletionStatusSuccess | a1 is called with postCompletion; construct ActivityInformation ai2 from Signal.getExtendedDataAny (or use Signal.getExtendedDataValue and cast to ActivityInformation); a12.getCompletionStatus () returns CompletionStatusFailOnly; |
jsr9500278 | preCompletionFailed response | Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.Synchronization; Action a1 returns preCompletionFailed on receipt of preCompletion; completeWithStatus CompletionStatusSuccess | a1 is called with postCompletion; construct ActivityInformation ai2 from Signal.getExtendedDataAny (or use Signal.getExtendedDataValue and cast to ActivityInformation); a12.getCompletionStatus () returns CompletionStatusFailOnly; |
jsr9500279 | Activity active during preCompletion | Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.Synchronization; a1 processSignal (preCompletion) calls UserActivity.getCoordinator coord2; completeWithStatus CompletionStatusSuccess; coord1.isSameActivity coord2 | isSameActivity returns true |
jsr9500280 | Activity not active during postCompletion | Begin Activity1; get coordinator coord1; register Action a1 with org.omg.CosActivity.Synchronization; a1 processSignal (postCompletion) calls UserActivity.getCoordinator coord2; completeWithStatus CompletionStatusFail; | coord2 is null |
jsr9500281 | Completion SignalSet CompletionStatus | Begin Activity1; register Action a1 with completion signalset; register Action a2 with org.omg.CosActivity.Synchronization; Action a1 throws ActionErrorException on receipt of Signal; completion SignalSet sets CompletionStatus to fail in response; completeWithStatus CompletionStatusSuccess | a2 is called with postCompletion; construct ActivityInformation ai2 from Signal.getExtendedDataAny a12.getCompletionStatus () returns CompletionStatusFail; |