Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[MSC-123] enabling shouldStart() & shouldStop() assertions

Test cannot call shouldStop() via byteman script because this method requires a lock to be held.
Fixing byteman script to use method param instead of lock protected shouldStop() method to identify
if the expected method call stack is beeing executed.
  • Loading branch information...
commit 207660ad24d7ffa002b97953c157c5c00e513c80 1 parent ad53274
@ropalka ropalka authored dmlloyd committed
View
4 src/main/java/org/jboss/msc/service/ServiceControllerImpl.java
@@ -322,7 +322,7 @@ boolean isInstallationCommitted() {
* @return {@code true} if so
*/
private boolean shouldStart() {
-// assert holdsLock(this);
+ assert holdsLock(this);
return unstartedDependencies == 0 && (mode == Mode.ACTIVE || mode == Mode.PASSIVE || demandedByCount > 0 && (mode == Mode.ON_DEMAND || mode == Mode.LAZY));
}
@@ -332,7 +332,7 @@ private boolean shouldStart() {
* @return {@code true} if so
*/
private boolean shouldStop() {
-// assert holdsLock(this);
+ assert holdsLock(this);
return unstartedDependencies > 0 || (mode == Mode.NEVER || mode == Mode.REMOVE || demandedByCount == 0 && mode == Mode.ON_DEMAND);
}
View
2  src/test/resources/org/jboss/msc/racecondition/StopRequestedToUpTransitionTestCase.btm
@@ -53,7 +53,7 @@ CLASS org.jboss.msc.service.ServiceControllerImpl
METHOD setMode
AT EXIT
BIND NOTHING
-IF ! $0.shouldStop() && $0.state.toString().equals("STOP_REQUESTED")
+IF $1 == org.jboss.msc.service.ServiceController$Mode.ACTIVE AND $0.state.toString().equals("STOP_REQUESTED")
DO
# signal UpRequested, making the service controller to enter the exact transition that we need to
# test: STOP_REQUESTED_to_UP
Please sign in to comment.
Something went wrong with that request. Please try again.