[jboss-cvs] JBoss Messaging SVN: r1683 - in branches/Branch_Client_Failover_Experiment/tests: bin etc src/org/jboss/test/messaging/jms/crash src/org/jboss/test/messaging/tools src/org/jboss/test/messaging/tools/jmx src/org/jboss/test/messaging/tools/jmx/rmi

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Dec 2 00:55:09 EST 2006


Author: ovidiu.feodorov at jboss.com
Date: 2006-12-02 00:55:02 -0500 (Sat, 02 Dec 2006)
New Revision: 1683

Modified:
   branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example
   branches/Branch_Client_Failover_Experiment/tests/bin/runtest
   branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server
   branches/Branch_Client_Failover_Experiment/tests/etc/container.xml
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
   branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
Log:
Enabling test framework to take clustering mode from container.xml/test.clustered

Modified: branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/bin/.testrc.example	2006-12-02 05:55:02 UTC (rev 1683)
@@ -13,8 +13,16 @@
 # (the database configuration definition MUST exist in tests/etc/container.xml)
 #
 TEST_DATABASE=hsqldb
+
 #
+# Each test can be run in clustered or non-clustered mode. However, setting CLUSTERED to "true"
+# doesn't guarantee that the test will be actually run in clustered mode, the test database must
+# be also permitting sharing over a LAN. "mysql" allows this, "hsqldb" doesn't. The test will
+# quickly fail in such a situation.
 #
+CLUSTERED=true
+#
+#
 # util
 #
 #TARGET_CLASS=org.jboss.test.messaging.util.SelectiveIteratorTest

Modified: branches/Branch_Client_Failover_Experiment/tests/bin/runtest
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/bin/runtest	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/bin/runtest	2006-12-02 05:55:02 UTC (rev 1683)
@@ -21,6 +21,7 @@
 
 ENV_TEST_DATABASE=$TEST_DATABASE
 ENV_TEST_SERIALIZATION=$TEST_SERIALIZATION
+ENV_TEST_CLUSTERED=$TEST_CLUSTERED
 
 if [ -z "$TARGET_CLASS" -a -f $reldir/.testrc ]; then
    . $reldir/.testrc
@@ -37,7 +38,11 @@
 if [ "$ENV_TEST_SERIALIZATION" != "" ]; then
    TEST_SERIALIZATION=$ENV_TEST_SERIALIZATION
 fi
+if [ "$ENV_TEST_CLUSTERED" != "" ]; then
+   TEST_CLUSTERED=$ENV_TEST_CLUSTERED
+fi
 
+
 #
 # We should use the same test execution classpath as the ant <junit> task, so we run ant to get
 # it from there.
@@ -94,14 +99,14 @@
     shift
 done
 
-JAVA_OPTS="-Xmx1024M $JAVA_OPTS -Dmodule.output=$reldir/../output $REMOTE_TEST -Dtest.database=$TEST_DATABASE -Dtest.serialization=$TEST_SERIALIZATION -Dbuild.lib=../../output/lib"
+JAVA_OPTS="-Xmx1024M $JAVA_OPTS -Dmodule.output=$reldir/../output $REMOTE_TEST -Dtest.database=$TEST_DATABASE -Dtest.serialization=$TEST_SERIALIZATION -Dtest.clustered=$TEST_CLUSTERED -Dbuild.lib=../../output/lib"
 
 if [ "$TARGET_TEST" != "" ]; then
    TARGET_TEST="-t $TARGET_TEST"
 fi
 
 if [ "$isRemote" = "true" ]; then
-  export TEST_DATABASE TEST_SERIALIZATION
+  export TEST_DATABASE TEST_SERIALIZATION TEST_CLUSTERED
   $reldir/start-rmi-server $REMOTE_DEBUG_FLAG -use-existent-test-classpath-file
 fi
 

Modified: branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/bin/start-rmi-server	2006-12-02 05:55:02 UTC (rev 1683)
@@ -45,6 +45,11 @@
    JAVA_OPTS="$JAVA_OPTS -Dtest.serialization=$TEST_SERIALIZATION"
 fi
 
+if [ "$TEST_CLUSTERED" != "" ]; then
+   JAVA_OPTS="$JAVA_OPTS -Dtest.clustered=$TEST_CLUSTERED"
+fi
+
+
 if [ "$USE_EXISTENT_TEST_CLASSPATH_FILE" = "true" ]; then
    CLASSPATH_FILE="$reldir/.test.execution.classpath"
 else

