[jboss-cvs] JBossAS SVN: r94027 - projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/asynchronous/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 25 12:54:02 EDT 2009


Author: kabir.khan at jboss.com
Date: 2009-09-25 12:54:02 -0400 (Fri, 25 Sep 2009)
New Revision: 94027

Modified:
   projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/asynchronous/test/AsynchronousContextWithDependencyOnAsynchronousTestCase.txt
Log:
[JBKERNEL-25] More deterministic order

Extra rendezvous at end of deploy() and at start of threads

Use ContextsInstalledByExecutor.disassociateWithTask(ControllerContext) as the point where we signal the bean being installed, since 
- at this point the bean defintely will have finished installing properly (previously we signalled from the ControllerContextAction which is actually before the context and controller is updated with the new status)
- we have access to the context so we can check the name and state (I tried putting it at the end of AbstractController.InstallControllerContextTask.run(), but there were problems inspecting the context)

Modified: projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/asynchronous/test/AsynchronousContextWithDependencyOnAsynchronousTestCase.txt
===================================================================
--- projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/asynchronous/test/AsynchronousContextWithDependencyOnAsynchronousTestCase.txt	2009-09-25 15:25:22 UTC (rev 94026)
+++ projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/asynchronous/test/AsynchronousContextWithDependencyOnAsynchronousTestCase.txt	2009-09-25 16:54:02 UTC (rev 94027)
@@ -1,54 +1,95 @@
-RULE Wait for Bean1 to be installed
+RULE Increment deploy counter and init rendezvous
 CLASS org.jboss.test.kernel.junit.MicrocontainerTestDelegate 
 METHOD deploy(java.net.URL)
 HELPER org.jboss.test.kernel.asynchronous.support.Helper
+BIND NOTHING
+IF TRUE
+DO 
+   debug("Counter " + incrementCounter("Deploy")),
+   flag("StartRV"),
+   deleteRendezvous("StartThreads", 0),
+   createRendezvous("StartThreads", 2)
+ENDRULE
+
+RULE Deploy end rendezvous making sure threads have started
+CLASS org.jboss.test.kernel.junit.MicrocontainerTestDelegate 
+METHOD deploy(java.net.URL)
+HELPER org.jboss.test.kernel.asynchronous.support.Helper
 AT EXIT
 BIND NOTHING
-#This should be triggered on 2nd call to deploy()
-IF 1 == readCounter("Deploy")
-DO debug("wait in deploy"),
-   waitFor("Installed", 10000),
-   debug("go!!!")
+IF TRUE
+DO
+   debug("StartThreads rendezvous in AbstractController$InstallControllerContextTask"),
+   rendezvous("StartThreads"),
+   debug("StartThreads rendezvous go!!!")
 ENDRULE
 
+#This should be triggered on 1st call to deploy() when we install Bean1, which will stop in the Instantiated stage since Bean2 has not yet been deployed
 RULE Wait for Bean1 to be instantiated
 CLASS org.jboss.test.kernel.junit.MicrocontainerTestDelegate 
 METHOD deploy(java.net.URL)
 HELPER org.jboss.test.kernel.asynchronous.support.Helper
 AT EXIT
 BIND NOTHING
-#This should be triggered on 1st call to deploy()
-IF 0 == readCounter("Deploy")
-DO debug("wait in deploy"),
-   debug("Counter is now " + incrementCounter("Deploy")),
+IF 1 == readCounter("Deploy")
+DO 
+   debug("wait in deploy"),
    waitFor("Instantiated", 10000),
    debug("go!!!")
 ENDRULE
 
-RULE Signal Complete for Bean1 in InstantiateAction
-CLASS org.jboss.kernel.plugins.dependency.InstantiateAction
-METHOD installActionInternal(KernelControllerContext)
+#This should be triggered on 2nd call to deploy() when we install Bean2, which go through to Installed
+RULE Wait for Bean1 to be installed
+CLASS org.jboss.test.kernel.junit.MicrocontainerTestDelegate 
+METHOD deploy(java.net.URL)
 HELPER org.jboss.test.kernel.asynchronous.support.Helper
 AT EXIT
-BIND ctx:KernelControllerContext = $1
-IF ctx.getName().equals("Bean1")
-DO debug("signalling wake"),
+BIND NOTHING
+IF 2 == readCounter("Deploy")
+DO 
+   debug("wait in deploy"),
+   waitFor("Installed", 10000),
+   debug("go!!!")
+ENDRULE
+
+RULE Start threads rendezvous
+CLASS org.jboss.dependency.plugins.AbstractController$InstallControllerContextTask 
+METHOD run
+HELPER org.jboss.test.kernel.asynchronous.support.Helper
+BIND NOTHING
+IF flagged("StartRV")
+DO 
+   clear("StartRV"),
+   debug("StartThreads rendezvous in AbstractController$InstallControllerContextTask"),
+   rendezvous("StartThreads"),
+   debug("StartThreads rendezvous go!!!")
+ENDRULE
+
+RULE Signal Bean1 instantiated
+CLASS org.jboss.dependency.plugins.AbstractController$ContextsInstalledByExecutor
+METHOD disassociateWithTask
+HELPER org.jboss.test.kernel.asynchronous.support.Helper
+BIND ctx = $1
+IF ctx.getName().equals("Bean1") AND ctx.getState().equals(org.jboss.dependency.spi.ControllerState.INSTANTIATED)
+DO 
+   debug("signalling Instantiated in AbstractController$ContextsInstalledByExecutor"),
    signalWake("Instantiated", true),
-   debug("signalled!")
+   debug("signalled!!!")
 ENDRULE
 
-RULE Signal Complete for Bean1 in InstallAction
-CLASS org.jboss.kernel.plugins.dependency.InstallAction
-METHOD installActionInternal(KernelControllerContext)
+RULE Signal Bean1 Installed
+CLASS org.jboss.dependency.plugins.AbstractController$ContextsInstalledByExecutor
+METHOD disassociateWithTask
 HELPER org.jboss.test.kernel.asynchronous.support.Helper
-AT EXIT
-BIND ctx:KernelControllerContext = $1
-IF ctx.getName().equals("Bean1")
-DO debug("signalling wake"),
+BIND ctx = $1
+IF ctx.getName().equals("Bean1") AND ctx.getState().equals(org.jboss.dependency.spi.ControllerState.INSTALLED)
+DO 
+   debug("signalling Installed in AbstractController$ContextsInstalledByExecutor"),
    signalWake("Installed", true),
-   debug("signalled!")
+   debug("signalled!!!")
 ENDRULE
 
+
 RULE Mark PreInstallAction
 CLASS org.jboss.kernel.plugins.dependency.PreInstallAction
 METHOD installActionInternal(KernelControllerContext)




More information about the jboss-cvs-commits mailing list