[jboss-cvs] JBossAS SVN: r69998 - projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 21 09:05:15 EST 2008


Author: adrian at jboss.org
Date: 2008-02-21 09:05:15 -0500 (Thu, 21 Feb 2008)
New Revision: 69998

Modified:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTest.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTestDelegate.java
Log:
Some helpers for asserting a context/bean is NOT at a specfic state

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTest.java	2008-02-21 14:00:06 UTC (rev 69997)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTest.java	2008-02-21 14:05:15 UTC (rev 69998)
@@ -132,6 +132,29 @@
    {
       return assertBean(name, ControllerState.INSTALLED, expected);
    }
+   
+   /**
+    * Assert there is no bean
+    * 
+    * @param name the name of the bean
+    * @throws IllegalStateException when the bean exists
+    */
+   protected void assertNoBean(Object name)
+   {
+      assertNoBean(name, ControllerState.INSTALLED);
+   }
+   
+   /**
+    * Assert there is no bean
+    * 
+    * @param name the name of the bean
+    * @param state the context state
+    * @throws IllegalStateException when the bean exists
+    */
+   protected void assertNoBean(Object name, ControllerState state)
+   {
+      assertNoControllerContext(name, state);
+   }
 
    /**
     * Get a context
@@ -159,6 +182,18 @@
    }
 
    /**
+    * Assert there is no context at the given state
+    * 
+    * @param name the name of the bean
+    * @param state the state of the bean
+    * @throws IllegalStateException when the context exists at that state
+    */
+   protected void assertNoControllerContext(Object name, ControllerState state)
+   {
+      getMCDelegate().assertNoControllerContext(name, state);
+   }
+
+   /**
     * Change the context to the given state
     * 
     * @param context the context

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTestDelegate.java	2008-02-21 14:00:06 UTC (rev 69997)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTestDelegate.java	2008-02-21 14:05:15 UTC (rev 69998)
@@ -200,6 +200,21 @@
          return handleNotFoundContext(controller, name, state);
       return context;
    }
+   
+   /**
+    * Assert there is no context at the given state
+    * 
+    * @param name the name of the bean
+    * @param state the state of the bean
+    * @throws IllegalStateException when the context exists at that state
+    */
+   protected void assertNoControllerContext(final Object name, final ControllerState state)
+   {
+      KernelController controller = kernel.getController();
+      KernelControllerContext context = (KernelControllerContext) controller.getContext(name, state);
+      if (context != null)
+         throw new IllegalStateException("Did not expect context at state " + state + " ctx=" + context);
+   }
 
    /**
     * Handle not found context.




More information about the jboss-cvs-commits mailing list