[Jboss-cvs] JBossAS SVN: r55022 - trunk/system/src/tests/org/jboss/beans/container/support

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 2 02:32:11 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-02 02:32:10 -0400 (Wed, 02 Aug 2006)
New Revision: 55022

Removed:
   trunk/system/src/tests/org/jboss/beans/container/support/AbstractBeanContainerTestCase.java
   trunk/system/src/tests/org/jboss/beans/container/support/AbstractMutableBeanContainerTestCase.java
   trunk/system/src/tests/org/jboss/beans/container/support/ContainerTestSuite.java
Log:
Remove the unused bean container tests

Deleted: trunk/system/src/tests/org/jboss/beans/container/support/AbstractBeanContainerTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/beans/container/support/AbstractBeanContainerTestCase.java	2006-08-02 06:31:22 UTC (rev 55021)
+++ trunk/system/src/tests/org/jboss/beans/container/support/AbstractBeanContainerTestCase.java	2006-08-02 06:32:10 UTC (rev 55022)
@@ -1,205 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.beans.container.support;
-
-import org.jboss.beans.container.BeanContainer;
-import org.jboss.beans.container.UnknownBeanException;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-import org.jboss.test.BaseTestCase;
-
-import java.net.URL;
-import java.util.Set;
-
-/**
- * Test case for the {@link AbstractBeanContainer} implementation.
- * 
- * @author <a href="mailto:les.hazlewood at jboss.org">Les A. Hazlewood</a>
- * @version <tt>$Revision$</tt>
- */
-public class AbstractBeanContainerTestCase extends BaseTestCase
-{
-   public AbstractBeanContainerTestCase( String name )
-   {
-      super( name );
-   }
-
-   protected BeanContainer newContainer()
-   {
-      //create very simple bean container implementation, populated
-      //by xml:
-      return new AbstractBeanContainer()
-      {
-         public void onInit()
-         {
-            try
-            {
-               //populate kernel:
-               Kernel kernel = getKernel();
-               BasicXMLDeployer deployer = new BasicXMLDeployer( kernel );
-               String name =  "AbstractBeanContainerTestCase.beans.xml";
-               log.debug( "Using " + name );
-               URL url = getClass().getResource( name );
-               log.debug( "url=" + url );
-               deployer.deploy( url );
-               deployer.validate();
-            }
-            catch ( Throwable t )
-            {
-               throw new RuntimeException( t );
-            }
-
-            //add some test aliases:
-            getAliases().put( "SimpleBean1Alias1", "SimpleBean1" );
-            getAliases().put( "SimpleBean1Alias2", "SimpleBean1" );
-            //no aliases for SimpleBean2
-         }
-      };
-   }
-
-   public void testGetBeanWhenBeanExists()
-   {
-      BeanContainer container = newContainer();
-
-      try
-      {
-         container.getBean( "SimpleBean1" );
-      }
-      catch ( UnknownBeanException e )
-      {
-         fail( "SimpleBean1 should be available for retrieval" );
-      }
-   }
-
-   public void testGetBeanWhenBeanDoesNotExist()
-   {
-      BeanContainer container = newContainer();
-      try
-      {
-         container.getBean("NonExistentBean");
-         fail( "No bean should be retrieved" );
-      }
-      catch ( UnknownBeanException expected ){}
-   }
-
-   public void testGetBeanWithAliasWhenBeanExists()
-   {
-      BeanContainer container = newContainer();
-      try
-      {
-         SimpleBean orig = (SimpleBean)container.getBean("SimpleBean1");
-         SimpleBean bean1 = (SimpleBean)container.getBean("SimpleBean1Alias1");
-         SimpleBean bean2 = (SimpleBean)container.getBean("SimpleBean1Alias2");
-         assertTrue( "retrieved beans should be equal",
-                     orig.equals(bean1) && orig.equals(bean2) &&
-                     bean1.equals(bean2) );
-         assertTrue( "retrieved beans should be the same memory reference",
-                     (orig == bean1) && (orig == bean2) && (bean1 == bean2) );
-      }
-      catch ( UnknownBeanException e )
-      {
-         fail( "SimpleBean1Alias1 should be a registered alias for SimpleBean1");
-      }
-   }
-
-   public void testGetTypeWhenBeanExists()
-   {
-      BeanContainer container = newContainer();
-
-      try
-      {
-         Class clazz = container.getType( "SimpleBean1" );
-         assertTrue( "Class types should be equal",
-                     clazz.equals( SimpleBeanImpl.class ) );
-      }
-      catch ( UnknownBeanException e )
-      {
-         fail( "SimpleBean1 should be available for retrieval" );
-      }
-   }
-
-   public void testGetTypeWhenBeanDoesNotExist()
-   {
-      BeanContainer container = newContainer();
-
-      try
-      {
-         container.getType( "NonExistentBean" );
-         fail( "NonExistentBean should not be available" );
-      }
-      catch ( UnknownBeanException expected ) {}
-   }
-
-
-   public void testContainsBeanWhenBeanExists()
-   {
-      BeanContainer container = newContainer();
-      assertTrue( "SimpleBean1 should exist",
-                  container.containsBean("SimpleBean1" ) );
-   }
-
-   public void testContainsBeanWhenBeanDoesNotExist()
-   {
-      BeanContainer container = newContainer();
-      assertFalse( "NotExistentBean should not exist",
-                   container.containsBean( "NonExistentBean" ) );
-   }
-
-   public void testContainsBeanWithAliasWhenBeanExists()
-   {
-      BeanContainer container = newContainer();
-      assertTrue( "SimpleBean1Alias1 should exist",
-                  container.containsBean("SimpleBean1Alias1" ) );
-      assertTrue( "SimpleBean1Alias1 should exist",
-                  container.containsBean("SimpleBean1Alias2" ) );
-   }
-
-   public void testGetAliasesWithOriginalName()
-   {
-      BeanContainer container = newContainer();
-      Set aliases = container.getAliases( "SimpleBean1" );
-      assertTrue( "alias set should have 2 entries",
-                  aliases.size() == 2 );
-      assertTrue( "alias 'SimpleBean1Alias1 should be in the alias set",
-                  aliases.contains( "SimpleBean1Alias1" ) );
-      assertTrue( "alias 'SimpleBean1Alias2 should be in the alias set",
-                  aliases.contains( "SimpleBean1Alias2" ) );
-   }
-
-   public void testGetAliasesWithAnAlias()
-   {
-      BeanContainer container = newContainer();
-      Set aliases = container.getAliases( "SimpleBean1Alias1" );
-      assertTrue( "alias set should have 2 entries",
-                  aliases.size() == 2 );
-      assertTrue( "alias 'SimpleBean1Alias1 should be in the alias set",
-                  aliases.contains( "SimpleBean1Alias1" ) );
-      assertTrue( "alias 'SimpleBean1Alias2 should be in the alias set",
-                  aliases.contains( "SimpleBean1Alias2" ) );
-   }
-
-   public void testGetAliasesWhenBeanDoesNotExist()
-   {
-      BeanContainer container = newContainer();
-      try
-      {
-         container.getAliases( "NonExistentBean" );
-         fail( "NonExistentBean should not be available" );
-      }
-      catch ( UnknownBeanException expected ) {}
-   }
-
-   public void testGetAliasesForBeanWithNoAliases()
-   {
-      BeanContainer container = newContainer();
-      Set set = container.getAliases( "SimpleBean2" );
-      assertTrue( "an empty set should be returned for a bean with no aliases",
-                  set.isEmpty() );
-   }
-
-}

