[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout ...
Tom Elrod
tom.elrod at jboss.com
Wed Jan 17 14:30:13 EST 2007
User: telrod
Date: 07/01/17 14:30:13
Modified: src/tests/org/jboss/test/remoting/transport/http/timeout
Tag: remoting_2_x TimeoutClientTest.java
TimeoutServerTest.java
Added: src/tests/org/jboss/test/remoting/transport/http/timeout
Tag: remoting_2_x ConnectionTimeoutTestCase.java
Log:
Updating http invoker client timeout tests (and including new one for connection timeout)
Revision Changes Path
No revision
No revision
1.3.4.1 +1 -0 JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/TimeoutClientTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TimeoutClientTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/TimeoutClientTest.java,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -u -b -r1.3 -r1.3.4.1
--- TimeoutClientTest.java 21 May 2006 04:47:32 -0000 1.3
+++ TimeoutClientTest.java 17 Jan 2007 19:30:13 -0000 1.3.4.1
@@ -50,6 +50,7 @@
catch(Throwable t)
{
System.out.println("Caught exception: " + t.getMessage());
+ t.printStackTrace();
end = System.currentTimeMillis();
}
1.1.8.1 +1 -0 JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/TimeoutServerTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TimeoutServerTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/TimeoutServerTest.java,v
retrieving revision 1.1
retrieving revision 1.1.8.1
diff -u -b -r1.1 -r1.1.8.1
--- TimeoutServerTest.java 10 Mar 2006 03:30:25 -0000 1.1
+++ TimeoutServerTest.java 17 Jan 2007 19:30:13 -0000 1.1.8.1
@@ -88,6 +88,7 @@
Object obj = invocation.getParameter();
if(obj instanceof String && "timeout".equals(obj))
{
+ System.out.println("server got 'timeout' invocation... sleeping 30 seconds.");
Thread.currentThread().sleep(30000);
}
return null; //TODO: -TME Implement
No revision
No revision
1.1.2.1 +68 -0 JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/timeout/Attic/ConnectionTimeoutTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConnectionTimeoutTestCase.java
===================================================================
RCS file: ConnectionTimeoutTestCase.java
diff -N ConnectionTimeoutTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ConnectionTimeoutTestCase.java 17 Jan 2007 19:30:13 -0000 1.1.2.1
@@ -0,0 +1,68 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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 junit.framework.TestCase;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ */
+public class ConnectionTimeoutTestCase extends TestCase
+{
+ private String locatorURI = "http://localhost:8899/?timeout=3000";
+
+ public void testTimeout() throws Exception
+ {
+ Client client = new Client(new InvokerLocator(locatorURI));
+ client.connect();
+
+ //test for client timeout
+ long start = System.currentTimeMillis();
+
+ long end = 0;
+
+ try
+ {
+ client.invoke("timeout");
+ end = System.currentTimeMillis();
+ }
+ catch(Throwable t)
+ {
+ System.out.println("Caught exception: " + t.getMessage());
+ t.printStackTrace();
+ end = System.currentTimeMillis();
+ }
+
+ long executionTime = end - start;
+ System.out.println("execution time was " + executionTime);
+ boolean timedOut = (executionTime < 10000);
+
+ String jdkVersion = System.getProperty("java.version");
+ if(!jdkVersion.startsWith("1.4") && !jdkVersion.startsWith("1.3"))
+ {
+ assertTrue("Socket did not timeout within expected time", timedOut);
+ }
+ }
+
+}
More information about the jboss-cvs-commits
mailing list