You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2003/01/28 00:56:17 UTC

cvs commit: jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket CustomStreamSSHTestCase.java

hammant     2003/01/27 15:56:16

  Modified:    altrmi   ant.properties.sample build.xml
  Added:       altrmi/src/test/org/apache/excalibur/altrmi/test/socket
                        CustomStreamSSHTestCase.java
  Log:
  SSH transport testcase ?
  
  Revision  Changes    Path
  1.6       +8 -1      jakarta-avalon-excalibur/altrmi/ant.properties.sample
  
  Index: ant.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/ant.properties.sample,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ant.properties.sample	13 Oct 2002 11:54:24 -0000	1.5
  +++ ant.properties.sample	27 Jan 2003 23:56:16 -0000	1.6
  @@ -52,3 +52,10 @@
   # uncomment this if you want a different number of iterations for the speed test
   
   # speedtest.iterations=10
  +
  +# --------------------------------------------------
  +#                SSH User ID and Password
  +# --------------------------------------------------
  +
  +ssh.userid=fill-me-in!-see-ant.properties
  +ssh.passwd=fill-me-in!-see-ant.properties
  
  
  
  1.66      +2 -0      jakarta-avalon-excalibur/altrmi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- build.xml	19 Jan 2003 18:03:52 -0000	1.65
  +++ build.xml	27 Jan 2003 23:56:16 -0000	1.66
  @@ -144,6 +144,8 @@
           <mkdir dir="${build.testsrc}"/>
   
           <filter token="SPEEDTEST-ITERATIONS" value="${speedtest.iterations}"/>               
  +        <filter token="SSH-USERID" value="${ssh.userid}"/>               
  +        <filter token="SSH-PASSWD" value="${ssh.passwd}"/>               
   
           <echo>Speed Test Iterations=${speedtest.iterations}</echo>
   
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamSSHTestCase.java
  
  Index: CustomStreamSSHTestCase.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.excalibur.altrmi.test.socket;
  
  import org.apache.excalibur.altrmi.client.impl.socket.SocketCustomStreamSSHHostContext;
  import org.apache.excalibur.altrmi.client.impl.ClientSideClassFactory;
  
  import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
  import org.apache.excalibur.altrmi.server.PublicationDescription;
  import org.apache.excalibur.altrmi.test.TestInterface;
  import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  import org.apache.excalibur.altrmi.test.TestInterface3;
  import org.apache.excalibur.altrmi.test.TestInterface2;
  import org.apache.excalibur.altrmi.test.AbstractAltrmiTestCase;
  import org.apache.excalibur.altrmi.common.ConnectionException;
  
  
  /**
   * Test Custom Stream SSH transport over sockets.
   * @author Paul Hammant
   */
  public class CustomStreamSSHTestCase extends AbstractAltrmiTestCase
  {
  
      public CustomStreamSSHTestCase(String name)
      {
          super(name);
          System.out.println("SSH-USER = @SSH-USERID@");
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
  
          // server side setup.
          server = new CompleteSocketCustomStreamServer(10101);
          testServer = new TestInterfaceImpl();
          PublicationDescription pd = new PublicationDescription(TestInterface.class,
                  new Class[] { TestInterface3.class, TestInterface2.class });
          server.publish(testServer, "Hello", pd);
          server.start();
  
          // Client side setup
          altrmiFactory = new ClientSideClassFactory(false);
  
          try
          {
  
              altrmiFactory.setHostContext(new SocketCustomStreamSSHHostContext("127.0.0.1", 10101, "@SSH-USERID@", "@SSH-PASSWD@"), false);
          }
          catch (ConnectionException e)
          {
              server.stop();
              throw new Exception("Could not connect to SSH server");
          }
          testClient = (TestInterface) altrmiFactory.lookup("Hello");
  
          // just a kludge for unit testing given we are intrinsically dealing with
          // threads, AltRMI being a client/server thing
          Thread.yield();
      }
  
  
      protected void tearDown() throws Exception
      {
          testClient = null;
          System.gc();
          Thread.yield();
          altrmiFactory.close();
          Thread.yield();
          server.stop();
          Thread.yield();
          server = null;
          testServer = null;
          super.tearDown();
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>