[jboss-cvs] JBossAS SVN: r76826 - in projects/microcontainer/trunk/kernel/src: tests/org/jboss/test/kernel/deployment/support and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 8 08:22:12 EDT 2008


Author: adrian at jboss.org
Date: 2008-08-08 08:22:11 -0400 (Fri, 08 Aug 2008)
New Revision: 76826

Added:
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase_NotAutomatic.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation1.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation2.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation3.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase.java
Modified:
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
Log:
[JBMICROCONT-330] - Test for preconfigured instance metadata mixing with beans.xml

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase_NotAutomatic.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase_NotAutomatic.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase_NotAutomatic.xml	2008-08-08 12:22:11 UTC (rev 76826)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="TestBean" class="org.jboss.test.kernel.deployment.support.TestBean">
+      <annotation>@org.jboss.test.kernel.deployment.support.TestAnnotation1</annotation>
+   </bean>
+
+</deployment>

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation1.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation1.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation1.java	2008-08-08 12:22:11 UTC (rev 76826)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.support;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * TestAnnotation1.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface TestAnnotation1
+{
+
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation2.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation2.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation2.java	2008-08-08 12:22:11 UTC (rev 76826)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.support;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * TestAnnotation2.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface TestAnnotation2
+{
+
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation3.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation3.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestAnnotation3.java	2008-08-08 12:22:11 UTC (rev 76826)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.support;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * TestAnnotation3.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface TestAnnotation3
+{
+
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/TestBean.java	2008-08-08 12:22:11 UTC (rev 76826)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, 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.support;
+
+/**
+ * TestBean.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at TestAnnotation3
+public class TestBean
+{
+
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java	2008-08-08 12:14:57 UTC (rev 76825)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java	2008-08-08 12:22:11 UTC (rev 76826)
@@ -65,6 +65,7 @@
       suite.addTest(InCallbackInstantiatedTestCase.suite());
       suite.addTest(AnonymousBeansTestCase.suite());
       suite.addTest(AnonymousBeansXMLTestCase.suite());
+      suite.addTest(MutableMetaDataTestCase.suite());
       // bean container tests
       suite.addTest(BeanContainerUsageTestCase.suite());
       suite.addTest(BeanContainerUsageMDTestCase.suite());

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/MutableMetaDataTestCase.java	2008-08-08 12:22:11 UTC (rev 76826)
@@ -0,0 +1,90 @@
+/*
+* 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 junit.framework.Test;
+
+import org.jboss.annotation.factory.AnnotationCreator;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.test.kernel.deployment.support.TestAnnotation1;
+import org.jboss.test.kernel.deployment.support.TestAnnotation2;
+import org.jboss.test.kernel.deployment.support.TestAnnotation3;
+
+/**
+ * MutableMetaDataTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class MutableMetaDataTestCase extends AbstractDeploymentTest
+{
+   public static Test suite()
+   {
+      return suite(MutableMetaDataTestCase.class);
+   }
+
+   public MutableMetaDataTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   public void testMutableMetaData() throws Throwable
+   {
+      MutableMetaDataRepository repository = getMetaDataRepository().getMetaDataRepository();
+      ScopeKey instanceScope = new ScopeKey(CommonLevels.INSTANCE, "TestBean");
+      MemoryMetaDataLoader loader = new MemoryMetaDataLoader(instanceScope);
+      TestAnnotation2 annotation = (TestAnnotation2) AnnotationCreator.createAnnotation("@org.jboss.test.kernel.deployment.support.TestAnnotation2", TestAnnotation2.class);
+      loader.addAnnotation(annotation);
+      repository.addMetaDataRetrieval(loader);
+      
+      KernelDeployment deployment = deploy("MutableMetaDataTestCase_NotAutomatic.xml");
+      try
+      {
+         validate();
+         
+         ControllerContext ctx = getControllerContext("TestBean");
+         MetaData metaData = ctx.getScopeInfo().getMetaData();
+         assertNotNull(metaData);
+      
+         assertNotNull("TestAnnotation1 from xml", metaData.getAnnotation(TestAnnotation1.class));
+         assertNotNull("TestAnnotation2 preconfigured", metaData.getAnnotation(TestAnnotation2.class));
+         assertNotNull("TestAnnotation3 from class", metaData.getAnnotation(TestAnnotation3.class));
+      }
+      finally
+      {
+         undeploy(deployment);
+      }
+      
+      // Check the preconfigured stuff still exists
+      MetaData metaData = repository.getMetaData(instanceScope);
+      assertNotNull(metaData);
+      assertNull("TestAnnotation1 from xml", metaData.getAnnotation(TestAnnotation1.class));
+      assertNotNull("TestAnnotation2 preconfigured", metaData.getAnnotation(TestAnnotation2.class));
+      assertNull("TestAnnotation3 from class", metaData.getAnnotation(TestAnnotation3.class));
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list