commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r631654 [4/4] - in /commons/proper/proxy/trunk: ./ src/main/java/org/apache/commons/proxy/ src/main/java/org/apache/commons/proxy/exception/ src/main/java/org/apache/commons/proxy/factory/cglib/ src/main/java/org/apache/commons/proxy/factor...
Date Wed, 27 Feb 2008 17:14:48 GMT
Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestExecutorInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestExecutorInterceptor.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestExecutorInterceptor.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestExecutorInterceptor.java Wed Feb 27 09:14:32 2008
@@ -17,35 +17,28 @@
 
 package org.apache.commons.proxy.interceptor;
 
+import EDU.oswego.cs.dl.util.concurrent.CountDown;
+import EDU.oswego.cs.dl.util.concurrent.Executor;
 import junit.framework.TestCase;
 import org.apache.commons.proxy.factory.cglib.CglibProxyFactory;
 import org.apache.commons.proxy.util.Echo;
 import org.apache.commons.proxy.util.EchoImpl;
-import EDU.oswego.cs.dl.util.concurrent.Executor;
-import EDU.oswego.cs.dl.util.concurrent.CountDown;
 
 public class TestExecutorInterceptor extends TestCase
 {
-    public void testVoidMethod() throws Exception
-    {
-        final ExecutedEcho impl = new ExecutedEcho();
-        final OneShotExecutor executor = new OneShotExecutor();
-        final Echo proxy = ( Echo ) new CglibProxyFactory()
-                .createInterceptorProxy( impl, new ExecutorInterceptor( executor ), new Class[] { Echo.class } );
-        proxy.echo();
-        executor.getLatch().acquire();
-        assertEquals( executor.getThread(), impl.getExecutionThread() );
-    }
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
 
     public void testNonVoidMethod() throws Exception
     {
         final ExecutedEcho impl = new ExecutedEcho();
         final OneShotExecutor executor = new OneShotExecutor();
         final Echo proxy = ( Echo ) new CglibProxyFactory()
-                .createInterceptorProxy( impl, new ExecutorInterceptor( executor ), new Class[] { Echo.class } );
+                .createInterceptorProxy(impl, new ExecutorInterceptor(executor), new Class[] {Echo.class});
         try
         {
-            proxy.echoBack( "hello" );
+            proxy.echoBack("hello");
             fail();
         }
         catch( IllegalArgumentException e )
@@ -53,6 +46,21 @@
         }
     }
 
+    public void testVoidMethod() throws Exception
+    {
+        final ExecutedEcho impl = new ExecutedEcho();
+        final OneShotExecutor executor = new OneShotExecutor();
+        final Echo proxy = ( Echo ) new CglibProxyFactory()
+                .createInterceptorProxy(impl, new ExecutorInterceptor(executor), new Class[] {Echo.class});
+        proxy.echo();
+        executor.getLatch().acquire();
+        assertEquals(executor.getThread(), impl.getExecutionThread());
+    }
+
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
+
     public static class ExecutedEcho extends EchoImpl
     {
         private Thread executionThread;
@@ -71,11 +79,11 @@
     private static class OneShotExecutor implements Executor
     {
         private Thread thread;
-        private CountDown latch = new CountDown( 1 );
+        private CountDown latch = new CountDown(1);
 
         public void execute( final Runnable command )
         {
-            thread = new Thread( new Runnable()
+            thread = new Thread(new Runnable()
             {
                 public void run()
                 {
@@ -88,7 +96,7 @@
                         latch.release();
                     }
                 }
-            } );
+            });
             thread.start();
         }
 

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestFilteredInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestFilteredInterceptor.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestFilteredInterceptor.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestFilteredInterceptor.java Wed Feb 27 09:14:32 2008
@@ -17,13 +17,13 @@
 
 package org.apache.commons.proxy.interceptor;
 
+import junit.framework.TestCase;
+import org.apache.commons.proxy.Interceptor;
+import org.apache.commons.proxy.factory.cglib.CglibProxyFactory;
+import org.apache.commons.proxy.interceptor.filter.SimpleFilter;
 import org.apache.commons.proxy.util.Echo;
 import org.apache.commons.proxy.util.EchoImpl;
 import org.apache.commons.proxy.util.SuffixInterceptor;