Deleted: trunk/system/src/tests/org/jboss/beans/container/support/AbstractMutableBeanContainerTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/beans/container/support/AbstractMutableBeanContainerTestCase.java	2006-08-02 06:31:22 UTC (rev 55021)
+++ trunk/system/src/tests/org/jboss/beans/container/support/AbstractMutableBeanContainerTestCase.java	2006-08-02 06:32:10 UTC (rev 55022)
@@ -1,326 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.beans.container.support;
-
-import org.jboss.beans.container.MutableBeanContainer;
-import org.jboss.beans.container.UnknownBeanException;
-import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-import org.jboss.test.BaseTestCase;
-
-import java.net.URL;
-
-/**
- * TestCase for the {@link AbstractMutableBeanContainer} class.
- *
- * @author <a href="mailto:les.hazlewood at jboss.org">Les A. Hazlewood</a>
- * @version <tt>$Revision$</tt>
- */
-public class AbstractMutableBeanContainerTestCase extends BaseTestCase
-{
-   public AbstractMutableBeanContainerTestCase( String name )
-   {
-      super( name );
-   }
-
-   protected MutableBeanContainer newOverwritingContainer()
-   {
-      //create very simple bean container implementation, populated by xml:
-      return new AbstractMutableBeanContainer()
-      {
-         public void onInit()
-         {
-            try
-            {
-               //populate kernel:
-               Kernel kernel = getKernel();
-               BasicXMLDeployer deployer = new BasicXMLDeployer( kernel );
-               String name =  "AbstractMutableBeanContainerTestCase.beans.xml";
-               log.debug( "Using " + name );
-               URL url = getClass().getResource( name );
-               log.debug( "url=" + url );
-               deployer.deploy( url );
-               deployer.validate();
-
-               //allow bean overwriting:
-               setBeanOverwritingEnabled( true );
-            }
-            catch ( Throwable t )
-            {
-               throw new RuntimeException( t );
-            }
-         }
-      };
-   }
-
-   protected MutableBeanContainer newContainer()
-   {
-      //create very simple bean container implementation, populated by xml:
-      //does not allow bean overwriting
-      return new AbstractMutableBeanContainer()
-      {
-         public void onInit()
-         {
-            try
-            {
-               //populate kernel:
-               Kernel kernel = getKernel();
-               BasicXMLDeployer deployer = new BasicXMLDeployer( kernel );
-               String name =  "AbstractMutableBeanContainerTestCase.beans.xml";
-               log.debug( "Using " + name );
-               URL url = getClass().getResource( name );
-               log.debug( "url=" + url );
-               deployer.deploy( url );
-               deployer.validate();
-            }
-            catch ( Throwable t )
-            {
-               throw new RuntimeException( t );
-            }
-         }
-      };
-   }
-
-   public void testPutBeanWithNullArguments() {
-      MutableBeanContainer container = newContainer();
-      try
-      {
-         container.putBean( null, new SimpleBeanImpl() );
-         fail( "Null names are not allowed" );
-      }
-      catch ( IllegalArgumentException expected ) {}
-
-      try
-      {
-         container.putBean( "SimpleBean3", null );
-         fail( "Null beans are not allowed" );
-      }
-      catch ( IllegalArgumentException expected ) {}
-
-      try
-      {
-         container.putBean( null, null );
-         fail( "Null arguments are not allowed" );
-      }
-      catch ( IllegalArgumentException expected ) {}
-   }
-
-   public void testPutBeanWhenBeanDoesNotExist()
-   {
-      MutableBeanContainer container = newContainer();
-      SimpleBeanImpl pojo = new SimpleBeanImpl();
-      container.putBean( "SimpleBean3", pojo );
-
-      //verify the same bean is retrieved:
-      SimpleBeanImpl retrieved = (SimpleBeanImpl)container.getBean( "SimpleBean3" );
-      assertTrue( "retrieved and original beans should be identical",
-                  pojo == retrieved );
-   }
-
-   public void testPutBeanWhenBeanExistsAndOverwritingDisabled()
-   {
-      MutableBeanContainer container = newContainer();
-      SimpleBeanImpl pojo = new SimpleBeanImpl();
-      try
-      {
-         container.putBean( "SimpleBean1", pojo );
-         fail( "bean overwriting should be disabled");
-      }
-      catch ( DuplicateNameException expected ) {}
-   }
-
-   public void testPutBeanWhenBeanExistsAndOverwritingEnabled()
-   {
-      MutableBeanContainer container = newOverwritingContainer();
-      try
-      {
-         SimpleBeanImpl orig = (SimpleBeanImpl)container.getBean( "SimpleBean1" );
-         SimpleBeanImpl newPojo = new SimpleBeanImpl();
-
-         //verify different:
-         assertFalse( "orignal bean and newPojo should be different",
-                      orig.equals( newPojo ) );
-
-         //overwrite:
-         container.putBean( "SimpleBean1", newPojo );
-
-         SimpleBeanImpl retrieved = (SimpleBeanImpl)container.getBean( "SimpleBean1" );
-
-         //verify the retrieved bean is different from the original:
-         assertFalse( "original pojo and retrieved pojo should be different",
-                      orig.equals( retrieved ) );
-         assertFalse( "original pojo and retrieved should have different memory addresses",
-                      orig == retrieved );
-
-         //verify the retrieved bean is the same as the newPojo:
-         assertTrue( "new pojo and retrieved pojo should be the same",
-                      newPojo.equals( retrieved ) );
-         assertTrue( "new pojo and retrieved should have the same memory addresses",
-                      newPojo == retrieved );
-      }
-      catch ( DuplicateNameException expected )
-      {
-         expected.printStackTrace();
-         fail( "bean overwriting should be enabled" );
-      }
-   }
-
-   public void testAddAliasWhenBeanDoesNotExist()
-   {
-      MutableBeanContainer container = newContainer();
-      try
-      {
-         container.addAlias( "NonExistentBean", "alias" );
-         fail( "NonExistentBean should not exist" );
-      }
-      catch ( UnknownBeanException expected ) {}
-   }
-
-   public void testAddAliasWhenBeanExists()
-   {
-      MutableBeanContainer container = newContainer();
-      SimpleBeanImpl pojo = (SimpleBeanImpl)container.getBean( "SimpleBean1" );
-
-      //add the alias:
-      container.addAlias( "SimpleBean1", "SimpleBean1Alias1" );
-
-      //verify the same pojo is now accessible by the alias:
-      SimpleBeanImpl retrieved = (SimpleBeanImpl)container.getBean( "SimpleBean1Alias1" );
-      assertTrue( "retrieved alias instance should be the same as original bean",
-                  retrieved.equals( pojo ) );
-      assertTrue( "retrieved alias instance should have the same memory address",
-                  retrieved == pojo );
-   }
-
-   public void testAddAliasWhenAliasIsAlreadyUsed()
-   {
-      MutableBeanContainer container = newContainer();
-
-      //add an alias to it where the alias is the name of an existing bean:
-      try
-      {
-         container.addAlias( "SimpleBean1", "SimpleBean2" );
-         fail("SimpleBean2 is the name of another bean and cannot be used as an alias");
-      }
-      catch ( DuplicateNameException expected ) {}
-
-      //add a legitimate alias to SimpleBean2 and then try to use it as an
-      //alias for SimpleBean1
-      container.addAlias( "SimpleBean2", "SimpleBean2Alias1" );
-      try
-      {
-         container.addAlias( "SimpleBean1", "SimpleBean2Alias1" );
-         fail("SimpleBean2Alias1 is the alias of another bean and cannot be " +
-            "used as an alias for SimpleBean1" );
-      }
-      catch ( DuplicateNameException expected ) {}
-   }
-
-   public void testAddAliasWhenBeanNameIsAlsoAnAlias()
-   {
-      MutableBeanContainer container = newContainer();
-      SimpleBeanImpl orig = (SimpleBeanImpl)container.getBean( "SimpleBean1" );
-
-      //add the alias:
-      container.addAlias( "SimpleBean1", "SimpleBean1Alias1" );
-
-      //add another alias, using the first alias:
-      container.addAlias( "SimpleBean1Alias1", "SimpleBean1Alias2" );
-
-      //verify the bean pulled using the 2nd alias is the same as the original pojo:
-      SimpleBeanImpl retrieved = (SimpleBeanImpl)container.getBean( "SimpleBean1Alias2" );
-      assertTrue( "retrieved bean and original pojo should be the same instance",
-                  orig == retrieved );
-   }
-
-   public void testRemoveBean()
-   {
-      MutableBeanContainer container = newContainer();
-      SimpleBeanImpl orig = (SimpleBeanImpl)container.getBean( "SimpleBean1" );
-
-      //now remove it:
-      SimpleBeanImpl removed = (SimpleBeanImpl)container.removeBean( "SimpleBean1" );
-
-      //assert the bean removed is the same as the original:
-      assertTrue( "original and removed pojos should be identical",
-                  orig == removed );
-
-      //verify the bean is no longer available:
-      assertFalse( "original bean should no longer be available",
-                   container.containsBean( "SimpleBean1" ) );
-
-      //verify retrieval is not possible:
-      try
-      {
-         container.getBean( "SimpleBean1" );
-         fail( "SimpleBean1 should have been removed from the container" );
-      }
-      catch ( UnknownBeanException expected ){}
-   }
-
-   public void testRemoveBeanWhenBeanDoesNotExist()
-   {
-      MutableBeanContainer container = newContainer();
-      Object removed = container.removeBean( "NonExistentBean" );
-      //no bean named NonExistentBean, so verify null was returned:
-      assertTrue( "return value should be null", removed == null );
-   }
-
-   public void testRemoveBeanFromAlias()
-   {
-      MutableBeanContainer container = newContainer();
-
-      SimpleBeanImpl orig = (SimpleBeanImpl)container.getBean( "SimpleBean1" );
-
-      //first register an alias:
-      container.addAlias( "SimpleBean1", "SimpleBean1Alias1" );
-
-      //now remove the bean by using the alias:
-      SimpleBeanImpl removed = (SimpleBeanImpl)container.removeBean( "SimpleBean1Alias1" );
-
-      //verify the bean returned is that of the original:
-      assertTrue( "Bean removed should be identical to original",
-                  orig == removed );
-
-      //verify the bean is no longer accessible to the container by either
-      //the original name or its alias:
-      assertFalse( container.containsBean( "SimpleBean1" ) );
-      assertFalse( container.containsBean( "SimpleBean1Alias1" ) );
-   }
-
-   public void testRemoveAliasWhenAliasDoesNotExist()
-   {
-      MutableBeanContainer container = newContainer();
-      //should be a no-op:
-      container.removeAlias( "NonExistentAlias" );
-   }
-
-   public void testRemoveAliasWhenAliasesExist()
-   {
-      MutableBeanContainer container = newContainer();
-
-      //register an alias:
-      container.addAlias( "SimpleBean1", "SimpleBean1Alias1" );
-      assertTrue( "SimpleBean1 should only have 1 alias",
-                  container.getAliases( "SimpleBean1" ).size() == 1 );
-
-      //remove the alias:
-      container.removeAlias( "SimpleBean1Alias1" );
-      assertTrue("SimpleBean1 should not have any aliases",
-                 container.getAliases( "SimpleBean1" ).size() == 0 );
-   }
-
-   public void testRemoveAliasWhenAliasIsRootName() {
-      MutableBeanContainer container = newContainer();
-      container.removeAlias( "SimpleBean1" );
-      //SimpleBean1 is a true name, not an alias, so it should still be
-      //available:
-      assertTrue( "SimpleBean1 should be in the container",
-                  container.containsBean( "SimpleBean1" ) );
-   }
-}

