[jboss-cvs] JBossAS SVN: r76817 - in projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean: support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 8 06:56:34 EDT 2008
Author: alesj
Date: 2008-08-08 06:56:33 -0400 (Fri, 08 Aug 2008)
New Revision: 76817
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotated.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedConstructor.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedInjection.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedStart.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/AnnotatedBeansUnitTestCase.java
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java
Log:
Add annotated beans test.
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java 2008-08-08 10:37:10 UTC (rev 76816)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/BeanDeployerTestSuite.java 2008-08-08 10:56:33 UTC (rev 76817)
@@ -29,6 +29,7 @@
import org.jboss.test.deployers.vfs.deployer.bean.test.BeanManagedDeploymentUnitTestCase;
import org.jboss.test.deployers.vfs.deployer.bean.test.BeanMetaDataFactoryDeployerUnitTestCase;
import org.jboss.test.deployers.vfs.deployer.bean.test.KernelScopeUnitTestCase;
+import org.jboss.test.deployers.vfs.deployer.bean.test.AnnotatedBeansUnitTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -60,6 +61,7 @@
suite.addTest(BeanScanningUnitTestCase.suite());
suite.addTest(BeanMetaDataFactoryDeployerUnitTestCase.suite());
suite.addTest(KernelScopeUnitTestCase.suite());
+ suite.addTest(AnnotatedBeansUnitTestCase.suite());
return suite;
}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotated.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotated.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotated.java 2008-08-08 10:56:33 UTC (rev 76817)
@@ -0,0 +1,39 @@
+/*
+* 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.deployers.vfs.deployer.bean.support;
+
+import org.jboss.dependency.spi.Controller;
+
+/**
+ * Simple annotated.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class SimpleAnnotated
+{
+ protected Controller controller;
+
+ public Controller getController()
+ {
+ return controller;
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedConstructor.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedConstructor.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedConstructor.java 2008-08-08 10:56:33 UTC (rev 76817)
@@ -0,0 +1,41 @@
+/*
+* 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.deployers.vfs.deployer.bean.support;
+
+import org.jboss.beans.metadata.api.annotations.Constructor;
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+
+/**
+ * Simple annotated.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleAnnotatedConstructor extends SimpleAnnotated
+{
+ @Constructor
+ public SimpleAnnotatedConstructor(@Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME) Controller controller)
+ {
+ this.controller = controller;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedInjection.java (from rev 76751, projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/Simple.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedInjection.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedInjection.java 2008-08-08 10:56:33 UTC (rev 76817)
@@ -0,0 +1,40 @@
+/*
+* 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.deployers.vfs.deployer.bean.support;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+
+/**
+ * Simple annotated.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleAnnotatedInjection extends SimpleAnnotated
+{
+ @Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME)
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedStart.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedStart.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/support/SimpleAnnotatedStart.java 2008-08-08 10:56:33 UTC (rev 76817)
@@ -0,0 +1,41 @@
+/*
+* 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.deployers.vfs.deployer.bean.support;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.Start;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
+
+/**
+ * Simple annotated start.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleAnnotatedStart extends SimpleAnnotated
+{
+ @Start
+ public void startOnController(@Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME) Controller controller)
+ {
+ this.controller = controller;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/AnnotatedBeansUnitTestCase.java (from rev 76751, projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/BeanScanningUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/AnnotatedBeansUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/AnnotatedBeansUnitTestCase.java 2008-08-08 10:56:33 UTC (rev 76817)
@@ -0,0 +1,107 @@
+/*
+* 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.deployers.vfs.deployer.bean.test;
+
+import java.util.Arrays;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer;
+import org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+import org.jboss.test.deployers.vfs.deployer.AbstractDeployerUnitTest;
+import org.jboss.test.deployers.vfs.deployer.bean.support.SimpleAnnotatedConstructor;
+import org.jboss.test.deployers.vfs.deployer.bean.support.SimpleAnnotatedInjection;
+import org.jboss.test.deployers.vfs.deployer.bean.support.SimpleAnnotatedStart;
+import org.jboss.test.deployers.vfs.deployer.bean.support.SimpleAnnotated;
+
+/**
+ * AnnotatedBeansUnitTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AnnotatedBeansUnitTestCase extends AbstractDeployerUnitTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(AnnotatedBeansUnitTestCase.class);
+ }
+
+ public AnnotatedBeansUnitTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void addDeployers(Kernel kernel)
+ {
+ KernelDeploymentDeployer kernelDeploymentDeployer = new KernelDeploymentDeployer();
+ BeanMetaDataDeployer beanMetaDataDeployer = new BeanMetaDataDeployer(kernel);
+ addDeployer(main, kernelDeploymentDeployer);
+ addDeployer(main, beanMetaDataDeployer);
+ }
+
+ public void testKernelScope() throws Exception
+ {
+ Deployment context = createSimpleDeployment("KernelDeployerTest");
+
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setName("KernelDeployerTest");
+ BeanMetaDataFactory md1 = new AbstractBeanMetaData("Constructor", SimpleAnnotatedConstructor.class.getName());
+ BeanMetaDataFactory md2 = new AbstractBeanMetaData("Injection", SimpleAnnotatedInjection.class.getName());
+ BeanMetaDataFactory md3 = new AbstractBeanMetaData("Start", SimpleAnnotatedStart.class.getName());
+ deployment.setBeanFactories(Arrays.asList(md1, md2, md3));
+ MutableAttachments attachments = (MutableAttachments) context.getPredeterminedManagedObjects();
+ attachments.addAttachment("KernelDeployerTest", deployment);
+
+ assertDeploy(context);
+ try
+ {
+ assertSimpleAnnotated("Constructor");
+ assertSimpleAnnotated("Injection");
+ assertSimpleAnnotated("Start");
+ }
+ finally
+ {
+ assertUndeploy(context);
+ }
+
+ assertNull(controller.getContext("Constructor", null));
+ assertNull(controller.getContext("Injection", null));
+ assertNull(controller.getContext("Start", null));
+ }
+
+ protected void assertSimpleAnnotated(Object name)
+ {
+ ControllerContext context = controller.getInstalledContext(name);
+ assertNotNull(context);
+ Object target = context.getTarget();
+ SimpleAnnotated annotated = assertInstanceOf(target, SimpleAnnotated.class);
+ assertSame(controller, annotated.getController());
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list