You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jc...@apache.org on 2005/10/14 18:36:21 UTC

svn commit: r321146 - /jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestXmlRpcInvocationHandler.java

Author: jcarman
Date: Fri Oct 14 09:36:18 2005
New Revision: 321146

URL: http://svn.apache.org/viewcvs?rev=321146&view=rev
Log:
Speeding up unit test execution by using a one-time setup/teardown of the webserver.

Modified:
    jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestXmlRpcInvocationHandler.java

Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestXmlRpcInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestXmlRpcInvocationHandler.java?rev=321146&r1=321145&r2=321146&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestXmlRpcInvocationHandler.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/handler/TestXmlRpcInvocationHandler.java Fri Oct 14 09:36:18 2005
@@ -16,11 +16,16 @@
  */
 package org.apache.commons.proxy.handler;
 
+import junit.extensions.TestSetup;
+import junit.framework.Protectable;
+import junit.framework.Test;
 import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+import org.apache.commons.proxy.exception.InvocationHandlerException;
 import org.apache.commons.proxy.factory.cglib.CglibProxyFactory;
 import org.apache.commons.proxy.util.Echo;
 import org.apache.commons.proxy.util.EchoImpl;
-import org.apache.commons.proxy.exception.InvocationHandlerException;
 import org.apache.xmlrpc.WebServer;
 import org.apache.xmlrpc.XmlRpcClient;
 
@@ -29,20 +34,46 @@
  */
 public class TestXmlRpcInvocationHandler extends TestCase
 {
-    private WebServer server;
-    private XmlRpcClient client;
+    private static WebServer server;
+    private static XmlRpcClient client;
 
-    protected void setUp() throws Exception
+    public static Test suite()
     {
-        server = new WebServer( 9999 );
-        server.addHandler( "echo", new EchoImpl() );
-        server.start();
-        client = new XmlRpcClient( "http://localhost:9999/RPC2" );
-    }
+        return new TestSetup( new TestSuite( TestXmlRpcInvocationHandler.class ) )
+        {
+            public void run( final TestResult testResult )
+            {
+                Protectable p = new Protectable()
+                {
+                    public void protect() throws Throwable
+                    {
+                        try
+                        {
+                            setUp();
+                            basicRun( testResult );
+                        }
+                        finally
+                        {
+                            tearDown();
+                        }
+                    }
+                };
+                testResult.runProtected( this, p );
+            }
 
-    protected void tearDown() throws Exception
-    {
-        server.shutdown();
+            protected void setUp() throws Exception
+            {
+                server = new WebServer( 9999 );
+                server.addHandler( "echo", new EchoImpl() );
+                server.start();
+                client = new XmlRpcClient( "http://localhost:9999/RPC2" );
+            }
+
+            protected void tearDown() throws Exception
+            {
+                server.shutdown();
+            }
+        };
     }
 
     public void testInvalidHandlerName()
@@ -57,7 +88,6 @@
         }
         catch( InvocationHandlerException e )
         {
-            
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org