[jboss-cvs] JBoss Messaging SVN: r2215 - in branches/Branch_1_0_1_SP/tests: src/org/jboss/test and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 8 17:52:03 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-02-08 17:52:03 -0500 (Thu, 08 Feb 2007)
New Revision: 2215

Added:
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystem.java
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemServiceMBean.java
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/SimpleConnectionListener.java
   branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/TestableSubsystem.java
Modified:
   branches/Branch_1_0_1_SP/tests/build.xml
Log:
added infrastructure requried to independently test remoting

Modified: branches/Branch_1_0_1_SP/tests/build.xml
===================================================================
--- branches/Branch_1_0_1_SP/tests/build.xml	2007-02-08 21:48:55 UTC (rev 2214)
+++ branches/Branch_1_0_1_SP/tests/build.xml	2007-02-08 22:52:03 UTC (rev 2215)
@@ -354,6 +354,8 @@
                <exclude name="**/jms/MemLeakTest.class"/>
                <!-- TODO Exclude all distributed tests until after 1.0 release -->
                <exclude name="**/messaging/core/distributed/**/*Test.class"/>
+               <exclude name="**/thirdparty/remoting/CallbackServerTimeoutTest.class"/>
+               <exclude name="**/thirdparty/remoting/ClientInvokerTimeoutTest.class"/>
             </fileset>
          </batchtest>
       </junit>
@@ -536,6 +538,7 @@
                <include name="org/jboss/test/messaging/jms/JMSTest.class"/>
                -->
                <include name="org/jboss/test/messaging/jms/**/*Test.class"/>
+               <include name="**/thirdparty/**/*Test.class"/>
                <exclude name="org/jboss/test/messaging/jms/stress/**"/>
                <exclude name="org/jboss/test/messaging/jms/server/**"/>
                <exclude name="org/jboss/test/messaging/jms/persistence/**"/>

Added: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java	                        (rev 0)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java	2007-02-08 22:52:03 UTC (rev 2215)
@@ -0,0 +1,200 @@
+/**
+ * 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.logging.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Client;
+
+/**
+ * Tests for http://jira.jboss.org/jira/browse/JBMESSAGING-787,
+ * http://jira.jboss.org/jira/browse/JBREM-691. Test written entirely at the Remoting level. If
+ * fails with Remoting 2.2.0.Alpha6.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * @version <tt>$Revision: 2104 $</tt>
+ *
+ * $Id: ClientInvokerTimeoutTest.java 2104 2007-01-30 07:35:13Z ovidiu.feodorov at jboss.com $
+ */
+public class ClientInvokerTimeoutTest extends MessagingTestCase
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(ClientInvokerTimeoutTest.class);
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private InvokerLocator serverLocator;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public ClientInvokerTimeoutTest(String name)
+   {
+      super(name);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   /**
+    * A remoting client created for "business use" will throw an unexpected SocketTimeoutException
+    * after 1000 ms during a long invocation, even if it's not supposed to. If fails with Remoting
+    * 2.2.0.Alpha6.
+    */
+   public void testUnexpectedSocketTimeoutException() throws Throwable
+   {
+      // This test doesn't make sense for HTTP, so shortcut it
+
+      Client client = null;
+
+      try
+      {
+         client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL);
+
+         client.connect();
+
+         SimpleConnectionListener connListener = new SimpleConnectionListener();
+         client.addConnectionListener(connListener, 3333);
+
+         log.info("connection listener added, pinging will start in 3.3 secs");
+
+         Thread.sleep(5000);
+
+         log.info("first ping is done, send a long running invocation");
+
+         // in 2.2.0.Alpha6 the client will send the invocation over a socket configured to time
+         // out after 1000 ms, so this will throw java.net.SocketTimeoutException
+
+         client.invoke(new Long(5000));
+
+         Thread.sleep(7000);
+      }
+      finally
+      {
+         if (client != null)
+         {
+            client.disconnect();
+         }
+      }
+   }
+
+   /**
+    * Same as testUnexpectedSocketTimeoutException(), slightly different setup.
+    */
+   public void testUnexpectedSocketTimeoutException2() throws Throwable
+   {
+      Client client = null;
+
+      try
+      {
+         // create a "business" client
+
+         client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL);
+
+         client.connect();
+
+         final Client clientCopy = client;
+
+         // send a "long running" invocation first on a separate thread, so we can setup the
+         // connection validator at the same time
+
+         new Thread(new Runnable()
+         {
+            public void run()
+            {
+               try
+               {
+                  // this invocation will take 5 secs to complete
+                  clientCopy.invoke(new Long(5000));
+               }
+               catch(Throwable t)
+               {
+                  log.error("invocation failed", t);
+               }
+
+            }
+         }, "Lazy Invocation Thread").start();
+
+         Thread.sleep(1000);
+
+         SimpleConnectionListener connListener = new SimpleConnectionListener();
+         client.addConnectionListener(connListener, 3333);
+
+         log.info("connection listener added, pinging will start in 3.3 secs");
+
+         Thread.sleep(4000);
+
+         log.info("first ping is done, the answer to the first invocation should be back already");
+
+         // in 2.2.0.Alpha6 the client will send the invocation over a socket configured to time
+         // out after 1000 ms, so this will throw java.net.SocketTimeoutException
+
+         client.invoke(new Long(5000));
+
+         Thread.sleep(7000);
+
+      }
+      finally
+      {
+         if (client != null)
+         {
+            client.disconnect();
+         }
+      }
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      if (!isRemote())
+      {
+         fail("This test should be run in a remote configuration!");
+      }
+
+      ServerManagement.start("remoting");
+
+      // obtain the server locator from the service itself, so we won't have any doubts we use
+      // the right one
+
+      serverLocator = new InvokerLocator((String)ServerManagement.
+         getAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "InvokerLocator"));
+
+      // deploy a "lazy subsystem", that will delay invocations as long is it told to; used to
+      // simulate long running invocations
+
+      RemotingTestSubsystemService.
+         deployService("org.jboss.test.thirdparty.remoting.LazySubsystem");
+
+      log.debug("setup done");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      serverLocator = null;
+
+      ServerManagement.stop();
+
+      super.tearDown();
+   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}