Modified: branches/Branch_Client_Failover_Experiment/tests/etc/container.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/etc/container.xml	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/etc/container.xml	2006-12-02 05:55:02 UTC (rev 1683)
@@ -68,6 +68,17 @@
 
    <serialization-type>jms</serialization-type>
 
+
+   <!--
+      Specifies whether to start a clustered messaging server or not. If "test.clustered" is set,
+      the value of the system property takes precedence. Supported values are "true" or "false".
+
+      Setting "clustered" to "true" doesn't guarantee that the test will be actually run in
+      clustered mode, the test database must be also permitting sharing over a LAN. "mysql" allows
+      this, "hsqldb" doesn't. The test will quickly fail in such a situation.
+   -->
+   <clustered>true</clustered>
+
 </container>
 
 

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -73,7 +73,7 @@
       localServer = new LocalTestServer();
       
       //Start all the services locally
-      localServer.start("all", false);
+      localServer.start("all");
             
       localServer.deployQueue("Queue", null, false);
            

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -73,7 +73,7 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all", false);
+      localServer.start("all");
 
       localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "30000");
        

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -73,7 +73,7 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all", false);
+      localServer.start("all");
 
       //Set lease period to -1 --> this should disable leasing so the state won't be cleared up
       

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -73,7 +73,7 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all", false);
+      localServer.start("all");
 
       // This crash test is relying on a precise value of LeaseInterval, so we don't rely on
       // the default, whatever that is ...

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -75,7 +75,7 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all", false);
+      localServer.start("all");
 
       // This crash test is relying on a precise value of LeaseInterval, so we don't rely on
       // the default, whatever that is ...

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -73,7 +73,7 @@
       localServer = new LocalTestServer();
       
       // Start all the services locally
-      localServer.start("all", false);
+      localServer.start("all");
 
       //Set lease period to 0 --> this should disable leasing so the state won't be cleared up
       

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -138,10 +138,10 @@
    
    public static synchronized void start(String config) throws Exception
    {
-      start(config, 0, false);
+      start(config, 0);
    }
 
-   public static synchronized void start(String config, int index, boolean clustered) throws Exception
+   public static synchronized void start(String config, int index) throws Exception
    {
       create(index);
 
@@ -156,8 +156,8 @@
       
       MessageIdGeneratorFactory.instance.clear();      
 
-      //Now start the server
-      servers[index].start(config, clustered);
+      // Now start the server
+      servers[index].start(config);
 
       log.debug("server started");
    }

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -372,10 +372,13 @@
 
          loadJNDIContexts();
 
-         log.info("remoting = \"" +
-            (remotingSocket ? "socket" : (remotingMultiplex ? "multiplex" : "disabled")) + "\", " +
-            "serialization = \"" + "jms" + "\", " + 
-            "database = \"" + getDatabaseType() + "\"");
+         log.info("REMOTING TYPE: ........... " +
+            (remotingSocket ? "socket" : (remotingMultiplex ? "multiplex" : "disabled")));
+         log.info("SERIALIZATION TYPE: ...... " + config.getSerializationType());
+         log.info("DATABASE: ................ " + config.getDatabaseType());
+         log.info("CLUSTERING MODE: ......... " +
+            (config.isClustered() ? "CLUSTERED" : "NON-CLUSTERED"));
+
          log.debug(this + " started");
       }
       catch(Throwable e)
@@ -747,6 +750,11 @@
       return config.getDatabaseType();
    }
 