-import org.apache.commons.proxy.factory.cglib.CglibProxyFactory;
-import org.apache.commons.proxy.interceptor.filter.SimpleFilter;
-import org.apache.commons.proxy.Interceptor;
-import junit.framework.TestCase;
 
 /**
  * @author James Carman
@@ -31,15 +31,19 @@
  */
 public class TestFilteredInterceptor extends TestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testFilterAccepts()
     {
-        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new FilteredInterceptor( new SuffixInterceptor( "a" ), new SimpleFilter( new String[] { "echoBack" } ) ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject();
-        assertEquals( "messagea", echo.echoBack( "message" ) );
+        Echo echo = ( Echo ) new InterceptorChain(new Interceptor[] {new FilteredInterceptor(new SuffixInterceptor("a"), new SimpleFilter(new String[] {"echoBack"}))}).createProxyProvider(new CglibProxyFactory(), new EchoImpl()).getObject();
+        assertEquals("messagea", echo.echoBack("message"));
     }
 
     public void testFilterDenies()
     {
-        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new FilteredInterceptor( new SuffixInterceptor( "a" ), new SimpleFilter() ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject();
-        assertEquals( "message", echo.echoBack( "message" ) );
+        Echo echo = ( Echo ) new InterceptorChain(new Interceptor[] {new FilteredInterceptor(new SuffixInterceptor("a"), new SimpleFilter())}).createProxyProvider(new CglibProxyFactory(), new EchoImpl()).getObject();
+        assertEquals("message", echo.echoBack("message"));
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestInterceptorChain.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestInterceptorChain.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestInterceptorChain.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestInterceptorChain.java Wed Feb 27 09:14:32 2008
@@ -30,16 +30,20 @@
  */
 public class TestInterceptorChain extends TestCase
 {
-    public void testWithSingleInterceptor()
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    public void testWithMultipleInterceptors()
     {
-        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new SuffixInterceptor( "a" ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(),  new Class[] { Echo.class } ).getObject();
-        assertEquals( "messagea", echo.echoBack( "message" ) );
+        Echo echo = ( Echo ) new InterceptorChain(new Interceptor[] {new SuffixInterceptor("a"), new SuffixInterceptor("b")}).createProxyProvider(new CglibProxyFactory(), new EchoImpl(), new Class[] {Echo.class}).getObject();
+        assertEquals("messageba", echo.echoBack("message"));
     }
 
-    public void testWithMultipleInterceptors()
+    public void testWithSingleInterceptor()
     {
-        Echo echo = ( Echo ) new InterceptorChain( new Interceptor[] { new SuffixInterceptor( "a" ), new SuffixInterceptor( "b" ) } ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(),  new Class[] { Echo.class } ).getObject();
-        assertEquals( "messageba", echo.echoBack( "message" ) );
+        Echo echo = ( Echo ) new InterceptorChain(new Interceptor[] {new SuffixInterceptor("a")}).createProxyProvider(new CglibProxyFactory(), new EchoImpl(), new Class[] {Echo.class}).getObject();
+        assertEquals("messagea", echo.echoBack("message"));
     }
 }
 

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestLoggingInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestLoggingInterceptor.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestLoggingInterceptor.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestLoggingInterceptor.java Wed Feb 27 09:14:32 2008
@@ -28,81 +28,69 @@
 
 public class TestLoggingInterceptor extends MockObjectTestCase
 {
+//**********************************************************************************************************************
+// Fields
+//**********************************************************************************************************************
+
     private Mock logMock;
     private Echo echo;
 
-    protected void setUp() throws Exception
-    {
-        logMock = mock( Log.class );
-        echo = ( Echo ) new CglibProxyFactory()
-                .createInterceptorProxy( new EchoImpl(), new LoggingInterceptor( ( Log ) logMock.proxy() ),
-                                         new Class[]{ Echo.class } );
-    }
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
 
-    public void testWhenLoggingDisabled()
+    protected void setUp() throws Exception
     {
-        logMock = mock( Log.class );
+        logMock = mock(Log.class);
         echo = ( Echo ) new CglibProxyFactory()
-                .createInterceptorProxy( new EchoImpl(), new LoggingInterceptor( ( Log ) logMock.proxy() ),
-                                         new Class[]{ Echo.class } );
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( false ) );
-        echo.echoBack( "Hello" );
-
+                .createInterceptorProxy(new EchoImpl(), new LoggingInterceptor(( Log ) logMock.proxy()),
+                        new Class[] {Echo.class});
     }
 
-    public void testWithArrayParameter()
+    public void testException()
     {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN echoBack((java.lang.String[]){Hello, World})" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "END echoBack() [HelloWorld]" ) );
-        echo.echoBack( new String[] { "Hello", "World" } );
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN ioException()"));
+        logMock.expects(once()).method("debug").with(eq("EXCEPTION ioException() -- java.io.IOException"), isA(IOException.class));
+        try
+        {
+            echo.ioException();
+            fail();
+        }
+        catch( IOException e )
+        {
+        }
     }
 
     public void testMultipleParameters()
     {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN echoBack(Hello, World)" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "END echoBack() [HelloWorld]" ) );
-        echo.echoBack( "Hello", "World" );
-    }
-
-    public void testNullReturnValue()
-    {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN echoBack(<null>)" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "END echoBack() [<null>]" ) );
-        echo.echoBack( ( String )null );
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN echoBack(Hello, World)"));
+        logMock.expects(once()).method("debug").with(eq("END echoBack() [HelloWorld]"));
+        echo.echoBack("Hello", "World");
     }
 
     public void testNonVoidMethod()
     {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN echoBack(Hello)" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "END echoBack() [Hello]" ) );
-        echo.echoBack( "Hello" );
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN echoBack(Hello)"));
+        logMock.expects(once()).method("debug").with(eq("END echoBack() [Hello]"));
+        echo.echoBack("Hello");
     }
 
-    public void testException()
+    public void testNullReturnValue()
     {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN ioException()" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "EXCEPTION ioException() -- java.io.IOException" ), isA( IOException.class ) );
-        try
-        {
-            echo.ioException();
-            fail();
-        }
-        catch( IOException e )
-        {
-
-        }
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN echoBack(<null>)"));
+        logMock.expects(once()).method("debug").with(eq("END echoBack() [<null>]"));
+        echo.echoBack(( String ) null);
     }
 
     public void testRuntimeException()
     {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN illegalArgument()" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "EXCEPTION illegalArgument() -- java.lang.IllegalArgumentException" ), isA( IllegalArgumentException.class ) );
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN illegalArgument()"));
+        logMock.expects(once()).method("debug").with(eq("EXCEPTION illegalArgument() -- java.lang.IllegalArgumentException"), isA(IllegalArgumentException.class));
         try
         {
             echo.illegalArgument();
@@ -110,16 +98,32 @@
         }
         catch( IllegalArgumentException e )
         {
-
         }
     }
 
     public void testVoidMethod()
     {
-        logMock.expects( once() ).method( "isDebugEnabled" ).will( returnValue( true ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "BEGIN echo()" ) );
-        logMock.expects( once() ).method( "debug" ).with( eq( "END echo()" ) );
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN echo()"));
+        logMock.expects(once()).method("debug").with(eq("END echo()"));
         echo.echo();
     }
 
+    public void testWhenLoggingDisabled()
+    {
+        logMock = mock(Log.class);
+        echo = ( Echo ) new CglibProxyFactory()
+                .createInterceptorProxy(new EchoImpl(), new LoggingInterceptor(( Log ) logMock.proxy()),
+                        new Class[] {Echo.class});
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(false));
+        echo.echoBack("Hello");
+    }
+
+    public void testWithArrayParameter()
+    {
+        logMock.expects(once()).method("isDebugEnabled").will(returnValue(true));
+        logMock.expects(once()).method("debug").with(eq("BEGIN echoBack((java.lang.String[]){Hello, World})"));
+        logMock.expects(once()).method("debug").with(eq("END echoBack() [HelloWorld]"));
+        echo.echoBack(new String[] {"Hello", "World"});
+    }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestMethodInterceptorAdapter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestMethodInterceptorAdapter.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestMethodInterceptorAdapter.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestMethodInterceptorAdapter.java Wed Feb 27 09:14:32 2008
@@ -20,47 +20,55 @@
 import junit.framework.TestCase;
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
-import org.apache.commons.proxy.ProxyUtils;
 import org.apache.commons.proxy.factory.javassist.JavassistProxyFactory;
 import org.apache.commons.proxy.util.Echo;
 import org.apache.commons.proxy.util.EchoImpl;
 
 public class TestMethodInterceptorAdapter extends TestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testMethodInterception()
     {
-        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy( new EchoImpl(),
-                                                                                         new MethodInterceptorAdapter( new SuffixMethodInterceptor(
-                                                                                                 " suffix" ) ),
-                                                                                         new Class[]{ Echo.class } );
-        assertEquals( "message suffix", proxy.echoBack( "message" ) );
+        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy(new EchoImpl(),
+                new MethodInterceptorAdapter(new SuffixMethodInterceptor(
+                        " suffix")),
+                new Class[] {Echo.class});
+        assertEquals("message suffix", proxy.echoBack("message"));
     }
 
     public void testMethodInvocationImplementation() throws Exception
     {
         final InterceptorTester tester = new InterceptorTester();
         final EchoImpl target = new EchoImpl();
-        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy( target, new MethodInterceptorAdapter( tester ), new Class[] { Echo.class } );
+        final Echo proxy = ( Echo ) new JavassistProxyFactory().createInterceptorProxy(target, new MethodInterceptorAdapter(tester), new Class[] {Echo.class});
         proxy.echo();
-        assertNotNull( tester.invocation.getArguments() );
-        assertEquals( 0, tester.invocation.getArguments().length );
-        assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), tester.invocation.getMethod() );
-        assertEquals( Echo.class.getMethod( "echo", new Class[] {} ), tester.invocation.getStaticPart() );
-        assertEquals( target, tester.invocation.getThis() );
-        proxy.echoBack( "Hello" );
-        assertNotNull( tester.invocation.getArguments() );
-        assertEquals( 1, tester.invocation.getArguments().length );
-        assertEquals( "Hello", tester.invocation.getArguments()[0] );
-        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.invocation.getMethod() );
-        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.invocation.getStaticPart() );
-        proxy.echoBack( "Hello", "World" );
-        assertNotNull( tester.invocation.getArguments() );
-        assertEquals( 2, tester.invocation.getArguments().length );
-        assertEquals( "Hello", tester.invocation.getArguments()[0] );
-        assertEquals( "World", tester.invocation.getArguments()[1] );
-        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class, String.class } ), tester.invocation.getMethod() );
-        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class, String.class } ), tester.invocation.getStaticPart() );
+        assertNotNull(tester.invocation.getArguments());
+        assertEquals(0, tester.invocation.getArguments().length);
+        assertEquals(Echo.class.getMethod("echo", new Class[] {}), tester.invocation.getMethod());
+        assertEquals(Echo.class.getMethod("echo", new Class[] {}), tester.invocation.getStaticPart());
+        assertEquals(target, tester.invocation.getThis());
+        proxy.echoBack("Hello");
+        assertNotNull(tester.invocation.getArguments());
+        assertEquals(1, tester.invocation.getArguments().length);
+        assertEquals("Hello", tester.invocation.getArguments()[0]);
+        assertEquals(Echo.class.getMethod("echoBack", new Class[] {String.class}), tester.invocation.getMethod());
+        assertEquals(Echo.class.getMethod("echoBack", new Class[] {String.class}), tester.invocation.getStaticPart());
+        proxy.echoBack("Hello", "World");
+        assertNotNull(tester.invocation.getArguments());
+        assertEquals(2, tester.invocation.getArguments().length);
+        assertEquals("Hello", tester.invocation.getArguments()[0]);
+        assertEquals("World", tester.invocation.getArguments()[1]);
+        assertEquals(Echo.class.getMethod("echoBack", new Class[] {String.class, String.class}), tester.invocation.getMethod());
+        assertEquals(Echo.class.getMethod("echoBack", new Class[] {String.class, String.class}), tester.invocation.getStaticPart());
     }