Property changes on: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/ClientInvokerTimeoutTest.java
___________________________________________________________________
Name: svn:keywords
   + "Id LastChangedDate Author Revision"

Added: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystem.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystem.java	                        (rev 0)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystem.java	2007-02-08 22:52:03 UTC (rev 2215)
@@ -0,0 +1,145 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.thirdparty.remoting.util;
+
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.logging.Logger;
+
+import javax.management.MBeanServer;
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import EDU.oswego.cs.dl.util.concurrent.Channel;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2098 $</tt>
+ *
+ * $Id: RemotingTestSubsystem.java 2098 2007-01-30 07:21:00Z ovidiu.feodorov at jboss.com $
+ */
+public class RemotingTestSubsystem
+   implements TestableSubsystem, ServerInvocationHandler, Serializable
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final long serialVersionUID = 5457454557215715L;
+
+   private static final Logger log = Logger.getLogger(RemotingTestSubsystem.class);
+
+   // Static ---------------------------------------------------------------------------------------
+
+   /**
+    * Very quick and dirty method. Don't try it at home. Needed it because some InvocationRequests
+    * (even if the class is declared Serializable) contain request and response payloads which are
+    * not, so I am having trouble sending them over wire back to the client.
+    */
+   private static InvocationRequest dirtyCopy(InvocationRequest source)
+   {
+      return new InvocationRequest(source.getSessionId(),
+                                   source.getSubsystem(),
+                                   source.getParameter(),
+                                   null,
+                                   null,
+                                   source.getLocator());
+   }
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private Channel invocationHistory;
+   private List callbackListeners;
+
+   private boolean failed;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public RemotingTestSubsystem()
+   {
+      invocationHistory = new LinkedQueue();
+      callbackListeners = new ArrayList();
+      failed = false;
+   }
+
+   // ServerInvocationHandler implementation -------------------------------------------------------
+
+   public void setMBeanServer(MBeanServer server)
+   {
+   }
+
+   public void setInvoker(ServerInvoker invoker)
+   {
+   }
+
+   public Object invoke(InvocationRequest invocation) throws Throwable
+   {
+      log.debug(this + " received " + invocation);
+
+      final Object parameter = invocation.getParameter();
+
+      if ("ignore".equals(parameter))
+      {
+         // used in stress tests, do not accumulate record the invocation in history, since the
+         // client is goint to send a lot of them ....
+         log.debug(this + " ignoring invocation");
+         return null;
+      }
+
+      invocationHistory.put(dirtyCopy(invocation));
+
+      return null;
+   }
+
+   public void addListener(InvokerCallbackHandler callbackHandler)
+   {
+      synchronized(callbackListeners)
+      {
+         callbackListeners.add(callbackHandler);
+      }
+   }
+
+   public void removeListener(InvokerCallbackHandler callbackHandler)
+   {
+      synchronized(callbackListeners)
+      {
+         callbackListeners.remove(callbackHandler);
+      }
+   }
+
+   // TestableSubsystem implementation ----------------------------------------------------------
+
+   public InvocationRequest getNextInvocation(long timeout) throws InterruptedException
+   {
+      return (InvocationRequest)invocationHistory.poll(timeout);
+   }
+
+   public boolean isFailed()
+   {
+      synchronized (this)
+      {
+         return failed;
+      }
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public String toString()
+   {
+      return "RemotingTestSubsystem[" + Integer.toHexString(hashCode()) + "]";
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+}


Property changes on: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystem.java
___________________________________________________________________
Name: svn:keywords
   + "Id LastChangedDate Author Revision"

Added: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java	                        (rev 0)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java	2007-02-08 22:52:03 UTC (rev 2215)
@@ -0,0 +1,190 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.thirdparty.remoting.util;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.messaging.tools.jmx.ServiceContainer;
+import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.remoting.InvocationRequest;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.MBeanRegistration;
+import java.lang.reflect.Constructor;
+
+/**
+ * A standard MBean service to be used when testing remoting.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2098 $</tt>
+ *
+ * $Id: RemotingTestSubsystemService.java 2098 2007-01-30 07:21:00Z ovidiu.feodorov at jboss.com $
+ */
+public class RemotingTestSubsystemService
+   implements MBeanRegistration, RemotingTestSubsystemServiceMBean
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(RemotingTestSubsystemService.class);
+
+   public static final String SUBSYSTEM_LABEL = "TEST_SUBSYSTEM";
+
+   // Static ---------------------------------------------------------------------------------------
+
+   public static ObjectName deployService() throws Exception
+   {
+      return deployService("org.jboss.test.thirdparty.remoting.util.RemotingTestSubsystem");
+   }
+
+   public static ObjectName deployService(String subsystemClassName) throws Exception
+   {
+      String testSubsystemConfig =
+         "<mbean code=\"org.jboss.test.thirdparty.remoting.util.RemotingTestSubsystemService\"\n" +
+            " name=\"test:service=RemotingTestSubsystem\">\n" +
+            "<attribute name=\"SubsystemClassName\">" + subsystemClassName + "</attribute>" +
+         "</mbean>";
+
+      ObjectName on = ServerManagement.deploy(testSubsystemConfig);
+      ServerManagement.invoke(on, "start", new Object[0], new String[0]);
+
+      return on;
+   }
+
+   public static void undeployService(ObjectName on) throws Exception
+   {
+      ServerManagement.invoke(on, "stop", new Object[0], new String[0]);
+      ServerManagement.undeploy(on);
+   }
+
+   public static InvocationRequest getNextInvocationFromServer(ObjectName on, long timeout)
+      throws Exception
+   {
+      return (InvocationRequest)ServerManagement.
+         invoke(on, "nextInvocation",
+                new Object[] { new Long(timeout) },
+                new String[] { "java.lang.Long" });
+   }
+
+   public static boolean isFailed(ObjectName on)
+      throws Exception
+   {
+      return ((Boolean)ServerManagement.
+         invoke(on, "isFailed", null, null)).booleanValue();
+   }
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private MBeanServer mbeanServer;
+   private ObjectName myObjectName;
+
+   private String subsystemClassName;
+   private TestableSubsystem delegate;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   // MBeanRegistration implementation -------------------------------------------------------------
+
+   public ObjectName preRegister(MBeanServer mbeanServer, ObjectName objectName) throws Exception
+   {
+      this.mbeanServer = mbeanServer;
+      this.myObjectName = objectName;
+      return objectName;
+   }
+
+   public void postRegister(Boolean b)
+   {
+      // noop
+   }
+
+   public void preDeregister() throws Exception
+   {
+      // noop
+   }
+
+   public void postDeregister()
+   {
+      // noop
+   }
+
+   // RemotingTestSubsystemServiceMBean implementation ---------------------------------------------
+
+   public String getSubsystemClassName()
+   {
+      return subsystemClassName;
+   }
+
+   public void setSubsystemClassName(String className)
+   {
+      this.subsystemClassName = className;
+   }
+
+   public void start() throws Exception
+   {
+      Class c = Class.forName(subsystemClassName);
+      Constructor cons = c.getConstructor(new Class[0]);
+
+      delegate = (TestableSubsystem)cons.newInstance(new Object[0]);
+
+      // register to the remoting connector
+
+      mbeanServer.invoke(ServiceContainer.REMOTING_OBJECT_NAME,
+                         "addInvocationHandler",
+                         new Object[] {SUBSYSTEM_LABEL, delegate},
+                         new String[] {"java.lang.String",
+                            "org.jboss.remoting.ServerInvocationHandler"});
+
+      log.debug(myObjectName + " started");
+   }
+
+   public void stop()
+   {
+      try
+      {
+         // unregister from the remoting connector
+
+         mbeanServer.invoke(ServiceContainer.REMOTING_OBJECT_NAME,
+                            "removeInvocationHandler",
+                            new Object[] {SUBSYSTEM_LABEL},
+                            new String[] {"java.lang.String"});
+      }
+      catch(Exception e)
+      {
+         log.error("Cannot deinstall remoting subsystem", e);
+      }
+
+      delegate = null;
+
+      log.debug(myObjectName + " stopped");
+   }
+
+   public InvocationRequest nextInvocation(Long timeout) throws Exception
+   {
+      if (delegate == null)
+      {
+         return null;
+      }
+
+      return delegate.getNextInvocation(timeout.longValue());
+
+   }
+
+   public boolean isFailed() throws Exception
+   {
+      return delegate.isFailed();
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}


Property changes on: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemService.java
___________________________________________________________________
Name: svn:keywords
   + "Id LastChangedDate Author Revision"

Added: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemServiceMBean.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemServiceMBean.java	                        (rev 0)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemServiceMBean.java	2007-02-08 22:52:03 UTC (rev 2215)
@@ -0,0 +1,27 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.thirdparty.remoting.util;
+
+import org.jboss.remoting.InvocationRequest;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2098 $</tt>
+ * $Id: RemotingTestSubsystemServiceMBean.java 2098 2007-01-30 07:21:00Z ovidiu.feodorov at jboss.com $
+ */
+public interface RemotingTestSubsystemServiceMBean
+{
+   String getSubsystemClassName();
+   void setSubsystemClassName(String className);
+   
+   void start() throws Exception;
+   void stop();
+
+   InvocationRequest nextInvocation(Long timeout) throws Exception;
+   
+   boolean isFailed() throws Exception;
+}


Property changes on: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/RemotingTestSubsystemServiceMBean.java
___________________________________________________________________
Name: svn:keywords
   + "Id LastChangedDate Author Revision"

Added: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/SimpleConnectionListener.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/SimpleConnectionListener.java	                        (rev 0)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/SimpleConnectionListener.java	2007-02-08 22:52:03 UTC (rev 2215)
@@ -0,0 +1,77 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.thirdparty.remoting.util;
+
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.Client;
+
+import java.io.Serializable;
+
+import EDU.oswego.cs.dl.util.concurrent.Channel;
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+
+/**
+ * It is Serializable so it can be used both on client and on server.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2013 $</tt>
+ *
+ * $Id: SimpleConnectionListener.java 2013 2007-01-21 10:36:24Z ovidiu.feodorov at jboss.com $
+ */
+public class SimpleConnectionListener implements ConnectionListener, Serializable
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final long serialVersionUID = 5457454557215716L;
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   private transient Channel failures;
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   // ConnectionListener implementation -----------------------------------------------------------
+
+   public void handleConnectionException(Throwable throwable, Client client)
+   {
+      init();
+      try
+      {
+         failures.put(throwable);
+      }
+      catch(InterruptedException e)
+      {
+         throw new RuntimeException("Failed to record failure", e);
+      }
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public Throwable getNextFailure(long timeout) throws InterruptedException
+   {
+      init();
+      return (Throwable)failures.poll(timeout);
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   // Private --------------------------------------------------------------------------------------
+
+   private synchronized void init()
+   {
+      if (failures == null)
+      {
+         failures = new LinkedQueue();
+      }
+   }
+
+   // Inner classes --------------------------------------------------------------------------------
+}


Property changes on: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/SimpleConnectionListener.java
___________________________________________________________________
Name: svn:keywords
   + "Id LastChangedDate Author Revision"

Added: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/TestableSubsystem.java
===================================================================
--- branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/TestableSubsystem.java	                        (rev 0)
+++ branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/TestableSubsystem.java	2007-02-08 22:52:03 UTC (rev 2215)
@@ -0,0 +1,21 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.test.thirdparty.remoting.util;
+
+import org.jboss.remoting.InvocationRequest;
+
+/**
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2098 $</tt>
+ * $Id: TestableSubsystem.java 2098 2007-01-30 07:21:00Z ovidiu.feodorov at jboss.com $
+ */
+public interface TestableSubsystem
+{
+   InvocationRequest getNextInvocation(long timeout) throws InterruptedException;
+
+   boolean isFailed();
+}


Property changes on: branches/Branch_1_0_1_SP/tests/src/org/jboss/test/thirdparty/remoting/util/TestableSubsystem.java
___________________________________________________________________
Name: svn:keywords
   + "Id LastChangedDate Author Revision"




More information about the jboss-cvs-commits mailing list