[jboss-cvs] JBoss Messaging SVN: r1992 - in trunk/tests: src/org/jboss/test/messaging/tools and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 19 01:28:03 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-01-19 01:28:02 -0500 (Fri, 19 Jan 2007)
New Revision: 1992

Added:
   trunk/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java
Modified:
   trunk/tests/bin/runtest
   trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java
   trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
   trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java
Log:
- Added the possibility of debuging spwawned test servers:
  runtest -remote -remotedebug <server_index>
  This was possible so far only for remote servers started by the start-rmi-server script.
- Added the possibility of having a choice wheter or not to start the Messaging server
  within the ServiceContainer:
  ServerManagement.start(index, config, attrOverrides, clearDatabase, START_MESSAGING_SERVER)
 


Modified: trunk/tests/bin/runtest
===================================================================
--- trunk/tests/bin/runtest	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/bin/runtest	2007-01-19 06:28:02 UTC (rev 1992)
@@ -146,25 +146,25 @@
 if [ "$remote_debug" = "true" ]; then
    if [ "$remote_debug_index" = "" ]; then
       REMOTE_DEBUG_FLAG_0="-debug"
+      JAVA_OPTS="$JAVA_OPTS -Dtest.remote.debug.index=0"
    elif [ "$remote_debug_index" = "1" ]; then
       REMOTE_DEBUG_FLAG_1="-debug"
+      JAVA_OPTS="$JAVA_OPTS -Dtest.remote.debug.index=1"
    elif [ "$remote_debug_index" = "2" ]; then
       REMOTE_DEBUG_FLAG_2="-debug"
+      JAVA_OPTS="$JAVA_OPTS -Dtest.remote.debug.index=2"
    elif [ "$remote_debug_index" = "3" ]; then
       REMOTE_DEBUG_FLAG_3="-debug"
+      JAVA_OPTS="$JAVA_OPTS -Dtest.remote.debug.index=3"
    else
       echo "Invalid argument: $remote_debug_index"
       exit 1
    fi
 fi
 
-
-
-
 $JAVA_HOME/bin/java $JAVA_OPTS -cp "$CLASSPATH" \
 org.jboss.test.messaging.tools.junit.SelectiveTestRunner $TARGET_CLASS $TARGET_TEST
 
-
 #
 # stop the servers in the reverse order
 #

Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -181,23 +181,32 @@
       start(i, config, null, clearDatabase);
    }
 
+   public static void start(int i, String config,
+                            ServiceAttributeOverrides attrOverrides,
+                            boolean clearDatabase) throws Exception
+   {
+      start(i, config, attrOverrides, clearDatabase, true);
+   }
+
    /**
     * When this method correctly completes, the server (local or remote) is started and fully
-    * operational (the service container and the server peer are created and started)
+    * operational (the service container and the server peer are created and started).
     */
    public static synchronized void start(int i, String config,
                                          ServiceAttributeOverrides attrOverrides,
-                                         boolean clearDatabase) throws Exception
+                                         boolean clearDatabase,
+                                         boolean startMessagingServer) throws Exception
    {
       Server s = create(i);
 
       log.info("starting server " + i);
 
-      s.start(config, attrOverrides, clearDatabase);
+      s.start(config, attrOverrides, clearDatabase, startMessagingServer);
 
       log.info("server " + i + " started");
    }
 