+
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
+
     private static class InterceptorTester implements MethodInterceptor
     {
         private MethodInvocation invocation;
@@ -71,6 +79,7 @@
             return methodInvocation.proceed();
         }
     }
+
     private class SuffixMethodInterceptor implements MethodInterceptor
     {
         private final String suffix;

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestSerializingInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestSerializingInterceptor.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestSerializingInterceptor.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/TestSerializingInterceptor.java Wed Feb 27 09:14:32 2008
@@ -17,25 +17,20 @@
 
 package org.apache.commons.proxy.interceptor;
 
-import junit.framework.TestCase;
 import org.apache.commons.proxy.ProxyFactory;
+import org.apache.commons.proxy.util.AbstractTestCase;
 
 import java.io.ByteArrayOutputStream;
 
-public class TestSerializingInterceptor extends TestCase
+public class TestSerializingInterceptor extends AbstractTestCase
 {
-    public void testWithSerializableParametersAndReturn()
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    public void testSerialization()
     {
-        final ObjectEchoImpl target = new ObjectEchoImpl();
-        ObjectEcho echo =
-                (ObjectEcho) new ProxyFactory().createInterceptorProxy(target,
-                        new SerializingInterceptor(),
-                        new Class[]{ObjectEcho.class});
-        final Object originalParameter = "Hello, World!";
-        final Object returnValue = echo.echoBack(originalParameter);
-        assertNotSame(originalParameter, target.parameter);
-        assertNotSame(originalParameter, returnValue);
-        assertNotSame(returnValue, target.parameter);
+        assertSerializable(new SerializingInterceptor());
     }
 
     public void testWithInvalidParameterType()
@@ -44,30 +39,46 @@
         {
             final ObjectEchoImpl target = new ObjectEchoImpl();
             ObjectEcho echo =
-                    (ObjectEcho) new ProxyFactory().createInterceptorProxy(target,
+                    ( ObjectEcho ) new ProxyFactory().createInterceptorProxy(target,
                             new SerializingInterceptor(),
-                            new Class[]{ObjectEcho.class});
+                            new Class[] {ObjectEcho.class});
             final Object originalParameter = new ByteArrayOutputStream();
             echo.echoBack(originalParameter);
             fail("Should not be able to call method with non-serializable parameter type.");
         }
-        catch (RuntimeException e)
+        catch( RuntimeException e )
         {
-
         }
+    }
 
+    public void testWithSerializableParametersAndReturn()
+    {
+        final ObjectEchoImpl target = new ObjectEchoImpl();
+        ObjectEcho echo =
+                ( ObjectEcho ) new ProxyFactory().createInterceptorProxy(target,
+                        new SerializingInterceptor(),
+                        new Class[] {ObjectEcho.class});
+        final Object originalParameter = "Hello, World!";
+        final Object returnValue = echo.echoBack(originalParameter);
+        assertNotSame(originalParameter, target.parameter);
+        assertNotSame(originalParameter, returnValue);
+        assertNotSame(returnValue, target.parameter);
     }
 
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
+
     public static interface ObjectEcho
     {
-        public Object echoBack(Object object);
+        public Object echoBack( Object object );
     }
 
     public static class ObjectEchoImpl implements ObjectEcho
     {
         private Object parameter;
 
-        public Object echoBack(Object object)
+        public Object echoBack( Object object )
         {
             this.parameter = object;
             return object;

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestPatternFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestPatternFilter.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestPatternFilter.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestPatternFilter.java Wed Feb 27 09:14:32 2008
@@ -18,27 +18,28 @@
 package org.apache.commons.proxy.interceptor.filter;
 
 import junit.framework.TestCase;
+import org.apache.commons.proxy.interceptor.MethodFilter;
 
 import java.util.Date;
 
-import org.apache.commons.proxy.interceptor.MethodFilter;
-
 /**
  * @author James Carman
  * @since 1.0
  */
 public class TestPatternFilter extends TestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testAccepts() throws Exception
     {
         final MethodFilter filter = PatternFilter.getterSetterFilter();
-        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[] {} ) ) );
+        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: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestReturnTypeFilter.java Wed Feb 27 09:14:32 2008
@@ -16,17 +16,20 @@
  */
 
 package org.apache.commons.proxy.interceptor.filter;
+
 import junit.framework.TestCase;
 
 public class TestReturnTypeFilter extends TestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testAcceptsMethod() throws Exception
     {
-        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 } ) ) );
+        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: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestSimpleFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestSimpleFilter.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestSimpleFilter.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/interceptor/filter/TestSimpleFilter.java Wed Feb 27 09:14:32 2008
@@ -27,11 +27,14 @@
  */
 public class TestSimpleFilter extends TestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testAccepts() throws Exception
     {
-        final SimpleFilter filter = new SimpleFilter( new String[] { "echoBack" } );
-        assertTrue( filter.accepts( Echo.class.getMethod( "echoBack", new Class[] { String.class } ) ) );
-        assertFalse( filter.accepts( EchoImpl.class.getMethod( "hashCode",  new Class[] {} ) ) );
+        final SimpleFilter filter = new SimpleFilter(new String[] {"echoBack"});
+        assertTrue(filter.accepts(Echo.class.getMethod("echoBack", new Class[] {String.class})));
+        assertFalse(filter.accepts(EchoImpl.class.getMethod("hashCode", new Class[] {})));
     }
