[jboss-cvs] JBoss Messaging SVN: r2015 - in trunk/tests: src/org/jboss/test/thirdparty/remoting and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jan 21 06:17:40 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-01-21 06:17:40 -0500 (Sun, 21 Jan 2007)
New Revision: 2015

Added:
   trunk/tests/src/org/jboss/test/thirdparty/remoting/ManualConnectionValidatorTest.java
Modified:
   trunk/tests/build.xml
Log:
added a 'manual' connection validator test, which sends a lot of pings at a very high rate. Can be used with netstat to see if remoting leaks sockets

Modified: trunk/tests/build.xml
===================================================================
--- trunk/tests/build.xml	2007-01-21 10:53:10 UTC (rev 2014)
+++ trunk/tests/build.xml	2007-01-21 11:17:40 UTC (rev 2015)
@@ -352,10 +352,10 @@
    <target name="tests" depends="tests-jar, prepare-testdirs, clear-test-logs">
     <antcall target="crash-tests"/>
       <antcall target="invm-tests"/>
-      <antcall target="remote-tests"/>  <!-- default remoting configuration (socket) -->
+      <antcall target="remote-tests"/>  <!-- default remoting configuration (socket) -->        <!--
       <antcall target="remote-tests">
          <param name="test.remoting" value="http"/>
-      </antcall>
+      </antcall>                                                                                 -->
       <antcall target="clustering-tests"/>
    </target>
 

Added: trunk/tests/src/org/jboss/test/thirdparty/remoting/ManualConnectionValidatorTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/ManualConnectionValidatorTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/ManualConnectionValidatorTest.java	2007-01-21 11:17:40 UTC (rev 2015)
@@ -0,0 +1,107 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.thirdparty.remoting;
+
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.jmx.ServiceContainer;
+import org.jboss.test.thirdparty.remoting.util.RemotingTestSubsystemService;
+import org.jboss.test.thirdparty.remoting.util.SimpleConnectionListener;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.CannotConnectException;
+
+import javax.management.ObjectName;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * This test sets the connection validator ping period to a very small value, and then let the
+ * client ping for a long time. To be used with netstat to see if it creates new sockets for each
+ * invocation.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class ManualConnectionValidatorTest extends MessagingTestCase
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private InvokerLocator serverLocator;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public ManualConnectionValidatorTest(String name)
+   {
+      super(name);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public void testLotsOfPings() throws Throwable
+   {
+      if (!isRemote())
+      {
+         fail("This test should be run in a remote configuration!");
+      }
+
+      Client client = new Client(serverLocator);
+
+      client.connect();
+
+      SimpleConnectionListener connListener = new SimpleConnectionListener();
+      client.addConnectionListener(connListener, 50);
+
+      assertEquals(50, client.getPingPeriod());
+
+      // let it ping for a while
+
+      log.info("pinging for 60 seconds with a rate of a ping per 50 ms ...");
+      Thread.sleep(60000);
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      ServerManagement.start(0, "remoting", null, true, false);
+
+      String s = (String)ServerManagement.
+         getAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "InvokerLocator");
+
+      serverLocator = new InvokerLocator(s);
+
+   }
+
+   protected void tearDown() throws Exception
+   {
+      serverLocator = null;
+
+      if (ServerManagement.isStarted(0))
+      {
+         ServerManagement.stop(0);
+      }
+
+      super.tearDown();
+   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}


Property changes on: trunk/tests/src/org/jboss/test/thirdparty/remoting/ManualConnectionValidatorTest.java
___________________________________________________________________
Name: svn:keywords
   + Id LastChangedDate Author Revision




More information about the jboss-cvs-commits mailing list