[jboss-cvs] JBossAS SVN: r69824 - 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
Wed Feb 13 09:25:25 EST 2008


Author: adrian at jboss.org
Date: 2008-02-13 09:25:25 -0500 (Wed, 13 Feb 2008)
New Revision: 69824

Added:
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase_NotAutomatic.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiated.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiatedRepository.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.java
Modified:
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
Log:
Add a test for callbacks when installed beans are in the instantiated state

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.xml	2008-02-13 14:25:25 UTC (rev 69824)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="Repository" class="org.jboss.test.kernel.deployment.support.InCallbackInstantiatedRepository">
+      <incallback method="add" state="Instantiated"/>
+      <uncallback method="remove" state="Instantiated"/>
+   </bean>
+
+</deployment>

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase_NotAutomatic.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase_NotAutomatic.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase_NotAutomatic.xml	2008-02-13 14:25:25 UTC (rev 69824)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="Bean" class="org.jboss.test.kernel.deployment.support.InCallbackInstantiated">
+      <property name="configured">Bean</property>
+   </bean>
+
+</deployment>

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiated.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiated.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiated.java	2008-02-13 14:25:25 UTC (rev 69824)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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;
+
+/**
+ * InCallbackInstantiated.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class InCallbackInstantiated
+{
+   private String configured = null;
+   
+   public String getConfigured()
+   {
+      return configured;
+   }
+   
+   public void setConfigured(String configured)
+   {
+      this.configured = configured;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiatedRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiatedRepository.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/InCallbackInstantiatedRepository.java	2008-02-13 14:25:25 UTC (rev 69824)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.util.ArrayList;
+import java.util.List;
+
+/**
+ * InCallbackInstantiatedRepository.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class InCallbackInstantiatedRepository
+{
+   public List<InCallbackInstantiated> registered = new ArrayList<InCallbackInstantiated>();
+   
+   public void add(InCallbackInstantiated bean)
+   {
+      checkNotConfigured(bean);
+      registered.add(bean);
+   }
+   
+   public void remove(InCallbackInstantiated bean)
+   {
+      checkNotConfigured(bean);
+      registered.remove(bean);
+   }
+   
+   private void checkNotConfigured(InCallbackInstantiated bean)
+   {
+      String configured = bean.getConfigured();
+      if (configured != null)
+         throw new IllegalStateException("Bean should not be configured " + configured);
+   }
+}

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-02-13 14:16:17 UTC (rev 69823)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java	2008-02-13 14:25:25 UTC (rev 69824)
@@ -62,6 +62,7 @@
       suite.addTest(InnerBeanScopingTestCase.suite());
       suite.addTest(ScopingShutdownTestCase.suite());
       suite.addTest(FromContextUnsupportedTestCase.suite());
+      suite.addTest(InCallbackInstantiatedTestCase.suite());
 
       return suite;
    }

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InCallbackInstantiatedTestCase.java	2008-02-13 14:25:25 UTC (rev 69824)
@@ -0,0 +1,71 @@
+/*
+* 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 java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.test.kernel.deployment.support.InCallbackInstantiated;
+import org.jboss.test.kernel.deployment.support.InCallbackInstantiatedRepository;
+import org.jboss.test.kernel.deployment.support.WildcardClassLoader;
+
+/**
+ * Deployment ClassLoader Test Case.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40742 $
+ */
+public class InCallbackInstantiatedTestCase extends AbstractDeploymentTest
+{
+   public static Test suite()
+   {
+      return suite(InCallbackInstantiatedTestCase.class);
+   }
+
+   public InCallbackInstantiatedTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   public void testWildcardClassLoader() throws Throwable
+   {
+      InCallbackInstantiatedRepository repository = assertInstanceOf(getBean("Repository"), InCallbackInstantiatedRepository.class);
+      KernelDeployment deployment = deploy("InCallbackInstantiatedTestCase_NotAutomatic.xml");
+      try
+      {
+         validate();
+         
+         List<InCallbackInstantiated> registered = repository.registered;
+         assertEquals(1, registered.size());
+         InCallbackInstantiated bean = registered.get(0);
+         assertEquals("Bean", bean.getConfigured());
+      }
+      finally
+      {
+         undeploy(deployment);
+      }
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list