-
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestDuckTypingInvoker.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestDuckTypingInvoker.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestDuckTypingInvoker.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestDuckTypingInvoker.java Wed Feb 27 09:14:32 2008
@@ -29,81 +29,90 @@
  */
 public class TestDuckTypingInvoker extends TestCase
 {
-//----------------------------------------------------------------------------------------------------------------------
+//**********************************************************************************************************************
 // Other Methods
-//----------------------------------------------------------------------------------------------------------------------
+//**********************************************************************************************************************
 
     public void testExactSignatureMatch()
     {
-        final ObjectProvider targetProvider = new ConstantProvider( new LegacyDuck() );
-        final DuckTypingInvoker invoker = new DuckTypingInvoker( targetProvider );
-        final Duck duck = ( Duck ) new ProxyFactory().createInvokerProxy( invoker, new Class[]{ Duck.class } );
-        assertEquals( "Quack!", duck.sayQuack() );
+        final ObjectProvider targetProvider = new ConstantProvider(new LegacyDuck());
+        final DuckTypingInvoker invoker = new DuckTypingInvoker(targetProvider);
+        final Duck duck = ( Duck ) new ProxyFactory().createInvokerProxy(invoker, new Class[] {Duck.class});
+        assertEquals("Quack!", duck.sayQuack());
     }
 
-    public void testNoMatchingMethod()
+    public void testMismatchingParameterType()
     {
-        final ObjectProvider targetProvider = new ConstantProvider( new LegacyDuck() );
-        final DuckTypingInvoker invoker = new DuckTypingInvoker( targetProvider );
-        final Goose goose = ( Goose ) new ProxyFactory().createInvokerProxy( invoker, new Class[]{ Goose.class } );
+        final ObjectProvider targetProvider = new ConstantProvider(new LegacyDuck());
+        final DuckTypingInvoker invoker = new DuckTypingInvoker(targetProvider);
+        final ParameterizedDuck parameterizedDuck = ( ParameterizedDuck ) new ProxyFactory()
+                .createInvokerProxy(invoker, new Class[] {ParameterizedDuck.class});
         try
         {
-            goose.sayHonk();
-            fail( "No matching method should be found." );
+            parameterizedDuck.sayQuack("Elmer");
+            fail("No matching method should be found.");
         }
-        catch ( UnsupportedOperationException e )
+        catch( UnsupportedOperationException e )
         {
             // Do nothing, expected behavior!
         }
     }
 
-    public void testMismatchingParameterType()
+    public void testMismatchingReturnType()
     {
-        final ObjectProvider targetProvider = new ConstantProvider( new LegacyDuck() );
-        final DuckTypingInvoker invoker = new DuckTypingInvoker( targetProvider );
-        final ParameterizedDuck parameterizedDuck = ( ParameterizedDuck ) new ProxyFactory()
-                .createInvokerProxy( invoker, new Class[]{ ParameterizedDuck.class } );
+        final ObjectProvider targetProvider = new ConstantProvider(new LegacyDuck());
+        final DuckTypingInvoker invoker = new DuckTypingInvoker(targetProvider);
+        final VoidReturnDuck voidDuck = ( VoidReturnDuck ) new ProxyFactory().createInvokerProxy(invoker, new Class[] {
+                VoidReturnDuck.class});
         try
         {
-            parameterizedDuck.sayQuack("Elmer");
-            fail( "No matching method should be found." );
+            voidDuck.sayQuack();
+            fail("No matching method should be found.");
         }
-        catch ( UnsupportedOperationException e )
+        catch( UnsupportedOperationException e )
         {
             // Do nothing, expected behavior!
         }
     }
 
-    public void testTargetHasCompatibleReturnType()
-    {
-        final ObjectProvider targetProvider = new ConstantProvider( new LegacyDuck() );
-        final DuckTypingInvoker invoker = new DuckTypingInvoker( targetProvider );
-        final SerializableDuck duck = ( SerializableDuck ) new ProxyFactory().createInvokerProxy( invoker, new Class[]{
-                SerializableDuck.class } );
-        assertEquals("Quack!", duck.sayQuack() );
-
-    }
-
-    public void testMismatchingReturnType()
+    public void testNoMatchingMethod()
     {
-        final ObjectProvider targetProvider = new ConstantProvider( new LegacyDuck() );
-        final DuckTypingInvoker invoker = new DuckTypingInvoker( targetProvider );
-        final VoidReturnDuck voidDuck = ( VoidReturnDuck ) new ProxyFactory().createInvokerProxy( invoker, new Class[]{
-                VoidReturnDuck.class } );
+        final ObjectProvider targetProvider = new ConstantProvider(new LegacyDuck());
+        final DuckTypingInvoker invoker = new DuckTypingInvoker(targetProvider);
+        final Goose goose = ( Goose ) new ProxyFactory().createInvokerProxy(invoker, new Class[] {Goose.class});
         try
         {
-            voidDuck.sayQuack();
-            fail( "No matching method should be found." );
+            goose.sayHonk();
+            fail("No matching method should be found.");
         }
-        catch ( UnsupportedOperationException e )
+        catch( UnsupportedOperationException e )
         {
             // Do nothing, expected behavior!
         }
     }
 
-//----------------------------------------------------------------------------------------------------------------------
+    public void testTargetHasCompatibleReturnType()
+    {
+        final ObjectProvider targetProvider = new ConstantProvider(new LegacyDuck());
+        final DuckTypingInvoker invoker = new DuckTypingInvoker(targetProvider);
+        final SerializableDuck duck = ( SerializableDuck ) new ProxyFactory().createInvokerProxy(invoker, new Class[] {
+                SerializableDuck.class});
+        assertEquals("Quack!", duck.sayQuack());
+    }
+
+//**********************************************************************************************************************
 // Inner Classes
-//----------------------------------------------------------------------------------------------------------------------
+//**********************************************************************************************************************
+
+    public interface Duck
+    {
+        public String sayQuack();
+    }
+
+    public interface Goose
+    {
+        public void sayHonk();
+    }
 
     public static class LegacyDuck
     {
@@ -113,28 +122,18 @@
         }
     }
 
