[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout ...

Ron Sigal ron_sigal at yahoo.com
Thu Feb 22 04:42:35 EST 2007


  User: rsigal  
  Date: 07/02/22 04:42:35

  Added:       src/tests/org/jboss/test/remoting/transport/http/timeout    
                        Tag: remoting_2_x HttpQuickDisconnectClient.java
                        HttpQuickDisconnectTestCase.java
                        HttpPerInvocationTimeoutTestCase.java
                        HttpQuickDisconnectServer.java
  Log:
  JBREM-657, JBREM-701: Unit tests.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +76 -0     JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/Attic/HttpQuickDisconnectClient.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HttpQuickDisconnectClient.java
  ===================================================================
  RCS file: HttpQuickDisconnectClient.java
  diff -N HttpQuickDisconnectClient.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ HttpQuickDisconnectClient.java	22 Feb 2007 09:42:35 -0000	1.1.2.1
  @@ -0,0 +1,76 @@
  +/*
  +* JBoss, Home of Professional Open Source
  +* Copyright 2005, JBoss Inc., and individual contributors as indicated
  +* by the @authors tag. See the copyright.txt in the distribution for a
  +* full listing of individual contributors.
  +*
  +* This is free software; you can redistribute it and/or modify it
  +* under the terms of the GNU Lesser General Public License as
  +* published by the Free Software Foundation; either version 2.1 of
  +* the License, or (at your option) any later version.
  +*
  +* This software is distributed in the hope that it will be useful,
  +* but WITHOUT ANY WARRANTY; without even the implied warranty of
  +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  +* Lesser General Public License for more details.
  +*
  +* You should have received a copy of the GNU Lesser General Public
  +* License along with this software; if not, write to the Free
  +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  +* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  +*/
  +package org.jboss.test.remoting.transport.http.timeout;
  +
  +import org.jboss.test.remoting.timeout.QuickDisconnectClientParent;
  +
  +
  +/** 
  + * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  + * @version $Revision: 1.1.2.1 $
  + * <p>
  + * Copyright Feb 17, 2007
  + * </p>
  + */
  +public class HttpQuickDisconnectClient extends QuickDisconnectClientParent
  +{
  +   /**
  +    * With the http transport, a java.net.ConnectException is thrown right away,
  +    * so the super implementation of this test fails.  It's not a problem, though,
  +    * since this test is just to show that without setting a short per invocation
  +    * timeout, disconnecting from a disabled server might be slow.  If it happens
  +    * to be fast, that's fine.
  +    */
  +   public void testSlowDisconnect() throws Throwable
  +   {  
  +   }
  +   
  +   /**
  +    * With the http transport, a java.net.ConnectException is thrown right away,
  +    * so the super implementation of this test fails.  It's not a problem, though,
  +    * since this test is just to show that without setting a short per invocation
  +    * timeout, removing a listener from a disabled server might be slow.  If it
  +    * happens to be fast, that's fine.
  +    */
  +   public void testSlowRemoveListener() throws Throwable
  +   {
  +   }
  +   
  +   protected String getTransport()
  +   {
  +      return "http";
  +   }
  +   
  +   /**
  +    * It seems that in jdk 1.4 (at least), HttpURLConnection has a default timeout
  +    * of 1000 ms, so the tests are run with a shorter timeout.
  +    */
  +   protected int shortTimeout()
  +   {
  +      return 500;
  +   }
  +   
  +   protected String shortTimeoutString()
  +   {
  +      return "500";
  +   }
  +}
  
  
  
  1.1.2.1   +42 -0     JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/Attic/HttpQuickDisconnectTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HttpQuickDisconnectTestCase.java
  ===================================================================
  RCS file: HttpQuickDisconnectTestCase.java
  diff -N HttpQuickDisconnectTestCase.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ HttpQuickDisconnectTestCase.java	22 Feb 2007 09:42:35 -0000	1.1.2.1
  @@ -0,0 +1,42 @@
  +/*
  +* JBoss, Home of Professional Open Source
  +* Copyright 2005, JBoss Inc., and individual contributors as indicated
  +* by the @authors tag. See the copyright.txt in the distribution for a
  +* full listing of individual contributors.
  +*
  +* This is free software; you can redistribute it and/or modify it
  +* under the terms of the GNU Lesser General Public License as
  +* published by the Free Software Foundation; either version 2.1 of
  +* the License, or (at your option) any later version.
  +*
  +* This software is distributed in the hope that it will be useful,
  +* but WITHOUT ANY WARRANTY; without even the implied warranty of
  +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  +* Lesser General Public License for more details.
  +*
  +* You should have received a copy of the GNU Lesser General Public
  +* License along with this software; if not, write to the Free
  +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  +* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  +*/
  +
  +package org.jboss.test.remoting.transport.http.timeout;
  +
  +import org.jboss.jrunit.harness.TestDriver;
  +
  +/**
  + * @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
  + */
  +public class HttpQuickDisconnectTestCase extends TestDriver
  +{
  +   public void declareTestClasses()
  +   {
  +      addTestClasses(HttpQuickDisconnectClient.class.getName(),
  +                     1,
  +                     HttpQuickDisconnectServer.class.getName());
  +   }
  +   protected long getResultsTimeout()
  +   {
  +      return 100000;
  +   }
  +}
  \ No newline at end of file
  
  
  
  1.1.2.1   +51 -0     JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/Attic/HttpPerInvocationTimeoutTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HttpPerInvocationTimeoutTestCase.java
  ===================================================================
  RCS file: HttpPerInvocationTimeoutTestCase.java
  diff -N HttpPerInvocationTimeoutTestCase.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ HttpPerInvocationTimeoutTestCase.java	22 Feb 2007 09:42:35 -0000	1.1.2.1
  @@ -0,0 +1,51 @@
  +package org.jboss.test.remoting.transport.http.timeout;
  +
  +import java.util.HashMap;
  +
  +import org.jboss.remoting.ServerInvoker;
  +import org.jboss.test.remoting.timeout.PerInvocationTimeoutTestRoot;
  +
  +
  +/**
  + * See javadoc for PerInvocationTimeoutTestRoot.
  + *   
  + * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  + * @version $Revision: 1.1.2.1 $
  + * <p>
  + * Copyright Feb 6, 2007
  + * </p>
  + */
  +public class HttpPerInvocationTimeoutTestCase extends PerInvocationTimeoutTestRoot
  +{    
  +   /**
  +    * There seems to be some strange behavior in the BasicThreadPool timeout 
  +    * mechanism, which could potentially cause a thread to prematurely time out.
  +    */
  +   public void testBasicThreadPool() throws Throwable
  +   {
  +      log.info("entering " + getName());
  +      
  +      try
  +      {
  +         for (int i = 0; i < 1000; i++)
  +         {
  +            HashMap metadata = new HashMap();
  +            metadata.put(ServerInvoker.TIMEOUT, "1000");
  +            assertEquals(NO_WAIT, client.invoke(NO_WAIT, metadata));
  +         }
  +      }
  +      catch (Exception e)
  +      {
  +         log.error(e);
  +         fail();
  +      }
  +      
  +      log.info(getName() + " PASSES");
  +   }
  +   
  +   
  +   protected String getTransport()
  +   {
  +      return "http";
  +   }
  +}
  
  
  
  1.1.2.1   +53 -0     JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/Attic/HttpQuickDisconnectServer.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HttpQuickDisconnectServer.java
  ===================================================================
  RCS file: HttpQuickDisconnectServer.java
  diff -N HttpQuickDisconnectServer.java
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ HttpQuickDisconnectServer.java	22 Feb 2007 09:42:35 -0000	1.1.2.1
  @@ -0,0 +1,53 @@
  +/*
  +* JBoss, Home of Professional Open Source
  +* Copyright 2005, JBoss Inc., and individual contributors as indicated
  +* by the @authors tag. See the copyright.txt in the distribution for a
  +* full listing of individual contributors.
  +*
  +* This is free software; you can redistribute it and/or modify it
  +* under the terms of the GNU Lesser General Public License as
  +* published by the Free Software Foundation; either version 2.1 of
  +* the License, or (at your option) any later version.
  +*
  +* This software is distributed in the hope that it will be useful,
  +* but WITHOUT ANY WARRANTY; without even the implied warranty of
  +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  +* Lesser General Public License for more details.
  +*
  +* You should have received a copy of the GNU Lesser General Public
  +* License along with this software; if not, write to the Free
  +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  +* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  +*/
  +package org.jboss.test.remoting.transport.http.timeout;
  +
  +import org.jboss.test.remoting.timeout.QuickDisconnectServerParent;
  +
  +/** 
  + * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  + * @version $Revision: 1.1.2.1 $
  + * <p>
  + * Copyright Feb 18, 2007
  + * </p>
  + */
  +public class HttpQuickDisconnectServer extends QuickDisconnectServerParent
  +{
  +   public static void main(String[] args)
  +   {
  +      try
  +      {
  +         HttpQuickDisconnectServer server = new HttpQuickDisconnectServer();
  +         server.setUp();
  +         Thread.sleep(100000);
  +      }
  +      catch (Exception e)
  +      {
  +         e.printStackTrace();
  +      }
  +   }
  +
  +   protected String getTransport()
  +   {
  +      return "http";
  +   }
  +}
  
  
  



More information about the jboss-cvs-commits mailing list