Deleted: trunk/system/src/tests/org/jboss/beans/container/support/ContainerTestSuite.java
===================================================================
--- trunk/system/src/tests/org/jboss/beans/container/support/ContainerTestSuite.java	2006-08-02 06:31:22 UTC (rev 55021)
+++ trunk/system/src/tests/org/jboss/beans/container/support/ContainerTestSuite.java	2006-08-02 06:32:10 UTC (rev 55022)
@@ -1,34 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package org.jboss.beans.container.support;
-
-import junit.framework.TestSuite;
-import junit.framework.Test;
-import junit.textui.TestRunner;
-
-/**
- * @author <a href="mailto:les.hazlewood at jboss.org">Les A. Hazlewood</a>
- * @version <tt>$Revision$</tt>
- */
-public class ContainerTestSuite extends TestSuite
-{
-   public static void main( String[] args )
-   {
-      TestRunner.run( suite() );
-   }
-
-   public static Test suite()
-   {
-      TestSuite suite = new TestSuite("BeanContainer Tests");
-
-      suite.addTest( new TestSuite( AbstractBeanContainerTestCase.class ) );
-      suite.addTest( new TestSuite( AbstractMutableBeanContainerTestCase.class ) );
-
-      return suite;
-   }
-}




More information about the jboss-cvs-commits mailing list