[jboss-cvs] JBossAS SVN: r70051 - in projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations: test and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Feb 24 18:28:02 EST 2008
Author: alesj
Date: 2008-02-24 18:28:02 -0500 (Sun, 24 Feb 2008)
New Revision: 70051
Added:
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/ConstructorInheritanceTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/PropertyInheritanceTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubConstructorInheritanceTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubLifecycleAnnotationTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubPropertyInheritanceTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubSetsAnnotationTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AbstractAnnotationInheritanceTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AnnotationsInheritanceTestSuite.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/CallbackAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ConstructorAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ExternalAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/FactoryAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/InstallationAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/LifecycleAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/PropertyAnnotationInheritanceTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/SetsAnnotationInheritanceTestCase.java
Removed:
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTestCase.java
Modified:
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/LifecycleAnnotationTester.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/CleanupAnnotationTestCase.java
Log:
Annotation IoC inheritance tests.
Still some TODOs.
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/ConstructorInheritanceTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/ConstructorInheritanceTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/ConstructorInheritanceTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,48 @@
+/*
+* 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.annotations.support;
+
+import org.jboss.beans.metadata.api.annotations.Constructor;
+import org.jboss.beans.metadata.api.annotations.Inject;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ConstructorInheritanceTester implements AnnotationTester
+{
+ private Object value;
+
+ public ConstructorInheritanceTester()
+ {
+ }
+
+ @Constructor
+ public ConstructorInheritanceTester(@Inject(bean = "somebean") Object value)
+ {
+ this.value = value;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/LifecycleAnnotationTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/LifecycleAnnotationTester.java 2008-02-24 23:19:46 UTC (rev 70050)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/LifecycleAnnotationTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -72,14 +72,14 @@
public void fromAnnStop()
{
value[1] = null;
- value[2] = "dewdwe";
+ value[2] = "dewdew";
}
@Destroy
public void fromAnnDestroy()
{
value[0] = null;
- value[3] = "dwefwf";
+ value[3] = "dew";
}
public Object[] getValue()
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/PropertyInheritanceTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/PropertyInheritanceTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/PropertyInheritanceTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,43 @@
+/*
+* 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.annotations.support;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PropertyInheritanceTester implements AnnotationTester
+{
+ private Object value;
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ @Inject(bean = "somebean")
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubConstructorInheritanceTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubConstructorInheritanceTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubConstructorInheritanceTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,38 @@
+/*
+* 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.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SubConstructorInheritanceTester extends ConstructorInheritanceTester
+{
+ public SubConstructorInheritanceTester()
+ {
+ super();
+ }
+
+ public SubConstructorInheritanceTester(int someint)
+ {
+ this();
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubLifecycleAnnotationTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubLifecycleAnnotationTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubLifecycleAnnotationTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,29 @@
+/*
+* 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.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SubLifecycleAnnotationTester extends LifecycleAnnotationTester
+{
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubPropertyInheritanceTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubPropertyInheritanceTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubPropertyInheritanceTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,29 @@
+/*
+* 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.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SubPropertyInheritanceTester extends PropertyInheritanceTester
+{
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubSetsAnnotationTester.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubSetsAnnotationTester.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/support/SubSetsAnnotationTester.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,29 @@
+/*
+* 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.annotations.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SubSetsAnnotationTester extends SetsAnnotationTester
+{
+}
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTest.java (from rev 70048, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTest.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTest.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,106 @@
+/*
+* 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.annotations.test;
+
+import java.lang.annotation.Annotation;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
+import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
+import org.jboss.kernel.plugins.dependency.AbstractKernelController;
+import org.jboss.kernel.plugins.dependency.DescribeAction;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.config.KernelConfig;
+
+/**
+ * Abstract bean annotation adapter test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractBeanAnnotationAdapterTest extends AbstractRunAnnotationsTest
+{
+ protected AbstractBeanAnnotationAdapterTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract BeanAnnotationAdapter getBeanAnnotationAdapterClass();
+
+ protected Set<Annotation> getAnnotations()
+ {
+ return Collections.emptySet();
+ }
+
+ protected KernelConfig createKernelConfig()
+ {
+ return new TestKernelConfig();
+ }
+
+ private class TestKernelConfig extends PropertyKernelConfig
+ {
+ public TestKernelConfig()
+ {
+ super(null);
+ }
+
+ public KernelController createKernelController() throws Throwable
+ {
+ return new TestController();
+ }
+ }
+
+ private class TestController extends AbstractKernelController
+ {
+ private TestDescribeAction describe = new TestDescribeAction();
+
+ public TestController() throws Exception
+ {
+ }
+
+ protected void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable
+ {
+ if (ControllerState.DESCRIBED.equals(toState))
+ describe.install(context);
+ else
+ super.install(context, fromState, toState);
+ }
+
+ protected void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState)
+ {
+ if (ControllerState.DESCRIBED.equals(fromState))
+ describe.uninstall(context);
+ else
+ super.uninstall(context, fromState, toState);
+ }
+ }
+
+ private class TestDescribeAction extends DescribeAction
+ {
+ protected BeanAnnotationAdapter getBeanAnnotationAdapter()
+ {
+ return getBeanAnnotationAdapterClass();
+ }
+ }
+}
Deleted: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTestCase.java 2008-02-24 23:19:46 UTC (rev 70050)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractBeanAnnotationAdapterTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -1,130 +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.annotations.test;
-
-import java.lang.annotation.Annotation;
-import java.util.Collections;
-import java.util.Set;
-
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.annotations.BeanAnnotationAdapter;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
-import org.jboss.kernel.plugins.dependency.AbstractKernelController;
-import org.jboss.kernel.plugins.dependency.DescribeAction;
-import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.test.BaseTestCase;
-
-/**
- * Abstract bean annotation adapter test.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public abstract class AbstractBeanAnnotationAdapterTestCase extends BaseTestCase
-{
- protected AbstractBeanAnnotationAdapterTestCase(String name)
- {
- super(name);
- }
-
- protected abstract BeanAnnotationAdapter getBeanAnnotationAdapterClass();
-
- protected Set<Annotation> getAnnotations()
- {
- return Collections.emptySet();
- }
-
- protected void runAnnotations(Object bean) throws Throwable
- {
- KernelController controller = getController();
- String name = bean.toString();
- AbstractBeanMetaData beanMetaData = new AbstractBeanMetaData(name, bean.getClass().getName());
- try
- {
- controller.install(beanMetaData, bean);
- }
- finally
- {
- controller.uninstall(name);
- }
- }
-
- protected KernelController getController() throws Throwable
- {
- // bootstrap
- BasicBootstrap bootstrap = new BasicBootstrap(new TestKernelConfig());
- bootstrap.run();
- Kernel kernel = bootstrap.getKernel();
- KernelController controller = kernel.getController();
- assertInstanceOf(controller, TestController.class);
- return controller;
- }
-
- private class TestKernelConfig extends PropertyKernelConfig
- {
- public TestKernelConfig()
- {
- super(null);
- }
-
- public KernelController createKernelController() throws Throwable
- {
- return new TestController();
- }
- }
-
- private class TestController extends AbstractKernelController
- {
- private TestDescribeAction describe = new TestDescribeAction();
-
- public TestController() throws Exception
- {
- }
-
- protected void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable
- {
- if (ControllerState.DESCRIBED.equals(toState))
- describe.install(context);
- else
- super.install(context, fromState, toState);
- }
-
- protected void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState)
- {
- if (ControllerState.DESCRIBED.equals(fromState))
- describe.uninstall(context);
- else
- super.uninstall(context, fromState, toState);
- }
- }
-
- private class TestDescribeAction extends DescribeAction
- {
- protected BeanAnnotationAdapter getBeanAnnotationAdapter()
- {
- return getBeanAnnotationAdapterClass();
- }
- }
-}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AbstractRunAnnotationsTest.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,127 @@
+/*
+* 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.annotations.test;
+
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.spi.config.KernelConfig;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.BaseTestCase;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Abstract annotation runner test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractRunAnnotationsTest extends BaseTestCase
+{
+ private KernelController controller;
+
+ protected AbstractRunAnnotationsTest(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ controller = createController();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ if (controller != null)
+ controller.shutdown();
+ controller = null;
+
+ super.tearDown();
+ }
+
+ protected void runAnnotationsOnTarget(Object target) throws Throwable
+ {
+ assertNotNull("Target is null", target);
+ runAnnotations(target.getClass(), target);
+ }
+
+ protected void runAnnotationsOnClass(Class<?> clazz) throws Throwable
+ {
+ runAnnotations(clazz, null);
+ }
+
+ protected void runAnnotations(Class clazz, Object target) throws Throwable
+ {
+ KernelController controller = getController();
+ String className = clazz.getName();
+ String name = target != null ? target.toString() : (className + System.currentTimeMillis());
+ AbstractBeanMetaData beanMetaData = new AbstractBeanMetaData(name, className);
+ try
+ {
+ KernelControllerContext context = controller.install(beanMetaData, target);
+ checkContextState(context);
+ doTestAfterInstall(clazz, target);
+ }
+ finally
+ {
+ controller.uninstall(name);
+ }
+ }
+
+ protected void checkContextState(KernelControllerContext context)
+ {
+ assertEquals(ControllerState.INSTALLED, context.getState());
+ }
+
+ /**
+ * Useful for single tests.
+ * Else determine the test by parameters.
+ *
+ * @param clazz the class
+ * @param target the target
+ */
+ protected void doTestAfterInstall(Class<?> clazz, Object target)
+ {
+ }
+
+ protected KernelController createController() throws Exception
+ {
+ // bootstrap
+ KernelConfig config = createKernelConfig();
+ BasicBootstrap bootstrap = config != null ? new BasicBootstrap(config) : new BasicBootstrap();
+ bootstrap.run();
+ Kernel kernel = bootstrap.getKernel();
+ return kernel.getController();
+ }
+
+ protected KernelConfig createKernelConfig()
+ {
+ return null;
+ }
+
+ protected KernelController getController()
+ {
+ return controller;
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java 2008-02-24 23:19:46 UTC (rev 70050)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/AnnotationsTestSuite.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -25,6 +25,7 @@
import junit.framework.Test;
import junit.textui.TestRunner;
import org.jboss.test.kernel.annotations.test.override.AnnotationsOverrideTestSuite;
+import org.jboss.test.kernel.annotations.test.inheritance.AnnotationsInheritanceTestSuite;
/**
* Annotations tests.
@@ -44,6 +45,7 @@
suite.addTest(AnnotationSupportTestSuite.suite());
suite.addTest(AnnotationsOverrideTestSuite.suite());
+ suite.addTest(AnnotationsInheritanceTestSuite.suite());
return suite;
}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/CleanupAnnotationTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/CleanupAnnotationTestCase.java 2008-02-24 23:19:46 UTC (rev 70050)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/CleanupAnnotationTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -36,7 +36,7 @@
*
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
-public class CleanupAnnotationTestCase extends AbstractBeanAnnotationAdapterTestCase
+public class CleanupAnnotationTestCase extends AbstractBeanAnnotationAdapterTest
{
public CleanupAnnotationTestCase(String name)
{
@@ -63,7 +63,7 @@
public void testCleanup() throws Throwable
{
reset();
- runAnnotations(new TestCleanupBean());
+ runAnnotationsOnTarget(new TestCleanupBean());
assertTrue(TestCleanupPlugin.INSTANCE.isApplied());
assertTrue(TestCleanupPlugin.INSTANCE.isCleaned());
assertFalse(TestCleanupOnlyPlugin.INSTANCE.isApplied());
@@ -75,7 +75,7 @@
public void testCleanupOnly() throws Throwable
{
reset();
- runAnnotations(new TestCleanupOnlyBean());
+ runAnnotationsOnTarget(new TestCleanupOnlyBean());
assertFalse(TestCleanupPlugin.INSTANCE.isApplied());
assertFalse(TestCleanupPlugin.INSTANCE.isCleaned());
assertFalse(TestCleanupOnlyPlugin.INSTANCE.isApplied());
@@ -87,7 +87,7 @@
public void testApplyOnly() throws Throwable
{
reset();
- runAnnotations(new TestApplyOnlyBean());
+ runAnnotationsOnTarget(new TestApplyOnlyBean());
assertFalse(TestCleanupPlugin.INSTANCE.isApplied());
assertFalse(TestCleanupPlugin.INSTANCE.isCleaned());
assertFalse(TestCleanupOnlyPlugin.INSTANCE.isApplied());
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AbstractAnnotationInheritanceTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AbstractAnnotationInheritanceTest.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AbstractAnnotationInheritanceTest.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,52 @@
+/*
+* 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.annotations.test.inheritance;
+
+import org.jboss.test.kernel.annotations.test.AbstractRunAnnotationsTest;
+
+/**
+ * Testing annotations inheritance.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractAnnotationInheritanceTest extends AbstractRunAnnotationsTest
+{
+ protected AbstractAnnotationInheritanceTest(String name)
+ {
+ super(name);
+ }
+
+ protected void doTestAfterInstall(Class<?> clazz, Object target)
+ {
+ assertInstanceOf(target, clazz);
+ doTestAfterInstall(clazz.cast(target));
+ }
+
+ protected void doTestAfterInstall(Object target)
+ {
+ doTestAfterInstall();
+ }
+
+ protected void doTestAfterInstall()
+ {
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AnnotationsInheritanceTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AnnotationsInheritanceTestSuite.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/AnnotationsInheritanceTestSuite.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,55 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Testing annotations inheritance.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AnnotationsInheritanceTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Annotation Inheritance tests");
+
+ suite.addTest(PropertyAnnotationInheritanceTestCase.suite());
+ suite.addTest(ConstructorAnnotationInheritanceTestCase.suite());
+ suite.addTest(LifecycleAnnotationInheritanceTestCase.suite());
+ suite.addTest(CallbackAnnotationInheritanceTestCase.suite());
+ suite.addTest(InstallationAnnotationInheritanceTestCase.suite());
+ suite.addTest(SetsAnnotationInheritanceTestCase.suite());
+ suite.addTest(FactoryAnnotationInheritanceTestCase.suite());
+ suite.addTest(ExternalAnnotationInheritanceTestCase.suite());
+
+ return suite;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/CallbackAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/CallbackAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/CallbackAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,46 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+
+/**
+ * Callback annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public CallbackAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(CallbackAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ConstructorAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ConstructorAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ConstructorAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,67 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.kernel.annotations.support.ConstructorInheritanceTester;
+import org.jboss.test.kernel.annotations.support.SubConstructorInheritanceTester;
+
+/**
+ * Constructor annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ConstructorAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public ConstructorAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(ConstructorAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ KernelController controller = getController();
+ controller.install(new AbstractBeanMetaData("somebean", Object.class.getName()));
+ SubConstructorInheritanceTester tester = new SubConstructorInheritanceTester();
+ runAnnotationsOnTarget(tester);
+
+ ControllerContext kcc = controller.install(new AbstractBeanMetaData("cit", ConstructorInheritanceTester.class.getName()));
+ assertNotNull(kcc);
+ assertNotNull(kcc.getTarget());
+ assertInstanceOf(kcc.getTarget(), ConstructorInheritanceTester.class);
+ assertNotNull(((ConstructorInheritanceTester)kcc.getTarget()).getValue());
+ }
+
+ protected void doTestAfterInstall(Object target)
+ {
+ SubConstructorInheritanceTester tester = (SubConstructorInheritanceTester)target;
+ assertNull(tester.getValue());
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ExternalAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ExternalAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/ExternalAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,47 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+
+/**
+ * External annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ExternalAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public ExternalAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(ExternalAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ //TODO
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/FactoryAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/FactoryAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/FactoryAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,47 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+
+/**
+ * Factory annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FactoryAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public FactoryAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(FactoryAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ //TODO
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/InstallationAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/InstallationAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/InstallationAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,47 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+
+/**
+ * Installation annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class InstallationAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public InstallationAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(InstallationAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ //TODO
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/LifecycleAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/LifecycleAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/LifecycleAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,58 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.annotations.support.SubLifecycleAnnotationTester;
+
+/**
+ * Lifecycle annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class LifecycleAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public LifecycleAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(LifecycleAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ SubLifecycleAnnotationTester tester = new SubLifecycleAnnotationTester();
+ runAnnotationsOnTarget(tester);
+ Object[] value = tester.getValue();
+ assertEquals(new Object[]{null, null, "dewdew", "dew"}, value);
+ }
+
+ protected void doTestAfterInstall(Object target)
+ {
+ SubLifecycleAnnotationTester tester = (SubLifecycleAnnotationTester)target;
+ Object[] value = tester.getValue();
+ assertEquals(new Object[]{"dew", "dewdew", null, null}, value);
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/PropertyAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/PropertyAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/PropertyAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,59 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.test.kernel.annotations.support.SubPropertyInheritanceTester;
+
+/**
+ * Property annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PropertyAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public PropertyAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(PropertyAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ KernelController controller = getController();
+ controller.install(new AbstractBeanMetaData("somebean", Object.class.getName()));
+ SubPropertyInheritanceTester tester = new SubPropertyInheritanceTester();
+ runAnnotationsOnTarget(tester);
+ }
+
+ protected void doTestAfterInstall(Object target)
+ {
+ SubPropertyInheritanceTester tester = (SubPropertyInheritanceTester)target;
+ assertNotNull(tester.getValue());
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/SetsAnnotationInheritanceTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/SetsAnnotationInheritanceTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/annotations/test/inheritance/SetsAnnotationInheritanceTestCase.java 2008-02-24 23:28:02 UTC (rev 70051)
@@ -0,0 +1,82 @@
+/*
+* 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.annotations.test.inheritance;
+
+import junit.framework.Test;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.test.kernel.annotations.support.SubSetsAnnotationTester;
+import org.jboss.test.kernel.annotations.support.SetsAnnotationTester;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Sets annotation inheritance test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SetsAnnotationInheritanceTestCase extends AbstractAnnotationInheritanceTest
+{
+ public SetsAnnotationInheritanceTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(SetsAnnotationInheritanceTestCase.class);
+ }
+
+ public void testInheritance() throws Throwable
+ {
+ KernelController controller = getController();
+ AbstractBeanMetaData bmd1 = new AbstractBeanMetaData("deployer", Object.class.getName());
+ controller.install(bmd1);
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("demander", Object.class.getName());
+ builder.addDemand("somesupply");
+ controller.install(builder.getBeanMetaData());
+ runAnnotationsOnClass(SubSetsAnnotationTester.class);
+ controller.install(new AbstractBeanMetaData("setssupplier", SetsAnnotationTester.class.getName()));
+ checkDemander(ControllerState.INSTALLED);
+ }
+
+ protected void doTestAfterInstall()
+ {
+ checkDemander(ControllerState.PRE_INSTALL);
+ }
+
+ protected void checkDemander(ControllerState state)
+ {
+ try
+ {
+ Controller controller = getController();
+ ControllerContext context = controller.getContext("demander", state);
+ assertNotNull(context);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list