donaldp 2002/11/10 04:46:35 Modified: fortress/src/test/org/apache/excalibur/fortress/test HandlersTestCase.java Log: prep for real poolable tests Revision Changes Path 1.3 +25 -13 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- HandlersTestCase.java 10 Nov 2002 12:42:44 -0000 1.2 +++ HandlersTestCase.java 10 Nov 2002 12:46:35 -0000 1.3 @@ -18,7 +18,9 @@ import org.apache.excalibur.fortress.test.data.Role1; import org.apache.excalibur.fortress.test.data.Role3; import org.apache.excalibur.fortress.test.data.Role4; +import org.apache.excalibur.fortress.test.data.Role2; import org.apache.excalibur.fortress.util.ContextBuilder; +import java.util.ArrayList; /** * A testcase for the different handlers. @@ -67,12 +69,7 @@ thread.start(); thread.join(); - if( null != m_exception ) - { - final Exception exception = m_exception; - m_exception = null; - throw exception; - } + checkException(); } public void testPerThread() @@ -109,12 +106,7 @@ thread.start(); thread.join(); - if( null != m_exception ) - { - final Exception exception = m_exception; - m_exception = null; - throw exception; - } + checkException(); } public void testFactory() @@ -151,12 +143,32 @@ thread.start(); thread.join(); + checkException(); + } + + private void checkException() throws Exception + { if( null != m_exception ) { final Exception exception = m_exception; m_exception = null; throw exception; } + } + + public void testPoolable() + throws Exception + { + final ServiceManager serviceManager = getServiceManager(); + final String key = Role2.ROLE; + final BaseRole object1 = (BaseRole)serviceManager.lookup( key ); + final BaseRole object2 = (BaseRole)serviceManager.lookup( key ); + final BaseRole object3 = (BaseRole)serviceManager.lookup( key ); + + + serviceManager.release( object1 ); + serviceManager.release( object2 ); + serviceManager.release( object3 ); } private ServiceManager getServiceManager() throws Exception
-- To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>