[jboss-cvs] JBossAS SVN: r59193 - in projects/microcontainer/trunk/kernel/src: main/org/jboss/test/kernel/junit tests/org/jboss/test/kernel/deployment/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 21 09:08:26 EST 2006


Author: adrian at jboss.org
Date: 2006-12-21 09:08:20 -0500 (Thu, 21 Dec 2006)
New Revision: 59193

Removed:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTestDelegate.java
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
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java
Log:
Move the manual test helper into the main test class.

Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTestDelegate.java	2006-12-21 12:33:29 UTC (rev 59192)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTestDelegate.java	2006-12-21 14:08:20 UTC (rev 59193)
@@ -1,45 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.kernel.junit;
-
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.Controller;
-
-/**
- * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
- */
-public class ManualMicrocontainerTestDelegate extends MicrocontainerTestDelegate
-{
-   public ManualMicrocontainerTestDelegate(Class clazz)
-         throws Exception
-   {
-      super(clazz);
-   }
-
-   public void change(KernelControllerContext context, ControllerState requied) throws Throwable
-   {
-      Controller controller = kernel.getController();
-      controller.change(context, requied);
-   }
-
-}

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	2006-12-21 12:33:29 UTC (rev 59192)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTest.java	2006-12-21 14:08:20 UTC (rev 59193)
@@ -104,7 +104,7 @@
    {
       return getControllerContext(name, ControllerState.INSTALLED);
    }
-   
+
    /**
     * Get a context
     * 
@@ -117,6 +117,19 @@
    {
       return getMCDelegate().getControllerContext(name, state);
    }
+
+   /**
+    * Change the context to the given state
+    * 
+    * @param context the context
+    * @param required the required state
+    * @return the actual state
+    * @throws Throwable for any error
+    */
+   public ControllerState change(KernelControllerContext context, ControllerState required) throws Throwable
+   {
+      return getMCDelegate().change(context, required);
+   }
    
    /**
     * Deploy a url

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	2006-12-21 12:33:29 UTC (rev 59192)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTestDelegate.java	2006-12-21 14:08:20 UTC (rev 59193)
@@ -23,6 +23,7 @@
 
 import java.net.URL;
 
+import org.jboss.dependency.spi.Controller;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.bootstrap.AbstractBootstrap;
@@ -151,8 +152,23 @@
          throw new IllegalStateException("Bean not found " + name + " at state " + state);
       return context;
    }
-   
+
    /**
+    * Change the context to the given state
+    * 
+    * @param context the context
+    * @param required the required state
+    * @return the actual state
+    * @throws Throwable for any error
+    */
+   protected ControllerState change(KernelControllerContext context, ControllerState required) throws Throwable
+   {
+      Controller controller = kernel.getController();
+      controller.change(context, required);
+      return context.getState();
+   }
+
+   /**
     * Validate
     * 
     * @throws Exception for any error

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java	2006-12-21 12:33:29 UTC (rev 59192)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java	2006-12-21 14:08:20 UTC (rev 59193)
@@ -21,14 +21,12 @@
 */
 package org.jboss.test.kernel.deployment.test;
 
+import junit.framework.Test;
+
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.test.AbstractTestDelegate;
 import org.jboss.test.kernel.deployment.support.AnnotatedLifecycleBean;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTestDelegate;
 
-import junit.framework.Test;
-
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
@@ -47,47 +45,38 @@
       return suite(AnnotatedLifecycleTestCase.class);
    }
 
-   public void testAnnotetedLifecycle() throws Throwable
+   public void testAnnotatedLifecycle() throws Throwable
    {
       AnnotatedLifecycleBean target;
 
       KernelControllerContext context = getControllerContext(BEAN_NAME, ControllerState.NOT_INSTALLED);
 
-      ManualMicrocontainerTestDelegate delegate = (ManualMicrocontainerTestDelegate) getMCDelegate();
-
-      delegate.change(context, ControllerState.CREATE);
+      change(context, ControllerState.CREATE);
       target = (AnnotatedLifecycleBean) context.getTarget();
       assertTrue(target.isCreate());
       assertFalse(target.isStart());
       assertFalse(target.isStop());
       assertFalse(target.isDestroy());
 
-      delegate.change(context, ControllerState.START);
+      change(context, ControllerState.START);
       target = (AnnotatedLifecycleBean) context.getTarget();
       assertTrue(target.isCreate());
       assertTrue(target.isStart());
       assertFalse(target.isStop());
       assertFalse(target.isDestroy());
 
-      delegate.change(context, ControllerState.CREATE);
+      change(context, ControllerState.CREATE);
       target = (AnnotatedLifecycleBean) context.getTarget();
       assertTrue(target.isCreate());
       assertFalse(target.isStart());
       assertTrue(target.isStop());
       assertFalse(target.isDestroy());
 
-      delegate.change(context, ControllerState.CONFIGURED);
+      change(context, ControllerState.CONFIGURED);
       target = (AnnotatedLifecycleBean) context.getTarget();
       assertFalse(target.isCreate());
       assertFalse(target.isStart());
       assertTrue(target.isStop());
       assertTrue(target.isDestroy());
-
    }
-
-   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
-   {
-      return new ManualMicrocontainerTestDelegate(clazz);
-   }
-
 }




More information about the jboss-cvs-commits mailing list