Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestAbstractInvocationHandler.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestAbstractInvocationHandler.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestAbstractInvocationHandler.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestAbstractInvocationHandler.java Thu Oct 13 06:26:06 2005 @@ -25,17 +25,17 @@ public void testCreateProxy() throws Exception { final TestingInvocationHandler handler = new TestingInvocationHandler(); - Echo echo = ( Echo )handler.createProxy( Echo.class ); + Echo echo = ( Echo )handler.createProxy( new Class[] { Echo.class } ); echo.echo(); - assertEquals( Echo.class.getMethod( "echo" ), handler.method ); + assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), handler.method ); assertNull( handler.arguments ); echo.echoBack( "hello" ); - assertEquals( Echo.class.getMethod( "echoBack", String.class ), handler.method ); + assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), handler.method ); assertNotNull( handler.arguments ); assertEquals( 1, handler.arguments.length ); assertEquals( "hello", handler.arguments[0] ); echo.echoBack( "hello", "world" ); - assertEquals( Echo.class.getMethod( "echoBack", String.class, String.class ), handler.method ); + assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class, String.class } ), handler.method ); assertNotNull( handler.arguments ); assertEquals( 2, handler.arguments.length ); assertEquals( "hello", handler.arguments[0] );
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/util/TestMethodSignature.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/util/TestMethodSignature.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/util/TestMethodSignature.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/util/TestMethodSignature.java Thu Oct 13 06:26:06 2005 @@ -24,12 +24,12 @@ { public void testEquals() throws Exception { - final MethodSignature sig = new MethodSignature( Echo.class.getMethod( "echoBack", String.class ) ); + final MethodSignature sig = new MethodSignature( Echo.class.getMethod( "echoBack", new Class[] { String.class } ) ); assertTrue( sig.equals( sig ) ); assertFalse( sig.equals( "echoBack" ) ); - assertEquals( sig, new MethodSignature( Echo.class.getMethod( "echoBack", String.class ) ) ); - assertEquals( sig, new MethodSignature( DuplicateEcho.class.getMethod( "echoBack", String.class ) ) ); - assertFalse( sig.equals( new MethodSignature( Echo.class.getMethod( "echoBack", String.class, String.class ) ) ) ); - assertFalse( sig.equals( new MethodSignature( Echo.class.getMethod( "echo" ) ) ) ); + assertEquals( sig, new MethodSignature( Echo.class.getMethod( "echoBack", new Class[] { String.class } ) ) ); + assertEquals( sig, new MethodSignature( DuplicateEcho.class.getMethod( "echoBack", new Class[] { String.class } ) ) ); + assertFalse( sig.equals( new MethodSignature( Echo.class.getMethod( "echoBack", new Class[] { String.class, String.class } ) ) ) ); + assertFalse( sig.equals( new MethodSignature( Echo.class.getMethod( "echo", new Class[] {} ) ) ) ); } } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestNullInvocationHandler.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestNullInvocationHandler.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestNullInvocationHandler.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestNullInvocationHandler.java Thu Oct 13 06:26:06 2005 @@ -23,14 +23,14 @@ { public void testReturnValues() { - final Tester tester = ( Tester )ProxyUtils.createNullObject( new CglibProxyFactory(), Tester.class ); + final Tester tester = ( Tester )ProxyUtils.createNullObject( new CglibProxyFactory(), new Class[] { Tester.class } ); assertEquals( 0, tester.intMethod() ); assertEquals( 0L, tester.longMethod() ); assertEquals( ( short )0, tester.shortMethod() ); assertEquals( ( byte )0, tester.byteMethod() ); assertEquals( ( char )0, tester.charMethod() ); - assertEquals( 0.0f, tester.floatMethod() ); - assertEquals( 0.0, tester.doubleMethod() ); + assertEquals( 0.0f, tester.floatMethod(), 0.0f ); + assertEquals( 0.0, tester.doubleMethod(), 0.0f ); assertFalse( tester.booleanMethod() ); assertNull( tester.stringMethod() ); } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestExecutorMethodInterceptor.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestExecutorMethodInterceptor.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestExecutorMethodInterceptor.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestExecutorMethodInterceptor.java Thu Oct 13 06:26:06 2005 @@ -20,9 +20,8 @@ import org.apache.commons.proxy.factory.cglib.CglibProxyFactory; import org.apache.commons.proxy.util.Echo; import org.apache.commons.proxy.util.EchoImpl; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executor; +import EDU.oswego.cs.dl.util.concurrent.Executor; +import EDU.oswego.cs.dl.util.concurrent.CountDown; public class TestExecutorMethodInterceptor extends TestCase { @@ -31,9 +30,9 @@ final ExecutedEcho impl = new ExecutedEcho(); final OneShotExecutor executor = new OneShotExecutor(); final Echo proxy = ( Echo ) new CglibProxyFactory() - .createInterceptorProxy( impl, new ExecutorMethodInterceptor( executor ), Echo.class ); + .createInterceptorProxy( impl, new ExecutorMethodInterceptor( executor ), new Class[] { Echo.class } ); proxy.echo(); - executor.getLatch().await(); + executor.getLatch().acquire(); assertEquals( executor.getThread(), impl.getExecutionThread() ); } @@ -42,7 +41,7 @@ final ExecutedEcho impl = new ExecutedEcho(); final OneShotExecutor executor = new OneShotExecutor(); final Echo proxy = ( Echo ) new CglibProxyFactory() - .createInterceptorProxy( impl, new ExecutorMethodInterceptor( executor ), Echo.class ); + .createInterceptorProxy( impl, new ExecutorMethodInterceptor( executor ), new Class[] { Echo.class } ); try { proxy.echoBack( "hello" ); @@ -71,7 +70,7 @@ private static class OneShotExecutor implements Executor { private Thread thread; - private CountDownLatch latch = new CountDownLatch( 1 ); + private CountDown latch = new CountDown( 1 ); public void execute( final Runnable command ) { @@ -85,7 +84,7 @@ } finally { - latch.countDown(); + latch.release(); } } } ); @@ -97,7 +96,7 @@ return thread; } - public CountDownLatch getLatch() + public CountDown getLatch() { return latch; } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java Thu Oct 13 06:26:06 2005 @@ -20,6 +20,7 @@ import org.apache.commons.proxy.util.SuffixMethodInterceptor; import org.apache.commons.proxy.factory.cglib.CglibProxyFactory; import org.apache.commons.proxy.interceptor.filter.SimpleMethodFilter; +import org.aopalliance.intercept.MethodInterceptor; import junit.framework.TestCase; /** @@ -30,13 +31,13 @@ { public void testFilterAccepts() { - Echo echo = ( Echo ) new MethodInterceptorChain( new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter( "echoBack" ) ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject(); + Echo echo = ( Echo ) new MethodInterceptorChain( new MethodInterceptor[] { new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter( new String[] { "echoBack" } ) ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject(); assertEquals( "messagea", echo.echoBack( "message" ) ); } public void testFilterDenies() { - Echo echo = ( Echo ) new MethodInterceptorChain( new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter() ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject(); + Echo echo = ( Echo ) new MethodInterceptorChain( new MethodInterceptor[] { new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter() ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject(); assertEquals( "message", echo.echoBack( "message" ) ); } } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java Thu Oct 13 06:26:06 2005 @@ -20,6 +20,7 @@ import org.apache.commons.proxy.util.Echo; import org.apache.commons.proxy.util.SuffixMethodInterceptor; import org.apache.commons.proxy.util.EchoImpl; +import org.aopalliance.intercept.MethodInterceptor; /** * @author James Carman @@ -29,13 +30,13 @@ { public void testWithSingleInterceptor() { - Echo echo = ( Echo ) new MethodInterceptorChain( new SuffixMethodInterceptor( "a" ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), Echo.class ).getObject(); + Echo echo = ( Echo ) new MethodInterceptorChain( new MethodInterceptor[] { new SuffixMethodInterceptor( "a" ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), new Class[] { Echo.class } ).getObject(); assertEquals( "messagea", echo.echoBack( "message" ) ); } public void testWithMultipleInterceptors() { - Echo echo = ( Echo ) new MethodInterceptorChain( new SuffixMethodInterceptor( "a" ), new SuffixMethodInterceptor( "b" ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), Echo.class ).getObject(); + Echo echo = ( Echo ) new MethodInterceptorChain( new MethodInterceptor[] { new SuffixMethodInterceptor( "a" ), new SuffixMethodInterceptor( "b" ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), new Class[] { Echo.class } ).getObject(); assertEquals( "messageba", echo.echoBack( "message" ) ); } } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestPatternMethodFilter.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestPatternMethodFilter.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestPatternMethodFilter.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestPatternMethodFilter.java Thu Oct 13 06:26:06 2005 @@ -28,12 +28,12 @@ public void testAccepts() throws Exception { final PatternMethodFilter filter = new PatternMethodFilter( "set\\w+|get\\w+" ); - assertTrue( filter.accepts( Date.class.getMethod( "getSeconds" ) ) ); - assertTrue( filter.accepts( Date.class.getMethod( "getMinutes" ) ) ); - assertTrue( filter.accepts( Date.class.getMethod( "setSeconds", Integer.TYPE ) ) ); - assertTrue( filter.accepts( Date.class.getMethod( "setMinutes", Integer.TYPE ) ) ); - assertFalse( filter.accepts( Date.class.getMethod( "toString" ) ) ); - assertFalse( filter.accepts( Date.class.getMethod( "hashCode" ) ) ); + assertTrue( filter.accepts( Date.class.getMethod( "getSeconds", new Class[] {} ) ) ); + assertTrue( filter.accepts( Date.class.getMethod( "getMinutes", new Class[] {} ) ) ); + assertTrue( filter.accepts( Date.class.getMethod( "setSeconds", new Class[] { Integer.TYPE } ) ) ); + assertTrue( filter.accepts( Date.class.getMethod( "setMinutes", new Class[] { Integer.TYPE } ) ) ); + assertFalse( filter.accepts( Date.class.getMethod( "toString", new Class[] {} ) ) ); + assertFalse( filter.accepts( Date.class.getMethod( "hashCode", new Class[] {} ) ) ); } } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java Thu Oct 13 06:26:06 2005 @@ -15,17 +15,16 @@ * limitations under the License. */ package org.apache.commons.proxy.interceptor.filter; -import junit.framework.*; -import org.apache.commons.proxy.interceptor.filter.ReturnTypeFilter; +import junit.framework.TestCase; public class TestReturnTypeFilter extends TestCase { public void testAcceptsMethod() throws Exception { - final ReturnTypeFilter filter = new ReturnTypeFilter( String.class, Integer.TYPE ); - assertTrue( filter.accepts( Object.class.getMethod( "toString" ) ) ); - assertTrue( filter.accepts( Object.class.getMethod( "hashCode" ) ) ); - assertFalse( filter.accepts( Object.class.getMethod( "equals", Object.class ) ) ); + final ReturnTypeFilter filter = new ReturnTypeFilter( new Class[] { String.class, Integer.TYPE } ); + assertTrue( filter.accepts( Object.class.getMethod( "toString", new Class[] {} ) ) ); + assertTrue( filter.accepts( Object.class.getMethod( "hashCode", new Class[] {} ) ) ); + assertFalse( filter.accepts( Object.class.getMethod( "equals", new Class[] { Object.class } ) ) ); } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestSimpleMethodFilter.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestSimpleMethodFilter.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestSimpleMethodFilter.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/filter/TestSimpleMethodFilter.java Thu Oct 13 06:26:06 2005 @@ -27,9 +27,9 @@ { public void testAccepts() throws Exception { - final SimpleMethodFilter filter = new SimpleMethodFilter( "echoBack" ); - assertTrue( filter.accepts( Echo.class.getMethod( "echoBack", String.class ) ) ); - assertFalse( filter.accepts( EchoImpl.class.getMethod( "hashCode" ) ) ); + final SimpleMethodFilter filter = new SimpleMethodFilter( new String[] { "echoBack" } ); + assertTrue( filter.accepts( Echo.class.getMethod( "echoBack", new Class[] { String.class } ) ) ); + assertFalse( filter.accepts( EchoImpl.class.getMethod( "hashCode", new Class[] {} ) ) ); } } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java Thu Oct 13 06:26:06 2005 @@ -20,8 +20,7 @@ import org.apache.commons.proxy.provider.cache.ThreadLocalCache; import org.apache.commons.proxy.util.Echo; import org.apache.commons.proxy.util.EchoImpl; - -import java.util.concurrent.CountDownLatch; +import EDU.oswego.cs.dl.util.concurrent.CountDown; public class TestCachedProvider extends TestCase { @@ -43,7 +42,7 @@ final CachedProvider provider = new CachedProvider( counter ); final ThreadLocalCache cache = new ThreadLocalCache(); provider.setCache( cache ); - final CountDownLatch latch = new CountDownLatch( 10 ); + final CountDown latch = new CountDown( 10 ); for( int i = 0; i < 10; ++i ) { new Thread( new Runnable() @@ -52,11 +51,11 @@ { ( ( Echo )provider.getObject() ).echoBack( "Hello, World" ); cache.clearCache(); - latch.countDown(); + latch.release(); } }).start(); } - latch.await(); + latch.acquire(); assertEquals( 10, counter.getCount() ); } } Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java?rev=320764&r1=320763&r2=320764&view=diff ============================================================================== --- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java (original) +++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java Thu Oct 13 06:26:06 2005 @@ -15,6 +15,7 @@ */ package org.apache.commons.proxy.provider; +import EDU.oswego.cs.dl.util.concurrent.CountDown; import junit.framework.TestCase; import org.apache.commons.pool.impl.GenericObjectPool; import org.apache.commons.proxy.provider.cache.SimpleCache; @@ -22,14 +23,11 @@ import org.apache.commons.proxy.util.Echo; import org.apache.commons.proxy.util.EchoImpl; -import java.util.concurrent.CountDownLatch; -import static org.apache.commons.proxy.provider.ProviderUtils.constantProvider; - public class TestPooledProvider extends TestCase { public void testWithSimpleCache() { - final CountingProvider counter = new CountingProvider( constantProvider( new EchoImpl() ) ); + final CountingProvider counter = new CountingProvider( ProviderUtils.constantProvider( new EchoImpl() ) ); final PooledProvider provider = new PooledProvider( counter ); final SimpleCache cache = new SimpleCache(); provider.setCache( cache ); @@ -44,7 +42,7 @@ public void testWithThreadLocalCache() throws Exception { - final CountingProvider counter = new CountingProvider( constantProvider( new EchoImpl() ) ); + final CountingProvider counter = new CountingProvider( ProviderUtils.constantProvider( new EchoImpl() ) ); final PooledProvider provider = new PooledProvider( counter ); provider.setMaxActive( 10 ); provider.setMinIdle( 5 ); @@ -56,9 +54,9 @@ provider.setTestWhileIdle( false ); final ThreadLocalCache cache = new ThreadLocalCache(); provider.setCache( cache ); - final CountDownLatch goLatch = new CountDownLatch( 1 ); - final CountDownLatch borrowedLatch = new CountDownLatch( 10 ); - final CountDownLatch finished = new CountDownLatch( 10 ); + final CountDown goLatch = new CountDown( 1 ); + final CountDown borrowedLatch = new CountDown( 10 ); + final CountDown finished = new CountDown( 10 ); for( int i = 0; i < 10; ++i ) { new Thread( new Runnable() @@ -68,15 +66,15 @@ try { ( ( Echo )provider.getObject() ).echoBack( "Hello, World" ); - borrowedLatch.countDown(); - goLatch.await(); + borrowedLatch.release(); + goLatch.acquire(); for( int i = 0; i < 10; ++i ) { ( ( Echo )provider.getObject() ).echoBack( "Hello, World" ); } cache.clearCache(); - finished.countDown(); + finished.release(); } catch( InterruptedException e ) { @@ -84,9 +82,9 @@ } } ).start(); } - borrowedLatch.await(); - goLatch.countDown(); - finished.await(); + borrowedLatch.acquire(); + goLatch.release(); + finished.acquire(); assertEquals( 10, counter.getCount() ); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]