-    public interface Duck
+    public interface ParameterizedDuck
     {
-        public String sayQuack();
+        public String sayQuack( String recipient );
     }
 
     public interface SerializableDuck
     {
         public Serializable sayQuack();
     }
-    
-    public interface ParameterizedDuck
-    {
-        public String sayQuack( String recipient );
-    }
 
     public interface VoidReturnDuck
     {
         public void sayQuack();
-    }
-
-    public interface Goose
-    {
-        public void sayHonk();
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestInvocationHandlerAdapter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestInvocationHandlerAdapter.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestInvocationHandlerAdapter.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestInvocationHandlerAdapter.java Wed Feb 27 09:14:32 2008
@@ -16,6 +16,7 @@
  */
 
 package org.apache.commons.proxy.invoker;
+
 import junit.framework.TestCase;
 import org.apache.commons.proxy.factory.javassist.JavassistProxyFactory;
 import org.apache.commons.proxy.util.Echo;
@@ -25,17 +26,25 @@
 
 public class TestInvocationHandlerAdapter extends TestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testMethodInvocation() throws Exception
     {
         InvocationHandlerTester tester = new InvocationHandlerTester();
-        final Echo echo = ( Echo ) new JavassistProxyFactory().createInvokerProxy( new InvocationHandlerAdapter( tester ), new Class[] { Echo.class } );
-        echo.echoBack( "hello" );
-        assertEquals( Echo.class.getMethod( "echoBack", new Class[] { String.class } ), tester.method );
-        assertSame( echo, tester.proxy );
-        assertNotNull( tester.arguments );
-        assertEquals( 1, tester.arguments.length );
-        assertEquals( "hello", tester.arguments[0] );
+        final Echo echo = ( Echo ) new JavassistProxyFactory().createInvokerProxy(new InvocationHandlerAdapter(tester), new Class[] {Echo.class});
+        echo.echoBack("hello");
+        assertEquals(Echo.class.getMethod("echoBack", new Class[] {String.class}), tester.method);
+        assertSame(echo, tester.proxy);
+        assertNotNull(tester.arguments);
+        assertEquals(1, tester.arguments.length);
+        assertEquals("hello", tester.arguments[0]);
     }
+
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
 
     private class InvocationHandlerTester implements InvocationHandler
     {

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestNullInvoker.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestNullInvoker.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestNullInvoker.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestNullInvoker.java Wed Feb 27 09:14:32 2008
@@ -16,36 +16,58 @@
  */
 
 package org.apache.commons.proxy.invoker;
-import junit.framework.TestCase;
+
 import org.apache.commons.proxy.ProxyUtils;
 import org.apache.commons.proxy.factory.cglib.CglibProxyFactory;
+import org.apache.commons.proxy.util.AbstractTestCase;
 
-public class TestNullInvoker extends TestCase
+public class TestNullInvoker extends AbstractTestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testReturnValues()
     {
-        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(), 0.0f );
-        assertEquals( 0.0, tester.doubleMethod(), 0.0f );
-        assertFalse( tester.booleanMethod() );
-        assertNull( tester.stringMethod() );
+        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(), 0.0f);
+        assertEquals(0.0, tester.doubleMethod(), 0.0f);
+        assertFalse(tester.booleanMethod());
+        assertNull(tester.stringMethod());
     }
 