+   public boolean isClustered()
+   {
+      return config.isClustered();
+   }
+
    public String toString()
    {
       return "ServiceContainer[" + Integer.toHexString(hashCode()) + "]";

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainerConfiguration.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -29,6 +29,8 @@
 {
    // Constants -----------------------------------------------------
 
+   public static final boolean DEFAULT_CLUSTERED_MODE = false;
+
    // Static --------------------------------------------------------
 
    public static String getHypersonicDatabase(String connectionURL)
@@ -74,6 +76,7 @@
    private String database;
    private Map dbConfigurations;
    private String serializationType;
+   private Boolean clusteredMode;
 
    // Constructors --------------------------------------------------
 
@@ -140,6 +143,14 @@
       return serializationType;
    }
 
+   /**
+    * @return the clustered mode in which the container should run an individual test.
+    */
+   public boolean isClustered()
+   {
+      return clusteredMode.booleanValue();
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
@@ -151,6 +162,7 @@
       Reader reader = new InputStreamReader(is);
       String currentDatabase = null;
       String currentSerializationType = null;
+      boolean currentClusteredMode = DEFAULT_CLUSTERED_MODE;
 
       try
       {
@@ -189,6 +201,10 @@
                {
                   currentSerializationType = XMLUtil.getTextContent(n);
                }
+               else if ("clustered".equals(name))
+               {
+                  currentClusteredMode = Boolean.getBoolean(XMLUtil.getTextContent(n));
+               }
                else
                {
                   throw new Exception("Unexpected child <" + name + "> of node " +
@@ -199,6 +215,7 @@
 
          setCurrentDatabase(currentDatabase);
          setCurrentSerializationType(currentSerializationType);
+         setCurrentClusteredMode(currentClusteredMode);
       }
       finally
       {
@@ -220,8 +237,8 @@
    }
 
    /**
-    * Always the value of "test.serialization" system property takes precedence over the c
-    * onfiguration file value.
+    * Always the value of "test.serialization" system property takes precedence over the
+    * configuration file value.
     */
    private void setCurrentSerializationType(String xmlConfigSerializationType)
    {
@@ -232,6 +249,24 @@
       }
    }
 
+   /**
+    * Always the value of "test.clustered" system property takes precedence over the configuration
+    * file value.
+    */
+   private void setCurrentClusteredMode(boolean xmlClusteredMode) throws Exception
+   {
+      String s = System.getProperty("test.clustered");
+      if (s != null)
+      {
+         clusteredMode = Boolean.valueOf(s);
+      }
+
+      if (clusteredMode == null)
+      {
+         clusteredMode = new Boolean(xmlClusteredMode);
+      }
+   }
+
    private void validate() throws Exception
    {
       // make sure that I have a corresponding "database-configuration"

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -99,7 +99,7 @@
 
    // Server implementation -----------------------------------------
 
-   public synchronized void start(String containerConfig, boolean clustered) throws Exception
+   public synchronized void start(String containerConfig) throws Exception
    {
       if (isStarted())
       {
@@ -110,10 +110,8 @@
 
       sc = new ServiceContainer(containerConfig, null, serverIndex);
       sc.start();
-      
-      log.info("********* STARTING SERVER DATABASE TYPE IS " + sc.getDatabaseType());
-      
-      if (this.getDatabaseType().equals("hsqldb") && clustered)
+
+      if (this.getDatabaseType().equals("hsqldb") && sc.isClustered())
       {
          throw new IllegalStateException("The test server cannot be started in clustered mode with hsqldb as a database - must use a shared database");
       }
@@ -123,7 +121,7 @@
          return;
       }
 
-      startServerPeer(serverIndex, null, null, clustered);
+      startServerPeer(serverIndex, null, null, sc.isClustered());
 
       log.info("server started");
    }
@@ -238,7 +236,7 @@
    {
       try
       {         
-         log.info("******* STARTING SERVER PEER WITH ID " + serverPeerID);
+         log.info(" SERVER PEER ID ........... " + serverPeerID);
          
          log.debug("creating ServerPeer instance");
    
@@ -267,9 +265,9 @@
             persistenceConfigFile  =
                "server/default/deploy/" + databaseType + "-persistence-service.xml";
          }
-         
-         log.info("********* LOADING CONFIG FILE: " + persistenceConfigFile);
-         
+
+         log.info(" PERSISTENCE CONFIG FILE .. " + persistenceConfigFile);
+
          URL persistenceConfigFileURL = getClass().getClassLoader().getResource(persistenceConfigFile);
          if (persistenceConfigFileURL == null)
          {

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -319,9 +319,9 @@
       server.setDefaultSecurityConfig(config);
    }
 
-   public void start(String containerConfig, boolean clustered) throws Exception
+   public void start(String containerConfig) throws Exception
    {
-      server.start(containerConfig, clustered);
+      server.start(containerConfig);
    }
 
    public void startServerPeer(int serverPeerID, String defaultQueueJNDIContext,

Modified: branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2006-12-02 05:53:37 UTC (rev 1682)
+++ branches/Branch_Client_Failover_Experiment/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java	2006-12-02 05:55:02 UTC (rev 1683)
@@ -42,7 +42,7 @@
  */
 public interface Server extends Remote
 {
-   void start(String containerConfig, boolean clustered) throws Exception;
+   void start(String containerConfig) throws Exception;
    void stop(boolean sendNotification) throws Exception;
    void stop() throws Exception;
    void destroy() throws Exception;




More information about the jboss-cvs-commits mailing list