[jboss-cvs] JBossAS SVN: r64256 - in projects/microcontainer/trunk/kernel/src: main/org/jboss/kernel/plugins/deployment and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 24 13:06:05 EDT 2007


Author: adrian at jboss.org
Date: 2007-07-24 13:06:05 -0400 (Tue, 24 Jul 2007)
New Revision: 64256

Added:
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractManualDeploymentTest.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/AbstractManualInjectTest.java
Removed:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTest.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTestDelegate.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerShutdownTestDelegate.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ModeMicrocontainerTestDelegate.java
Modified:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractTypeMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
   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/config/support/UnmodifiableGetterBean.java
   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/IgnoredAnnotatedLifecycleTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingShutdownTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractXMLTest.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/BadCardinalityCallbackTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/CardinalityCallbackTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionAdapter.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/InjectionValueCallbackTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SimpleCallbackTestCase.java
Log:
Cleanup the tests again!

1) MicrocontainerTest is not a part of the testsuite it is a part of the
Microcontainer that can be consumed by others. There should be only
one MicrocontainerTest class, extends MicrocontainerTest should be in the
testsuite.
2) The MicrocontainerTestDelegate is the place to parameterize tests
not subclassing. All relevant features should be in this class.
3) You shouldn't have to access the delegate to do reasonable operations.
4) Tests should not fix problems in the main code by subclassing.
5) All tests should be run with a security manager enabled. The easiset way
to do this is to always extend an Abstract class specific to those
tests that enable the security manager on the test delegate.
This Abstract class is also a good place to put common helpers for related tests.

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -111,6 +111,7 @@
       return clazz;
    }
 
+   @SuppressWarnings("unchecked")
    public Iterator<? extends MetaDataVisitorNode> getChildren()
    {
       Set<MetaDataVisitorNode> children = CollectionsFactory.createLazySet();

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractTypeMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractTypeMetaData.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractTypeMetaData.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -196,6 +196,7 @@
    /**
     * Check result for class compatibility.
     *
+    * @param <T> the expected type
     * @param result the result
     * @param expected expected class
     * @return casted result

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -380,6 +380,9 @@
     */
    protected void undeployBean(KernelController controller, KernelControllerContext context) throws Throwable
    {
-      controller.uninstall(context.getName());
+      if (controller.isShutdown() == false)
+         controller.uninstall(context.getName());
+      else
+         log.debug("Not undeploying " + context.getName() + " the controller is shutdown!");
    }
 }

Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTest.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTest.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -1,42 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.test.AbstractTestDelegate;
-
-/**
- * Manual controller mode deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class ManualMicrocontainerTest extends MicrocontainerTest
-{
-   public ManualMicrocontainerTest(String name)
-   {
-      super(name);
-   }
-
-   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
-   {
-      return new ManualMicrocontainerTestDelegate(clazz);
-   }
-}

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	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ManualMicrocontainerTestDelegate.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -1,43 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.dependency.spi.ControllerMode;
-
-/**
- * A Manual MicrocontainerTest.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public class ManualMicrocontainerTestDelegate extends ModeMicrocontainerTestDelegate
-{
-   public ManualMicrocontainerTestDelegate(Class clazz)
-         throws Exception
-   {
-      super(clazz);
-   }
-
-   protected ControllerMode getControllerMode()
-   {
-      return ControllerMode.MANUAL;
-   }
-}

Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerShutdownTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerShutdownTestDelegate.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerShutdownTestDelegate.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -1,65 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.Kernel;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-
-/**
- * A MicrocontainerShutdownTestDelegate.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public class MicrocontainerShutdownTestDelegate extends MicrocontainerTestDelegate
-{
-   public MicrocontainerShutdownTestDelegate(Class clazz)
-         throws Exception
-   {
-      super(clazz);
-   }
-
-   public void shutdown()
-   {
-      kernel.getController().shutdown();
-   }
-
-   protected BasicXMLDeployer createDeployer()
-   {
-      return new ShutdownBasicXMLDeployer(kernel);
-   }
-
-   private class ShutdownBasicXMLDeployer extends BasicXMLDeployer
-   {
-      public ShutdownBasicXMLDeployer(Kernel kernel)
-      {
-         super(kernel);
-      }
-
-      protected void undeployBean(KernelController controller, KernelControllerContext context) throws Throwable
-      {
-         if (controller.isShutdown() == false)
-            super.undeployBean(controller, context);
-      }
-   }
-}

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	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTest.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -203,6 +203,14 @@
    }
 
    /**
+    * Shutdown the controller
+    */
+   protected void shutdown()
+   {
+      getMCDelegate().shutdown();
+   }
+   
+   /**
     * Get the delegate
     * 
     * @return the delegate

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	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/MicrocontainerTestDelegate.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -24,6 +24,7 @@
 import java.net.URL;
 
 import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerMode;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.plugins.bootstrap.AbstractBootstrap;
@@ -49,6 +50,9 @@
    /** The deployer */
    protected BasicXMLDeployer deployer;
    