+    public void testSerialization()
+    {
+        assertSerializable(new NullInvoker());
+    }
+
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
+
     public static interface Tester
     {
         public int intMethod();
+
         public long longMethod();
+
         public short shortMethod();
+
         public byte byteMethod();
+
         public char charMethod();
+
         public double doubleMethod();
+
         public float floatMethod();
+
         public String stringMethod();
+
         public boolean booleanMethod();
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestXmlRpcInvoker.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestXmlRpcInvoker.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestXmlRpcInvoker.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/invoker/TestXmlRpcInvoker.java Wed Feb 27 09:14:32 2008
@@ -36,12 +36,20 @@
  */
 public class TestXmlRpcInvoker extends TestCase
 {
+//**********************************************************************************************************************
+// Fields
+//**********************************************************************************************************************
+
     private static WebServer server;
     private static XmlRpcClient client;
 
+//**********************************************************************************************************************
+// Static Methods
+//**********************************************************************************************************************
+
     public static Test suite()
     {
-        return new TestSetup( new TestSuite( TestXmlRpcInvoker.class ) )
+        return new TestSetup(new TestSuite(TestXmlRpcInvoker.class))
         {
             public void run( final TestResult testResult )
             {
@@ -52,7 +60,7 @@
                         try
                         {
                             setUp();
-                            basicRun( testResult );
+                            basicRun(testResult);
                         }
                         finally
                         {
@@ -60,15 +68,15 @@
                         }
                     }
                 };
-                testResult.runProtected( this, p );
+                testResult.runProtected(this, p);
             }
 
             protected void setUp() throws Exception
             {
-                server = new WebServer( 9999 );
-                server.addHandler( "echo", new EchoImpl() );
+                server = new WebServer(9999);
+                server.addHandler("echo", new EchoImpl());
                 server.start();
-                client = new XmlRpcClientLite( "http://localhost:9999/RPC2" );
+                client = new XmlRpcClientLite("http://localhost:9999/RPC2");
             }
 
             protected void tearDown() throws Exception
@@ -78,14 +86,18 @@
         };
     }
 
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testInvalidHandlerName()
     {
-        final XmlRpcInvoker handler = new XmlRpcInvoker( client, "invalid" );
+        final XmlRpcInvoker handler = new XmlRpcInvoker(client, "invalid");
         final Echo echo = ( Echo ) new CglibProxyFactory()
-                .createInvokerProxy( handler, new Class[]{ Echo.class } );
+                .createInvokerProxy(handler, new Class[] {Echo.class});
         try
         {
-            echo.echoBack( "Hello" );
+            echo.echoBack("Hello");
             fail();
         }
         catch( InvokerException e )
@@ -95,10 +107,9 @@
 
     public void testValidInvocation() throws Exception
     {
-        final XmlRpcInvoker handler = new XmlRpcInvoker( client, "echo" );
+        final XmlRpcInvoker handler = new XmlRpcInvoker(client, "echo");
         final Echo echo = ( Echo ) new CglibProxyFactory()
-                .createInvokerProxy( handler, new Class[]{ Echo.class } );
-        assertEquals( "Hello", echo.echoBack( "Hello" ) );
-
+                .createInvokerProxy(handler, new Class[] {Echo.class});
+        assertEquals("Hello", echo.echoBack("Hello"));
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/CountingProvider.java Wed Feb 27 09:14:32 2008
@@ -25,18 +25,35 @@
  */
 public class CountingProvider extends ProviderDecorator
 {
+//**********************************************************************************************************************
+// Fields
+//**********************************************************************************************************************
+
     private int count = 0;
 
+//**********************************************************************************************************************
+// Constructors
+//**********************************************************************************************************************
+
     public CountingProvider( ObjectProvider inner )
     {
-        super( inner );
+        super(inner);
     }
 
+//**********************************************************************************************************************
+// ObjectProvider Implementation
+//**********************************************************************************************************************
+
+
     public synchronized Object getObject()
     {
         count++;
         return super.getObject();
     }
+
+//**********************************************************************************************************************
+// Getter/Setter Methods
+//**********************************************************************************************************************
 
     public synchronized int getCount()
     {

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestBeanProvider.java Wed Feb 27 09:14:32 2008
@@ -17,16 +17,21 @@
 
 package org.apache.commons.proxy.provider;
 
-import junit.framework.TestCase;
 import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.util.AbstractTestCase;
 
-public class TestBeanProvider extends TestCase
+public class TestBeanProvider extends AbstractTestCase
 {
-    public void testWithNullBeanClass()
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    public void testAbstractBeanClass()
     {
         try
         {
             final BeanProvider p = new BeanProvider();
+            p.setBeanClass(Number.class);
             p.getObject();
             fail();
         }
@@ -34,33 +39,40 @@
         {
         }
     }
-    public void testAbstractBeanClass()
+
+    public void testNonAccessibleConstructor()
     {
         try
         {
-            final BeanProvider p = new BeanProvider();
-            p.setBeanClass( Number.class );
-            p.getObject();
+            new BeanProvider(MyBean.class).getObject();
             fail();
         }
         catch( ObjectProviderException e )
         {
-
         }
     }
 
-    public void testNonAccessibleConstructor()
+    public void testSerialization()
+    {
+        assertSerializable(new BeanProvider(MyBean.class));
+    }
+
+    public void testWithNullBeanClass()
     {
         try
         {
-            new BeanProvider( MyBean.class ).getObject();
+            final BeanProvider p = new BeanProvider();
+            p.getObject();
             fail();
         }
         catch( ObjectProviderException e )
         {
-
         }
     }
+
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
 
     public static class MyBean
     {

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestCloningProvider.java Wed Feb 27 09:14:32 2008
@@ -17,29 +17,38 @@
 
 package org.apache.commons.proxy.provider;
 
-import junit.framework.TestCase;
 import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.util.AbstractTestCase;
 
 import java.util.Date;
 
-public class TestCloningProvider extends TestCase
+public class TestCloningProvider extends AbstractTestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    public void testSerialization()
+    {
+        assertSerializable(new CloningProvider(new Date()));
+    }
+
     public void testValidCloneable()
     {
         final Date now = new Date();
-        final CloningProvider provider = new CloningProvider( now );
+        final CloningProvider provider = new CloningProvider(now);
         final Date clone1 = ( Date ) provider.getObject();
-        assertEquals( now, clone1 );
-        assertNotSame( now, clone1 );
-        final Date clone2 = ( Date )provider.getObject();
-        assertEquals( now, clone2 );
-        assertNotSame( now, clone2 );
-        assertNotSame( clone2, clone1 );
+        assertEquals(now, clone1);
+        assertNotSame(now, clone1);
+        final Date clone2 = ( Date ) provider.getObject();
+        assertEquals(now, clone2);
+        assertNotSame(now, clone2);
+        assertNotSame(clone2, clone1);
     }
 
-    public void testWithPrivateCloneMethod()
+    public void testWithExceptionThrown()
     {
-        final CloningProvider provider = new CloningProvider( new PrivateCloneable() );
+        final CloningProvider provider = new CloningProvider(new ExceptionCloneable());
         try
         {
             provider.getObject();
@@ -49,10 +58,10 @@
         {
         }
     }
-    
+
     public void testWithInvalidCloneable()
     {
-        final CloningProvider provider = new CloningProvider( new InvalidCloneable() );
+        final CloningProvider provider = new CloningProvider(new InvalidCloneable());
         try
         {
             provider.getObject();
@@ -63,9 +72,9 @@
         }
     }
 
-    public void testWithExceptionThrown()
+    public void testWithPrivateCloneMethod()
     {
-        final CloningProvider provider = new CloningProvider( new ExceptionCloneable() );
+        final CloningProvider provider = new CloningProvider(new PrivateCloneable());
         try
         {
             provider.getObject();
@@ -76,6 +85,18 @@
         }
     }
 
+//**********************************************************************************************************************
+// Inner Classes
+//**********************************************************************************************************************
+
+    public static class ExceptionCloneable implements Cloneable
+    {
+        public Object clone()
+        {
+            throw new RuntimeException("No clone for you!");
+        }
+    }
+
     public static class InvalidCloneable implements Cloneable
     {
     }
@@ -85,14 +106,6 @@
         protected Object clone()
         {
             return this;
-        }
-    }
-    
-    public static class ExceptionCloneable implements Cloneable
-    {
-        public Object clone()
-        {
-            throw new RuntimeException( "No clone for you!" );
         }
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestConstantProvider.java Wed Feb 27 09:14:32 2008
@@ -17,17 +17,26 @@
 
 package org.apache.commons.proxy.provider;
 
-import junit.framework.TestCase;
+import org.apache.commons.proxy.util.AbstractTestCase;
 
 /**
  * @since 1.0
  */
-public class TestConstantProvider extends TestCase
+public class TestConstantProvider extends AbstractTestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testGetObject() throws Exception
     {
         final String s = "Hello, World!";
-        final ConstantProvider provider = new ConstantProvider( s );
-        assertSame( s, provider.getObject() );
+        final ConstantProvider provider = new ConstantProvider(s);
+        assertSame(s, provider.getObject());
+    }
+
+    public void testSerialization()
+    {
+        assertSerializable(new ConstantProvider("Hello, World!"));
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/TestNullProvider.java Wed Feb 27 09:14:32 2008
@@ -17,17 +17,26 @@
 
 package org.apache.commons.proxy.provider;
 
-import junit.framework.TestCase;
+import org.apache.commons.proxy.util.AbstractTestCase;
 
 /**
  * @author James Carman
  * @since 1.0
  */
-public class TestNullProvider extends TestCase
+public class TestNullProvider extends AbstractTestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public void testGetObject()
     {
         final NullProvider provider = new NullProvider();
-        assertNull( provider.getObject() );
+        assertNull(provider.getObject());
+    }
+
+    public void testSerialization()
+    {
+        assertSerializable(new NullProvider());
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestBurlapProvider.java Wed Feb 27 09:14:32 2008
@@ -16,18 +16,30 @@
  */
 
 package org.apache.commons.proxy.provider.remoting;
-import junit.framework.TestCase;
-import org.apache.commons.proxy.util.Echo;
+
 import org.apache.commons.proxy.exception.ObjectProviderException;
-import org.apache.commons.proxy.provider.remoting.BurlapProvider;
+import org.apache.commons.proxy.util.AbstractTestCase;
+import org.apache.commons.proxy.util.Echo;
 
-public class TestBurlapProvider extends TestCase
+public class TestBurlapProvider extends AbstractTestCase
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    public void testSerialization()
+    {
+        final BurlapProvider p = new BurlapProvider();
+        p.setServiceInterface(Echo.class);
+        p.setUrl("a malformed URL");
+        assertSerializable(p);
+    }
+
     public void testWithMalformedUrl()
     {
         try
         {
-            final BurlapProvider p = new BurlapProvider( Echo.class, "a malformed URL" );
+            final BurlapProvider p = new BurlapProvider(Echo.class, "a malformed URL");
             p.getObject();
             fail();
         }
@@ -41,8 +53,8 @@
         try
         {
             final BurlapProvider p = new BurlapProvider();
-            p.setServiceInterface( Echo.class );
-            p.setUrl( "a malformed URL" );
+            p.setServiceInterface(Echo.class);
+            p.setUrl("a malformed URL");
             p.getObject();
             fail();
         }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/provider/remoting/TestHessianProvider.java Wed Feb 27 09:14:32 2008
@@ -17,24 +17,29 @@
 
 package org.apache.commons.proxy.provider.remoting;
 
-import junit.framework.TestCase;
 import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.util.AbstractTestCase;
 import org.apache.commons.proxy.util.Echo;
-import org.apache.commons.proxy.provider.remoting.HessianProvider;
 
-public class TestHessianProvider extends TestCase
+public class TestHessianProvider extends AbstractTestCase
 {
-//----------------------------------------------------------------------------------------------------------------------
+//**********************************************************************************************************************
 // Other Methods
-//----------------------------------------------------------------------------------------------------------------------
+//**********************************************************************************************************************
 
-    public void testWithMalformedUrlBean()
+    public void testSerialization()
+    {
+        final HessianProvider p = new HessianProvider();
+        p.setServiceInterface(Echo.class);
+        p.setUrl("a malformed URL");
+        assertSerializable(p);
+    }
+
+    public void testWithMalformedUrl()
     {
         try
         {
-            final HessianProvider p = new HessianProvider();
-            p.setServiceInterface( Echo.class );
-            p.setUrl( "a malformed URL" );
+            final HessianProvider p = new HessianProvider(Echo.class, "a malformed URL");
             p.getObject();
             fail();
         }
@@ -43,11 +48,13 @@
         }
     }
 
-    public void testWithMalformedUrl()
+    public void testWithMalformedUrlBean()
     {
         try
         {
-            final HessianProvider p = new HessianProvider( Echo.class, "a malformed URL" );
+            final HessianProvider p = new HessianProvider();
+            p.setServiceInterface(Echo.class);
+            p.setUrl("a malformed URL");
             p.getObject();
             fail();
         }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractEcho.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractEcho.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractEcho.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractEcho.java Wed Feb 27 09:14:32 2008
@@ -25,6 +25,10 @@
  */
 public abstract class AbstractEcho implements Echo, Serializable
 {
+//**********************************************************************************************************************
+// Echo Implementation
+//**********************************************************************************************************************
+
     public String echoBack( String message )
     {
         return message;

Added: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractTestCase.java?rev=631654&view=auto
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractTestCase.java (added)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/AbstractTestCase.java Wed Feb 27 09:14:32 2008
@@ -0,0 +1,23 @@
+package org.apache.commons.proxy.util;
+
+import junit.framework.TestCase;
+import org.apache.commons.lang.SerializationUtils;
+
+import java.io.Serializable;
+
+/**
+ * @auothor James Carman
+ * @since 1.1
+ */
+public abstract class AbstractTestCase extends TestCase
+{
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    protected void assertSerializable( Object o )
+    {
+        assertTrue(o instanceof Serializable);
+        SerializationUtils.clone(( Serializable ) o);
+    }
+}

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/DuplicateEcho.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/DuplicateEcho.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/DuplicateEcho.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/DuplicateEcho.java Wed Feb 27 09:14:32 2008
@@ -23,5 +23,9 @@
  */
 public interface DuplicateEcho
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public String echoBack( String message );
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/Echo.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/Echo.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/Echo.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/Echo.java Wed Feb 27 09:14:32 2008
@@ -25,13 +25,23 @@
  */
 public interface Echo
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
+    public void echo();
+
     public String echoBack( String message );
-    public String echoBack( String message1, String message2 );
+
     public String echoBack( String[] messages );
+
     public int echoBack( int i );
+
     public boolean echoBack( boolean b );
-    public void echo();
 
-    public void ioException() throws IOException;
+    public String echoBack( String message1, String message2 );
+
     public void illegalArgument();
+
+    public void ioException() throws IOException;
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/EchoImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/EchoImpl.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/EchoImpl.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/EchoImpl.java Wed Feb 27 09:14:32 2008
@@ -26,16 +26,24 @@
  */
 public class EchoImpl extends AbstractEcho implements DuplicateEcho, Serializable
 {
+//**********************************************************************************************************************
+// Fields
+//**********************************************************************************************************************
+
     private static final long serialVersionUID = -4844873352607521103L;
 
-    public boolean echoBack( boolean b )
+//**********************************************************************************************************************
+// Echo Implementation
+//**********************************************************************************************************************
+
+
+    public void echo()
     {
-        return b;
     }
 
-    public String echoBack( String message1, String message2 )
+    public boolean echoBack( boolean b )
     {
-        return message1 + message2;
+        return b;
     }
 
     public String echoBack( String[] messages )
@@ -44,7 +52,7 @@
         for( int i = 0; i < messages.length; i++ )
         {
             String message = messages[i];
-            sb.append( message );
+            sb.append(message);
         }
         return sb.toString();
     }
@@ -54,17 +62,18 @@
         return i;
     }
 
-    public void echo()
+    public String echoBack( String message1, String message2 )
     {
+        return message1 + message2;
     }
 
-    public void ioException() throws IOException
+    public void illegalArgument()
     {
-        throw new IOException( "dummy message" );
+        throw new IllegalArgumentException("dummy message");
     }
 
-    public void illegalArgument()
+    public void ioException() throws IOException
     {
-        throw new IllegalArgumentException( "dummy message" );
+        throw new IOException("dummy message");
     }
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/QuoteService.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/QuoteService.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/QuoteService.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/QuoteService.java Wed Feb 27 09:14:32 2008
@@ -26,5 +26,9 @@
  */
 public interface QuoteService extends Remote
 {
+//**********************************************************************************************************************
+// Other Methods
+//**********************************************************************************************************************
+
     public float getQuote( String symbol ) throws RemoteException;
 }

Modified: commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/SuffixInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/SuffixInterceptor.java?rev=631654&r1=631653&r2=631654&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/SuffixInterceptor.java (original)
+++ commons/proper/proxy/trunk/src/test/java/org/apache/commons/proxy/util/SuffixInterceptor.java Wed Feb 27 09:14:32 2008
@@ -17,8 +17,8 @@
 
 package org.apache.commons.proxy.util;
 
-import org.apache.commons.proxy.Invocation;
 import org.apache.commons.proxy.Interceptor;
+import org.apache.commons.proxy.Invocation;
 
 /**
  * @author James Carman
@@ -26,12 +26,25 @@
  */
 public class SuffixInterceptor implements Interceptor
 {
+//**********************************************************************************************************************
+// Fields
+//**********************************************************************************************************************
+
     private final String suffix;
 
+//**********************************************************************************************************************
+// Constructors
+//**********************************************************************************************************************
+
     public SuffixInterceptor( String suffix )
     {
         this.suffix = suffix;
     }
+
+//**********************************************************************************************************************
+// Interceptor Implementation
+//**********************************************************************************************************************
+
 
     public Object intercept( Invocation methodInvocation ) throws Throwable
     {



Mime
View raw message