avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/test HandlersTestCase.java
Date Sun, 10 Nov 2002 12:42:44 GMT
donaldp     2002/11/10 04:42:44

  Modified:    fortress/src/test/org/apache/excalibur/fortress/test
                        HandlersTestCase.java
  Log:
  Add a unit test for factorys
  
  Revision  Changes    Path
  1.2       +44 -2     jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/test/HandlersTestCase.java
  
  Index: HandlersTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/test/HandlersTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlersTestCase.java	10 Nov 2002 12:39:27 -0000	1.1
  +++ HandlersTestCase.java	10 Nov 2002 12:42:44 -0000	1.2
  @@ -16,8 +16,8 @@
   import org.apache.excalibur.fortress.container.DefaultContainer;
   import org.apache.excalibur.fortress.test.data.BaseRole;
   import org.apache.excalibur.fortress.test.data.Role1;
  -import org.apache.excalibur.fortress.test.data.Role2;
   import org.apache.excalibur.fortress.test.data.Role3;
  +import org.apache.excalibur.fortress.test.data.Role4;
   import org.apache.excalibur.fortress.util.ContextBuilder;
   
   /**
  @@ -99,6 +99,48 @@
                       assertTrue( type + " object IDs (1 vs 3)", object1.getID() != object3.getID()
);
                       assertTrue( type + " object IDs (2 vs 4)", object2.getID() != object4.getID()
);
                       assertEquals( type + " object IDs (3 vs 4)", object3.getID(), object4.getID()
);
  +                }
  +                catch( final Exception e )
  +                {
  +                    m_exception = e;
  +                }
  +            }
  +        };
  +        thread.start();
  +        thread.join();
  +
  +        if( null != m_exception )
  +        {
  +            final Exception exception = m_exception;
  +            m_exception = null;
  +            throw exception;
  +        }
  +    }
  +
  +    public void testFactory()
  +        throws Exception
  +    {
  +        final String key = Role4.ROLE;
  +        final String type = "Factory";
  +
  +        final ServiceManager serviceManager = getServiceManager();
  +        final BaseRole object1 = (BaseRole)serviceManager.lookup( key );
  +        final BaseRole object2 = (BaseRole)serviceManager.lookup( key );
  +
  +        assertTrue( type + " object IDs (1 vs 2)", object1.getID() != object2.getID() );
  +
  +        final Thread thread = new Thread()
  +        {
  +            public void run()
  +            {
  +                try
  +                {
  +                    final BaseRole object3 = (BaseRole)serviceManager.lookup( key );
  +                    final BaseRole object4 = (BaseRole)serviceManager.lookup( key );
  +
  +                    assertTrue( type + " object IDs (1 vs 3)", object1.getID() != object3.getID()
);
  +                    assertTrue( type + " object IDs (2 vs 4)", object2.getID() != object4.getID()
);
  +                    assertTrue( type + " object IDs (3 vs 4)", object3.getID() != object4.getID()
);
                   }
                   catch( final Exception e )
                   {
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message