commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r348168 - in /jakarta/commons/sandbox/proxy/trunk/src: java/org/apache/commons/proxy/provider/RmiProvider.java test/org/apache/commons/proxy/provider/TestRmiProvider.java
Date Tue, 22 Nov 2005 13:17:02 GMT
Author: jcarman
Date: Tue Nov 22 05:16:53 2005
New Revision: 348168

URL: http://svn.apache.org/viewcvs?rev=348168&view=rev
Log:
Improving test coverage.

Modified:
    jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
    jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java?rev=348168&r1=348167&r2=348168&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
Tue Nov 22 05:16:53 2005
@@ -19,7 +19,6 @@
 import org.apache.commons.proxy.ObjectProvider;
 import org.apache.commons.proxy.exception.ObjectProviderException;
 
-import java.rmi.AccessException;
 import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
@@ -89,10 +88,6 @@
         {
             throw new ObjectProviderException( "Name " + name + " not found in registry at
" + host + ":" + port + ".",
                                                e );
-        }
-        catch( AccessException e )
-        {
-            throw new ObjectProviderException( "Registry at " + host + ":" + port + " did
not allow lookup.", e );
         }
         catch( RemoteException e )
         {

Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java?rev=348168&r1=348167&r2=348168&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java
Tue Nov 22 05:16:53 2005
@@ -16,10 +16,12 @@
 package org.apache.commons.proxy.provider;
 
 import junit.framework.TestCase;
+import org.apache.commons.proxy.exception.ObjectProviderException;
 import org.apache.commons.proxy.util.rmi.RmiEcho;
 import org.apache.commons.proxy.util.rmi.RmiEchoImpl;
-import org.apache.commons.proxy.exception.ObjectProviderException;
 
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 import java.rmi.server.RMISocketFactory;
@@ -39,9 +41,33 @@
 
     public void tearDown() throws Exception
     {
+        if( registry != null )
+        {
+            tearDownRegistry();
+        }
+    }
+
+    private void tearDownRegistry()
+            throws RemoteException, NotBoundException
+    {
         registry.unbind( "echo" );
         UnicastRemoteObject.unexportObject( implObject, true );
         UnicastRemoteObject.unexportObject( registry, true );
+        registry = null;
+    }
+
+    public void testWithNoRegistry() throws Exception
+    {
+        tearDownRegistry();
+        final RmiProvider provider = new RmiProvider( "echo" );
+        try
+        {
+            provider.getObject();
+            fail();
+        }
+        catch( ObjectProviderException e )
+        {
+        }
     }
 
     public void testGetObject() throws Exception
@@ -56,7 +82,7 @@
         final RmiProvider provider = new RmiProvider( "bogus" );
         try
         {
-            final RmiEcho echo = ( RmiEcho ) provider.getObject();
+            provider.getObject();
             fail();
         }
         catch( ObjectProviderException e )



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


Mime
View raw message