+
    public static synchronized boolean isStarted(int i)
    {
       if (servers[i] == null)
@@ -348,6 +357,17 @@
 
       sb.append("-Xmx512M").append(' ');
 
+
+      String remoteDebugIndex = System.getProperty("test.remote.debug.index");
+      if (remoteDebugIndex != null)
+      {
+         int index = Integer.parseInt(remoteDebugIndex);
+
+         sb.append("-Xdebug -Xnoagent -Djava.compiler=NONE ").
+            append("-Xrunjdwp:transport=dt_shmem,server=n,suspend=n,address=rmiserver_").
+            append(index).append(' ');
+      }
+
       String moduleOutput = System.getProperty("module.output");
       if (moduleOutput == null)
       {

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -414,12 +414,12 @@
 
          loadJNDIContexts();
 
+         log.debug("loaded JNDI context");
+
          // aways install multiplexer as this is a cheap operation. The actual JChannels are started
          // only on demand
          startMultiplexer();
 
-         log.debug("loaded JNDI context");
-
          String transport = config.getRemotingTransport();
 
          log.info("Remoting type: ........... " + (remoting ? transport : "DISABLED"));

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -63,11 +63,11 @@
  */
 public class LocalTestServer implements Server
 {
-   // Constants -----------------------------------------------------
+   // Constants ------------------------------------------------------------------------------------
 
    private static final Logger log = Logger.getLogger(LocalTestServer.class);
 
-   // Static --------------------------------------------------------
+   // Static ---------------------------------------------------------------------------------------
 
    public static void setEnvironmentServerIndex(int serverIndex)
    {
@@ -79,7 +79,7 @@
       System.getProperty(Constants.SERVER_INDEX_PROPERTY_NAME, null);
    }
 
-   // Attributes ----------------------------------------------------
+   // Attributes -----------------------------------------------------------------------------------
 
    private ServiceContainer sc;
 
@@ -96,7 +96,7 @@
 
    private int serverIndex;
 
-   // Constructors --------------------------------------------------
+   // Constructors ---------------------------------------------------------------------------------
 
    public LocalTestServer()
    {
@@ -112,7 +112,7 @@
       this.serverIndex = serverIndex;
    }
 
-   // Server implementation -----------------------------------------
+   // Server implementation ------------------------------------------------------------------------
 
    public int getServerID()
    {
@@ -122,12 +122,13 @@
    public void start(String containerConfig,
                      boolean clearDatabase) throws Exception
    {
-      start(containerConfig, null, clearDatabase);
+      start(containerConfig, null, clearDatabase, true);
    }
 
    public synchronized void start(String containerConfig,
                                   ServiceAttributeOverrides attrOverrides,
-                                  boolean clearDatabase) throws Exception
+                                  boolean clearDatabase,
+                                  boolean startMessagingServer) throws Exception
    {
       if (isStarted())
       {
@@ -153,7 +154,10 @@
             return;
          }
 
-         startServerPeer(serverIndex, null, null, attrOverrides, sc.isClustered());
+         if (startMessagingServer)
+         {
+            startServerPeer(serverIndex, null, null, attrOverrides, sc.isClustered());
+         }
 
          log.info("Server " + serverIndex + " started");
       }
@@ -432,6 +436,12 @@
 
    public void stopServerPeer() throws Exception
    {
+      if (!isServerPeerStarted())
+      {
+         log.debug("messaging server was no started, so there is no stopping");
+         return;
+      }
+
       try
       {
          // if we don't find a ServerPeer instance registered under the serverPeerObjectName
@@ -884,18 +894,18 @@
       PoisonInterceptor.setType(type);
    }
 
-   // Public --------------------------------------------------------
+   // Public ---------------------------------------------------------------------------------------
 
-   // Package protected ---------------------------------------------
+   // Package protected ----------------------------------------------------------------------------
 
    ServiceContainer getServiceContainer()
    {
       return sc;
    }
 
-   // Protected -----------------------------------------------------
+   // Protected ------------------------------------------------------------------------------------
 
-   // Private -------------------------------------------------------
+   // Private --------------------------------------------------------------------------------------
 
    private void overrideAttributes(ObjectName on, ServiceAttributeOverrides attrOverrides)
       throws Exception
@@ -917,6 +927,6 @@
       }
    }
 
-   // Inner classes -------------------------------------------------
+   // Inner classes --------------------------------------------------------------------------------
 
 }

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -142,13 +142,13 @@
 
    public void start(String containerConfig, boolean clearDatabase) throws Exception
    {
-      start(containerConfig, null, clearDatabase);
+      start(containerConfig, null, clearDatabase, true);
    }
 
    public void start(String containerConfig, ServiceAttributeOverrides attrOverrides,
-                     boolean clearDatabase) throws Exception
+                     boolean clearDatabase, boolean startMessagingServer) throws Exception
    {
-      server.start(containerConfig, attrOverrides, clearDatabase);
+      server.start(containerConfig, attrOverrides, clearDatabase, startMessagingServer);
    }
 
    public boolean stop() throws Exception

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RemoteTestServer.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -74,7 +74,6 @@
    {
       throw new UnsupportedOperationException("This method shouldn't be invoked on a remote server");      
    }