+   /** The default mode */
+   protected ControllerMode defaultMode = ControllerMode.AUTOMATIC;
+   
    /**
     * Create a new MicrocontainerTestDelegate.
     * 
@@ -97,7 +101,7 @@
 
    protected BasicXMLDeployer createDeployer()
    {
-      return new BasicXMLDeployer(kernel);
+      return new BasicXMLDeployer(kernel, defaultMode);
    }
 
    public void tearDown() throws Exception
@@ -107,6 +111,26 @@
    }
    
    /**
+    * Get the defaultMode.
+    * 
+    * @return the defaultMode.
+    */
+   public ControllerMode getDefaultMode()
+   {
+      return defaultMode;
+   }
+
+   /**
+    * Set the defaultMode.
+    * 
+    * @param defaultMode the defaultMode.
+    */
+   public void setDefaultMode(ControllerMode defaultMode)
+   {
+      this.defaultMode = defaultMode;
+   }
+
+   /**
     * Get the kernel bootstrap
     * 
     * @return the bootstrap
@@ -303,6 +327,11 @@
          log.debug("No test specific deployment " + testName);
    }
 
+   protected void shutdown()
+   {
+      kernel.getController().shutdown();
+   }
+
    protected String getTestName()
    {
       String testName = clazz.getName();

Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ModeMicrocontainerTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ModeMicrocontainerTestDelegate.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/test/kernel/junit/ModeMicrocontainerTestDelegate.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -1,51 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.dependency.spi.ControllerMode;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-
-/**
- * A Mode MicrocontainerTest.
- *
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class ModeMicrocontainerTestDelegate extends MicrocontainerTestDelegate
-{
-   public ModeMicrocontainerTestDelegate(Class clazz)
-         throws Exception
-   {
-      super(clazz);
-   }
-
-   /**
-    * Get the mode onf this deployer.
-    *
-    * @return deployer mode
-    */
-   protected abstract ControllerMode getControllerMode();
-
-   protected BasicXMLDeployer createDeployer()
-   {
-      return new BasicXMLDeployer(kernel, getControllerMode());
-   }
-}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/UnmodifiableGetterBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/UnmodifiableGetterBean.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/support/UnmodifiableGetterBean.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -36,6 +36,9 @@
 @SuppressWarnings("unchecked")
 public class UnmodifiableGetterBean implements Serializable
 {
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1L;
+   
    private Collection collection = new CustomCollection(true);
    private List list = new CustomList(true);
    private Set set = new CustomSet(true);

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractManualDeploymentTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractManualDeploymentTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractManualDeploymentTest.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -0,0 +1,56 @@
+/*
+* 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.deployment.test;
+
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+
+/**
+ * Abstract Deployment Test Case.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40428 $
+ */
+public class AbstractManualDeploymentTest extends MicrocontainerTest
+{
+   public AbstractManualDeploymentTest(String name)
+   {
+      super(name);
+   }
+   
+   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   {
+      MicrocontainerTestDelegate delegate = (MicrocontainerTestDelegate) MicrocontainerTest.getDelegate(clazz);
+      delegate.setDefaultMode(ControllerMode.MANUAL);
+      delegate.enableSecurity = true;
+      return delegate;
+   }
+
+   protected void configureLogging()
+   {
+      //enableTrace("org.jboss.dependency");
+      //enableTrace("org.jboss.kernel.plugins.dependency");
+      //enableTrace("org.jboss.kernel.plugins.deployment");
+   }
+}
\ No newline at end of file

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	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedLifecycleTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,17 +22,17 @@
 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.kernel.deployment.support.AnnotatedLifecycleBean;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Test lifecycle annotations.
  * 
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class AnnotatedLifecycleTestCase extends ManualMicrocontainerTest
+public class AnnotatedLifecycleTestCase extends AbstractManualDeploymentTest
 {
 
    private static final String BEAN_NAME = "LifecycleBean";

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredAnnotatedLifecycleTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -25,14 +25,13 @@
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.test.kernel.deployment.support.AnnotatedLifecycleBean;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Test ignore lifecycle annotations.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class IgnoredAnnotatedLifecycleTestCase extends ManualMicrocontainerTest
+public class IgnoredAnnotatedLifecycleTestCase extends AbstractManualDeploymentTest
 {
    private static final String BEAN_NAME = "LifecycleBean";
 

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IgnoredLifecycleTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,17 +22,17 @@
 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.kernel.deployment.support.SimpleLifecycleBean;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Test ignore lifecycle.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class IgnoredLifecycleTestCase extends ManualMicrocontainerTest
+public class IgnoredLifecycleTestCase extends AbstractManualDeploymentTest
 {
    private static final String BEAN_NAME = "LifecycleBean";
 

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MixedLifecycleTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,17 +22,17 @@
 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.kernel.deployment.support.SimpleLifecycleBean;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Test mixed lifecycle with annotation override.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class MixedLifecycleTestCase extends ManualMicrocontainerTest
+public class MixedLifecycleTestCase extends AbstractManualDeploymentTest
 {
 
    private static final String BEAN_NAME = "LifecycleBean";

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingShutdownTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingShutdownTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingShutdownTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,10 +22,10 @@
 package org.jboss.test.kernel.deployment.test;
 
 import junit.framework.Test;
+
 import org.jboss.test.AbstractTestDelegate;
 import org.jboss.test.kernel.deployment.support.SimpleBean;
 import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
-import org.jboss.test.kernel.junit.MicrocontainerShutdownTestDelegate;
 
 /**
  * Scoping shutdown tests.
@@ -93,7 +93,7 @@
       assertNotNull(simple4);
       assertEquals("fromApp", simple4.getConstructorString());
 
-      ((MicrocontainerShutdownTestDelegate)getMCDelegate()).shutdown();
+      shutdown();
 
       assertNull(getControllerContext("deploy4"));
       assertNull(getControllerContext("deploy3"));

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -26,14 +26,14 @@
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.test.kernel.junit.MicrocontainerShutdownTestDelegate;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
 
 /**
  * Scoping Deployment Test Delegate.
  *
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  */
-public class ScopingTestDelegate extends MicrocontainerShutdownTestDelegate
+public class ScopingTestDelegate extends MicrocontainerTestDelegate
 {
    public ScopingTestDelegate(Class clazz) throws Exception
    {
@@ -96,5 +96,4 @@
          return null;
       }
    }
-
 }

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractXMLTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractXMLTest.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractXMLTest.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -347,7 +347,7 @@
       assertTrue(value instanceof ThisValueMetaData);
    }
    
-   protected void checkJBossXBException(Class expected, Throwable throwable)
+   protected void checkJBossXBException(Class<? extends Throwable> expected, Throwable throwable)
    {
       checkThrowable(JBossXBException.class, throwable);
       JBossXBException e = (JBossXBException) throwable;

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/AbstractManualInjectTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/AbstractManualInjectTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/AbstractManualInjectTest.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -0,0 +1,56 @@
+/*
+* 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.inject.test;
+
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+
+/**
+ * Abstract Inject Test Case.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40428 $
+ */
+public class AbstractManualInjectTest extends MicrocontainerTest
+{
+   public AbstractManualInjectTest(String name)
+   {
+      super(name);
+   }
+   
+   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   {
+      MicrocontainerTestDelegate delegate = (MicrocontainerTestDelegate) MicrocontainerTest.getDelegate(clazz);
+      delegate.setDefaultMode(ControllerMode.MANUAL);
+      delegate.enableSecurity = true;
+      return delegate;
+   }
+
+   protected void configureLogging()
+   {
+      //enableTrace("org.jboss.dependency");
+      //enableTrace("org.jboss.kernel.plugins.dependency");
+      //enableTrace("org.jboss.kernel.plugins.deployment");
+   }
+}
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/BadCardinalityCallbackTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/BadCardinalityCallbackTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/BadCardinalityCallbackTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,17 +22,17 @@
 package org.jboss.test.kernel.inject.test;
 
 import junit.framework.Test;
+
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.test.kernel.inject.support.CallbackTestObject;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Cardinality tests.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class BadCardinalityCallbackTestCase extends ManualMicrocontainerTest
+public class BadCardinalityCallbackTestCase extends AbstractManualInjectTest
 {
    public BadCardinalityCallbackTestCase(String name)
    {

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/CardinalityCallbackTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/CardinalityCallbackTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/CardinalityCallbackTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,17 +22,17 @@
 package org.jboss.test.kernel.inject.test;
 
 import junit.framework.Test;
+
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.test.kernel.inject.support.CallbackTestObject;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Cardinality tests.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class CardinalityCallbackTestCase extends ManualMicrocontainerTest
+public class CardinalityCallbackTestCase extends AbstractManualInjectTest
 {
    public CardinalityCallbackTestCase(String name)
    {

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionAdapter.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionAdapter.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionAdapter.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,6 +22,7 @@
 package org.jboss.test.kernel.inject.test;
 
 import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.test.AbstractTestDelegate;
 import org.jboss.test.kernel.junit.MicrocontainerTest;
 
 /**
@@ -35,6 +36,20 @@
    {
       super(name);
    }
+   
+   /**
+    * Default setup with security manager enabled
+    * 
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = MicrocontainerTest.getDelegate(clazz);
+      delegate.enableSecurity = true;
+      return delegate;
+   }
 
    protected void enableTrace()
    {

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/InjectionValueCallbackTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/InjectionValueCallbackTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/InjectionValueCallbackTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -22,17 +22,17 @@
 package org.jboss.test.kernel.inject.test;
 
 import junit.framework.Test;
+
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.test.kernel.inject.support.PropertyInjectTestObject;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Callback tests.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public class InjectionValueCallbackTestCase extends ManualMicrocontainerTest
+public class InjectionValueCallbackTestCase extends AbstractManualInjectTest
 {
    public InjectionValueCallbackTestCase(String name)
    {

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SimpleCallbackTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SimpleCallbackTestCase.java	2007-07-24 16:59:37 UTC (rev 64255)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SimpleCallbackTestCase.java	2007-07-24 17:06:05 UTC (rev 64256)
@@ -24,14 +24,13 @@
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.test.kernel.inject.support.CallbackTestObject;
-import org.jboss.test.kernel.junit.ManualMicrocontainerTest;
 
 /**
  * Callback tests.
  *
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
  */
-public abstract class SimpleCallbackTestCase extends ManualMicrocontainerTest
+public abstract class SimpleCallbackTestCase extends AbstractManualInjectTest
 {
    public SimpleCallbackTestCase(String name)
    {




More information about the jboss-cvs-commits mailing list