avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/client/impl/naming DefaultContextTestCase.java
Date Sun, 02 Feb 2003 08:50:14 GMT
hammant     2003/02/02 00:50:14

  Modified:    altrmi   build.xml
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl/naming
                        DefaultContext.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters
                        InvocationHandlerAdapter.java
               altrmi/src/test/org/apache/excalibur/altrmi/test
                        DummyInvocationHandler.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/misc
                        DefaultConnectionPingerTestCase.java
  Added:       altrmi/src/test/org/apache/excalibur/altrmi/client/impl/naming
                        DefaultContextTestCase.java
  Log:
  Coverage improved. DefaultContextTestCase started.
  
  Revision  Changes    Path
  1.68      +1 -1      jakarta-avalon-excalibur/altrmi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- build.xml	1 Feb 2003 20:18:17 -0000	1.67
  +++ build.xml	2 Feb 2003 08:50:14 -0000	1.68
  @@ -343,7 +343,7 @@
               <batchtest todir="${build.tests}">
                   <fileset dir="${build.testclasses}">
   
  -                    <include name="**/test/**/${test.filter}.class"/>
  +                    <include name="**/${test.filter}.class"/>
   
   <!--
   
  
  
  
  1.3       +27 -20    jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/naming/DefaultContext.java
  
  Index: DefaultContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/naming/DefaultContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultContext.java	1 Feb 2003 11:33:48 -0000	1.2
  +++ DefaultContext.java	2 Feb 2003 08:50:14 -0000	1.3
  @@ -137,7 +137,7 @@
        */
       public Object lookup( Name name ) throws NamingException
       {
  -        return null;
  +        return lookup(name.toString()); // this right?
       }
   
       /**
  @@ -153,15 +153,12 @@
        */
       public Object lookup( String name ) throws NamingException
       {
  -
           try
           {
               return m_altrmiInterfaceLookup.lookup( name );
           }
           catch( ConnectionException ace )
           {
  -            ace.printStackTrace();
  -
               throw new NamingException( ace.getMessage() );
           }
       }
  @@ -178,6 +175,7 @@
        */
       public void bind( Name name, Object obj ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -192,6 +190,7 @@
        */
       public void bind( String name, Object obj ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -206,6 +205,7 @@
        */
       public void rebind( Name name, Object obj ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -220,6 +220,7 @@
        */
       public void rebind( String name, Object obj ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -233,6 +234,7 @@
        */
       public void unbind( Name name ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -246,6 +248,7 @@
        */
       public void unbind( String name ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -260,6 +263,7 @@
        */
       public void rename( Name oldName, Name newName ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -274,6 +278,7 @@
        */
       public void rename( String oldName, String newName ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -289,7 +294,7 @@
        */
       public NamingEnumeration list( Name name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -353,7 +358,7 @@
        */
       public NamingEnumeration listBindings( Name name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -369,7 +374,7 @@
        */
       public NamingEnumeration listBindings( String name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -383,6 +388,7 @@
        */
       public void destroySubcontext( Name name ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -396,6 +402,7 @@
        */
       public void destroySubcontext( String name ) throws NamingException
       {
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -411,7 +418,7 @@
        */
       public Context createSubcontext( Name name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -427,7 +434,7 @@
        */
       public Context createSubcontext( String name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -443,7 +450,7 @@
        */
       public Object lookupLink( Name name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -459,7 +466,7 @@
        */
       public Object lookupLink( String name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -475,7 +482,7 @@
        */
       public NameParser getNameParser( Name name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -491,7 +498,7 @@
        */
       public NameParser getNameParser( String name ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -508,7 +515,7 @@
        */
       public Name composeName( Name name, Name prefix ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -525,7 +532,7 @@
        */
       public String composeName( String name, String prefix ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -542,7 +549,7 @@
        */
       public Object addToEnvironment( String propName, Object propVal ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -558,7 +565,7 @@
        */
       public Object removeFromEnvironment( String propName ) throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -572,7 +579,7 @@
        */
       public Hashtable getEnvironment() throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   
       /**
  @@ -598,6 +605,6 @@
        */
       public String getNameInNamespace() throws NamingException
       {
  -        return null;
  +        throw new UnsupportedOperationException();
       }
   }
  
  
  
  1.21      +1 -2      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/InvocationHandlerAdapter.java
  
  Index: InvocationHandlerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/InvocationHandlerAdapter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- InvocationHandlerAdapter.java	1 Feb 2003 11:33:49 -0000	1.20
  +++ InvocationHandlerAdapter.java	2 Feb 2003 08:50:14 -0000	1.21
  @@ -458,7 +458,6 @@
           }
           catch( ClassRetrievalException e )
           {
  -            e.printStackTrace();
               return new ClassRetrievalFailedReply( e.getMessage() );
           }
       }
  
  
  
  1.4       +3 -2      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/DummyInvocationHandler.java
  
  Index: DummyInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/DummyInvocationHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DummyInvocationHandler.java	29 Jan 2003 08:01:13 -0000	1.3
  +++ DummyInvocationHandler.java	2 Feb 2003 08:50:14 -0000	1.4
  @@ -23,6 +23,7 @@
       boolean pinged = false;
       long lastReq = System.currentTimeMillis();
       private ConnectionListener m_connectionListener;
  +    private ThreadContextProvider m_threadContextProvider;
   
       public boolean isPinged()
       {
  @@ -102,12 +103,12 @@
   
       public void setThreadContextProvider(ThreadContextProvider threadContextProvider)
       {
  -        throw new java.lang.UnsupportedOperationException();
  +        m_threadContextProvider = threadContextProvider;
       }
   
       public ThreadContextProvider getThreadContextProvider()
       {
  -        throw new java.lang.UnsupportedOperationException();
  +        return m_threadContextProvider;
       }
   
   
  
  
  
  1.2       +3 -1      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/misc/DefaultConnectionPingerTestCase.java
  
  Index: DefaultConnectionPingerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/misc/DefaultConnectionPingerTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultConnectionPingerTestCase.java	1 Feb 2003 20:18:18 -0000	1.1
  +++ DefaultConnectionPingerTestCase.java	2 Feb 2003 08:50:14 -0000	1.2
  @@ -10,6 +10,7 @@
   import junit.framework.TestCase;
   import org.apache.excalibur.altrmi.test.DummyInvocationHandler;
   import org.apache.excalibur.altrmi.client.impl.DefaultConnectionPinger;
  +import org.apache.excalibur.altrmi.common.DefaultThreadContextProvider;
   
   public class DefaultConnectionPingerTestCase extends TestCase
   {
  @@ -28,8 +29,9 @@
       {
           DefaultConnectionPinger pinger = new DefaultConnectionPinger(1L,10000L);
           DummyInvocationHandler dummy = new DummyInvocationHandler();
  -        pinger.start();
  +        dummy.setThreadContextProvider(new DefaultThreadContextProvider());
           pinger.setInvocationHandler(dummy);
  +        pinger.start();
           Thread.sleep(1000);
           assertTrue("Should have pinged", dummy.isPinged());
           pinger.stop();
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/client/impl/naming/DefaultContextTestCase.java
  
  Index: DefaultContextTestCase.java
  ===================================================================
  package org.apache.excalibur.altrmi.client.impl.naming;
  
  import junit.framework.TestCase;
  import org.apache.excalibur.altrmi.client.impl.naming.DefaultContext;
  import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketObjectStreamServer;
  import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
  import org.apache.excalibur.altrmi.server.ServerException;
  import org.apache.excalibur.altrmi.server.PublicationException;
  import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  import org.apache.excalibur.altrmi.test.TestInterface;
  
  import javax.naming.NamingException;
  import javax.naming.Name;
  import javax.naming.NamingEnumeration;
  import java.util.Hashtable;
  
  /**
   * Test DefaultContext
   *
   * @author Paul Hammant
   */
  public class DefaultContextTestCase extends TestCase {
  
      public DefaultContextTestCase(String s)
      {
          super(s);
      }
  
      public void testObjectStreamDetails() throws ServerException, NamingException, PublicationException
{
  
          CompleteSocketObjectStreamServer svr = new CompleteSocketObjectStreamServer(12121);
          svr.publish(new TestInterfaceImpl(),"Hello", TestInterface.class);
          svr.start();
  
          Hashtable ht = new Hashtable();
          DefaultContext dc = new DefaultContext("127.0.0.1", "12121", "SocketObjectStream",
ht);
          try
          {
              dc.lookup("Hello");
              fail("Should have had a naming exception");
          }
          catch (NamingException e)
          {
          }
          finally
          {
              svr.stop();
          }
      }
  
      public void testList() throws ServerException, PublicationException, NamingException
      {
  
          CompleteSocketCustomStreamServer svr = new CompleteSocketCustomStreamServer(12121);
          svr.publish(new TestInterfaceImpl(),"Hello", TestInterface.class);
          svr.start();
  
          Hashtable ht = new Hashtable();
          DefaultContext dc = new DefaultContext("127.0.0.1", "12121", "SocketCustomStream",
ht);
  
          NamingEnumeration ne = null;
          try
          {
              ne = dc.list("Hello");
              fail("Should have had a naming exception");
          }
          catch (NamingException e)
          {
          }
          finally
          {
              svr.stop();
          }
  
  
      }
  
      public void testCustomStreamProxyDetails() throws ServerException, NamingException,
PublicationException {
  
          CompleteSocketCustomStreamServer svr = new CompleteSocketCustomStreamServer(12121);
          svr.publish(new TestInterfaceImpl(),"Hello", TestInterface.class);
          svr.start();
  
          Hashtable ht = new Hashtable();
          DefaultContext dc = new DefaultContext("127.0.0.1", "12121", "SocketCustomStream",
ht);
          try
          {
              dc.lookup("Fred");
              fail("Should have had a naming exception");
          }
          catch (NamingException e)
          {
          }
          finally
          {
              svr.stop();
          }
      }
  
      public void testUnimplemented() throws NamingException, ServerException {
  
          CompleteSocketCustomStreamServer svr = new CompleteSocketCustomStreamServer(12121);
          svr.start();
  
          DefaultContext dc = new DefaultContext("127.0.0.1", "12121", "SocketCustomStream",
new Hashtable());
  
          try
          {
              dc.bind((Name) null, new Object());
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.bind("hah", new Object());
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.rebind((Name) null, new Object());
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.rebind("hah", new Object());
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.unbind((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.unbind("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.rebind((Name) null, (Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.rebind("hah", "hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.list((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.listBindings((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.listBindings("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.destroySubcontext((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.destroySubcontext("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.createSubcontext((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.createSubcontext("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.lookupLink((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.lookupLink("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.getNameParser((Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.getNameParser("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.composeName((Name) null, (Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.composeName("hah", "hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.addToEnvironment("hah", new Object());
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.removeFromEnvironment("hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.getEnvironment();
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.getNameInNamespace();
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.rename((Name) null, (Name) null);
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
          try
          {
              dc.rename("hah", "hah");
              fail("UnsupportedOperationException expected");
          }
          catch (UnsupportedOperationException ue)
          {
          }
  
  
      }
  
  
  }
  
  
  

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


Mime
View raw message