-   
 
    // Public ---------------------------------------------------------------------------------------
     
@@ -84,8 +83,6 @@
 
    // Private --------------------------------------------------------------------------------------
 
-
    // Inner classes --------------------------------------------------------------------------------
-
    
 }

Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -56,7 +56,8 @@
     */
    void start(String containerConfig,
               ServiceAttributeOverrides attrOverrides,
-              boolean clearDatabase) throws Exception;
+              boolean clearDatabase,
+              boolean startMessgingServer) throws Exception;
 
    /**
     * @return true if the server was stopped indeed, or false if the server was stopped already

Added: trunk/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/PureAsynchronousCallTest.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -0,0 +1,97 @@
+/**
+ * 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.logging.Logger;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.ConnectionListener;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+
+import javax.naming.InitialContext;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Message;
+import javax.jms.TextMessage;
+import javax.jms.MessageListener;
+import javax.management.MBeanServer;
+
+import EDU.oswego.cs.dl.util.concurrent.Slot;
+
+/**
+ * A test case in which we play with "pure" remoting asynchronous calls.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class PureAsynchronousCallTest extends MessagingTestCase
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   private static final Logger log = Logger.getLogger(PureAsynchronousCallTest.class);
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public PureAsynchronousCallTest(String name)
+   {
+      super(name);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public void testPureAsynchronousCall() throws Exception
+   {
+      if (!isRemote())
+      {
+         fail("This test should be run in a remote configuration!");
+      }
+
+      log.debug("I am here");
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      ServerManagement.start(0, "remoting", null, true, false);
+
+      log.debug("setup done");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      ServerManagement.stop();
+
+      super.tearDown();
+   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}


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

Modified: trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java	2007-01-19 05:18:33 UTC (rev 1991)
+++ trunk/tests/src/org/jboss/test/thirdparty/remoting/RemotingTest.java	2007-01-19 06:28:02 UTC (rev 1992)
@@ -57,25 +57,25 @@
  */
 public class RemotingTest extends MessagingTestCase
 {
-   // Constants -----------------------------------------------------
+   // Constants ------------------------------------------------------------------------------------
 
    private static final Logger log = Logger.getLogger(RemotingTest.class);
 
-   // Static --------------------------------------------------------
+   // Static ---------------------------------------------------------------------------------------
 
-   // Attributes ----------------------------------------------------
+   // Attributes -----------------------------------------------------------------------------------
 
    InitialContext ic;
    private boolean connListenerCalled;
 
-   // Constructors --------------------------------------------------
+   // Constructors ---------------------------------------------------------------------------------
 
    public RemotingTest(String name)
    {
       super(name);
    }
 
-   // Public --------------------------------------------------------
+   // Public ---------------------------------------------------------------------------------------
 
    public void testInvokerThreadSafety() throws Exception
    {
@@ -250,9 +250,9 @@
 
 
 
-   // Package protected ---------------------------------------------
+   // Package protected ----------------------------------------------------------------------------
 
-   // Protected -----------------------------------------------------
+   // Protected ------------------------------------------------------------------------------------
 
    protected void setUp() throws Exception
    {
@@ -277,9 +277,9 @@
       super.tearDown();
    }
 
-   // Private -------------------------------------------------------
+   // Private --------------------------------------------------------------------------------------
 
-   // Inner classes -------------------------------------------------
+   // Inner classes --------------------------------------------------------------------------------
 
 
    class Invoker implements Runnable




More information about the jboss-cvs-commits mailing list