[jboss-cvs] JBoss Messaging SVN: r2310 - in trunk: docs/examples/queue and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 14 02:21:07 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-02-14 02:21:07 -0500 (Wed, 14 Feb 2007)
New Revision: 2310

Added:
   trunk/tests/smoke/artifacts/smoketest-clustered-queue-service.xml
Modified:
   trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
   trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java
   trunk/docs/examples/queue/README.html
   trunk/docs/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java
   trunk/tests/smoke/artifacts/smoketest-clustered-topic-service.xml
   trunk/tests/smoke/build.xml
   trunk/tests/src/org/jboss/test/messaging/tools/ant/GenerateSmokeReport.java
Log:
The smoke test framework runs
* non-clustered tests in a non-clustered configuration
* non-clustered tests in a clustered configuration (for example, 
  sending and receiving using a non-clustered queue)
* and clustered tests in clustered configuration
in one go. 

http://jira.jboss.org/jira/browse/JBMESSAGING-689
http://jira.jboss.org/jira/browse/JBMESSAGING-691
http://jira.jboss.org/jira/browse/JBMESSAGING-690
http://jira.jboss.org/jira/browse/JBMESSAGING-692


Modified: trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
===================================================================
--- trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java	2007-02-14 07:21:07 UTC (rev 2310)
@@ -109,7 +109,8 @@
          log("The message was successfully sent to the distributed queue");
 
 
-         messageListener.waitForMessage();
+         // Wait longer than clustered Post Office's "StatsSendPeriod", which is usually 10 secs
+         messageListener.waitForMessage(15000);
 
 
          message = (TextMessage)messageListener.getMessage();

Modified: trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java
===================================================================
--- trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/docs/examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java	2007-02-14 07:21:07 UTC (rev 2310)
@@ -49,7 +49,7 @@
       return message;
    }
 
-   public synchronized void waitForMessage()
+   public synchronized void waitForMessage(long timeout)
    {
       if (message != null)
       {
@@ -58,7 +58,7 @@
 
       try
       {
-         wait(5000);
+         wait(timeout);
       }
       catch(InterruptedException e)
       {

Modified: trunk/docs/examples/queue/README.html
===================================================================
--- trunk/docs/examples/queue/README.html	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/docs/examples/queue/README.html	2007-02-14 07:21:07 UTC (rev 2310)
@@ -13,8 +13,8 @@
 <br>
 This example creates a JMS Connection to a JBoss Messaging instance
 and uses it to create a session and a message producer, which sends a
-message to a queue. The first connection is closed, and a second
-connection is created and used to create a message consumer that reads
+message to the queue "queue/testQueue".&nbsp; Then, the example uses
+the same connection to create a consumer that that reads
 a single message from the queue. The example is considered successful
 if the message consumer receives without any error the message that was
 sent by the producer. <br>

Modified: trunk/docs/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java
===================================================================
--- trunk/docs/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/docs/examples/queue/src/org/jboss/example/jms/queue/QueueExample.java	2007-02-14 07:21:07 UTC (rev 2310)
@@ -34,10 +34,12 @@
 import org.jboss.example.jms.common.ExampleSupport;
 
 /**
- * The example creates a connection to the default provider and uses the connection to send a
- * message to the queue "queue/testQueue". Then, the example creates a second connection to the
- * provider and uses it to receive the message.
- *
+ * This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
+ * session and a message producer, which sends a message to the queue "queue/testQueue".  Then, the
+ * example uses the same connection to create a consumer that that reads a single message from the
+ * queue. The example is considered successful if the message consumer receives without any error
+ * the message that was sent by the producer.
+ * 
  * Since this example is also used by the smoke test, it is essential that the VM exits with exit
  * code 0 in case of successful execution and a non-zero value on failure.
  *
@@ -58,8 +60,7 @@
       InitialContext ic = null;
       ConnectionFactory cf = null;
       Connection connection =  null;
-      Connection connection2 =  null;
-      
+
       try
       {         
          ic = new InitialContext();
@@ -76,17 +77,15 @@
          sender.send(message);
          log("The message was successfully sent to the " + queue.getQueueName() + " queue");
          
-         connection2 = cf.createConnection();
-         Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageConsumer consumer =  session2.createConsumer(queue);
+         MessageConsumer consumer =  session.createConsumer(queue);
          
-         connection2.start();
+         connection.start();
          
          message = (TextMessage)consumer.receive(2000);
          log("Received message: " + message.getText());
          assertEquals("Hello!", message.getText());
          
-         displayProviderInfo(connection2.getMetaData());
+         displayProviderInfo(connection.getMetaData());
                  
       }
       finally
@@ -103,16 +102,13 @@
             }
          }
          
-         //ALWAYS close your connection in a finally block to avoid leaks
-         //Closing connection also takes care of closing its related objects e.g. sessions
+         // ALWAYS close your connection in a finally block to avoid leaks.
+         // Closing connection also takes care of closing its related objects e.g. sessions.
          closeConnection(connection);
-         
-         closeConnection(connection2);
-         
-      }      
+      }
    }
    
-   private void closeConnection(Connection con) throws JMSException
+   private void closeConnection(Connection con)
    {      
       try
       {

Added: trunk/tests/smoke/artifacts/smoketest-clustered-queue-service.xml
===================================================================
--- trunk/tests/smoke/artifacts/smoketest-clustered-queue-service.xml	                        (rev 0)
+++ trunk/tests/smoke/artifacts/smoketest-clustered-queue-service.xml	2007-02-14 07:21:07 UTC (rev 2310)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+
+   <!--
+   <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
+       <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+   </loader-repository>
+   -->
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=DistributedSmokeTestQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <attribute name="Clustered">true</attribute>
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+</server>
+


Property changes on: trunk/tests/smoke/artifacts/smoketest-clustered-queue-service.xml
___________________________________________________________________
Name: svn:keywords
   + Id LastChangedDate Author Revision

Modified: trunk/tests/smoke/artifacts/smoketest-clustered-topic-service.xml
===================================================================
--- trunk/tests/smoke/artifacts/smoketest-clustered-topic-service.xml	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/tests/smoke/artifacts/smoketest-clustered-topic-service.xml	2007-02-14 07:21:07 UTC (rev 2310)
@@ -13,6 +13,7 @@
       xmbean-dd="xmdesc/Topic-xmbean.xml">
       <attribute name="Clustered">true</attribute>
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>
 
 </server>

Modified: trunk/tests/smoke/build.xml
===================================================================
--- trunk/tests/smoke/build.xml	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/tests/smoke/build.xml	2007-02-14 07:21:07 UTC (rev 2310)
@@ -17,6 +17,7 @@
    <property name="jboss.configuration" value="messaging-smoke-test"/>
    <property name="messaging.client.jar.path" value="${basedir}/../../output/lib"/>
    <property name="smoke.test.type" value="installation"/>
+   <property name="clustered" value="false"/>
 
    <property name="password" value="admin"/>
    <property name="user" value="admin"/>
@@ -33,7 +34,9 @@
    <property name="run.stateless.example" value="true"/>
    <property name="run.ejb3mdb.example" value="false"/>
    <property name="run.secure-socket.example" value="true"/>
+   <property name="run.distributed-queue.example" value="true"/>
    <property name="run.distributed-topic.example" value="true"/>
+   <property name="run.queue-failover.example" value="true"/>
 
    <property name="jboss.home" value="${jboss.compatibility.home}"/>
 
@@ -57,20 +60,21 @@
    </target>
 
    <target name="all" depends="insure-smoke-properties">
-
       <mkdir dir="./output"/>
       <delete file="./output/smoke.log" quiet="true"/>
       <antcall target="build-deployment-archives-from-scratch"/>
+
       <antcall target="installation-tests"/>
 
       <antcall target="old-server-compatibility-tests">
          <param name="smoke.test.type" value="client.compatibility"/>
       </antcall>
+
       <antcall target="old-client-compatibility-tests">
          <param name="smoke.test.type" value="server.compatibility"/>
       </antcall>
+
       <antcall target="report"/>
-
    </target>
 
    <target name="installation-tests">
@@ -87,25 +91,25 @@
       <!--
            4.0.1sp1
       -->
-
+                                                                                                <!--
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss401sp1.home}"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
-
+                                                                                                 -->
       <!--
            4.0.2
       -->
-
+                                                                                                <!--
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss402.home}"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
-
+                                                                                                 -->
       <!--
            4.0.3
       -->
-
+                                                                                                <!--
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss403.home}"/>
          <param name="run.secure-socket.example" value="false"/>
@@ -115,11 +119,11 @@
          <param name="jboss.home" value="${jboss403-installer.home}"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
-
+                                                                                                 -->
       <!--
            4.0.3SP1
       -->
-
+                                                                                                <!--
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss403SP1.home}"/>
          <param name="run.secure-socket.example" value="false"/>
@@ -137,7 +141,7 @@
          <param name="run.stateless.example" value="false"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
-
+                                                                                                 -->
       <!--
            4.0.4.GA
       -->
@@ -149,7 +153,7 @@
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss404GA-installer.home}"/>
       </antcall>
-
+                                                                                                <!--
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss404GA.home}"/>
          <param name="release.admin.target" value="standalone"/>
@@ -157,7 +161,7 @@
          <param name="run.stateless.example" value="false"/>
          <param name="run.secure-socket.example" value="false"/>
       </antcall>
-
+                                                                                                 -->
       <!--
            4.0.5.GA
       -->
@@ -169,7 +173,7 @@
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss405GA-installer.home}"/>
       </antcall>
-
+                                                                                                <!--
       <antcall target="installation-test">
          <param name="jboss.home" value="${jboss405GA.home}"/>
          <param name="release.admin.target" value="standalone"/>
@@ -183,7 +187,7 @@
          <param name="no.java4" value="true"/>
          <param name="run.ejb3mdb.example" value="true"/>
       </antcall>
-
+                                                                                                 -->
       <!--
          Stateless Session Bean installation test will fail on this because the client talks to
          Messaging's remoting and to Unified Invoker's remoting and runs into compatibility
@@ -293,13 +297,15 @@
 
       <antcall target="start"/>
       <antcall target="record-running-jboss-instance"/>
-      <antcall target="sleep"><param name="sleep.interval" value="45"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="25"/></antcall>
 
       <antcall target="ping-jms-server"/>
 
       <antcall target="deploy-scoped-queue"/>
       <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
-      <antcall target="ping-queue"/>
+      <antcall target="ping-queue">
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+      </antcall>
 
       <antcall target="deploy-scoped-topic"/>
       <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
@@ -309,7 +315,7 @@
 
       <!-- ====================================================  -->
       <!--                                                       -->
-      <!--  List your example here:                              -->
+      <!--  LIST YOUR NON-CLUSTERED EXAMPLES HERE:               -->
       <!--                                                       -->
       <!-- ====================================================  -->
 
@@ -322,7 +328,7 @@
          <param name="example.name" value="topic"/>
          <param name="example.topic.name" value="SmokeTestTopic"/>
       </antcall>
-
+                                                                                                <!--
       <antcall target="run-example">
          <param name="example.name" value="mdb"/>
          <param name="example.queue.name" value="SmokeTestQueue"/>
@@ -340,7 +346,7 @@
          <param name="example.queue.name" value="SmokeTestQueue"/>
          <param name="jboss.home" value="${jboss.home}"/>
       </antcall>
-
+                                                                                                 -->
       <antcall target="run-example">
          <param name="example.name" value="secure-socket"/>
          <param name="example.queue.name" value="SmokeTestQueue"/>
@@ -355,7 +361,7 @@
 
       <!-- ====================================================  -->
       <!--                                                       -->
-      <!--  End of example list                                  -->
+      <!--  END OF NON-CLUSTERED EXAMPLE LIST                    -->
       <!--                                                       -->
       <!-- ====================================================  -->
 
@@ -374,22 +380,59 @@
       <antcall target="start">
          <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
       </antcall>
-
       <antcall target="record-running-jboss-instance">
          <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
       </antcall>
-
       <antcall target="sleep"><param name="sleep.interval" value="25"/></antcall>
-
       <antcall target="ping-jms-server"/>
 
-      <antcall target="deploy-clustered-scoped-topic">
+      <!--
+          Deploy the non-clustered queue, we'll also run non-clustered examples in a clustered
+          configuration.
+      -->
+
+      <antcall target="deploy-scoped-queue">
          <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
       </antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
+      <antcall target="ping-queue">
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+      </antcall>
 
+      <!--
+          Deploy the clustered queue.
+      -->
+
+      <antcall target="deploy-clustered-scoped-queue">
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+      </antcall>
       <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
+      <antcall target="ping-queue">
+         <param name="example.queue.name" value="DistributedSmokeTestQueue"/>
+      </antcall>
 
+      <!--
+          Deploy the non-clustered topic, we'll also run non-clustered examples in a clustered
+          configuration.
+      -->
+
+      <antcall target="deploy-scoped-topic">
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+      </antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
       <antcall target="ping-topic">
+         <param name="example.topic.name" value="SmokeTestTopic"/>
+      </antcall>
+
+      <!--
+          Deploy the clustered topic.
+      -->
+
+      <antcall target="deploy-clustered-scoped-topic">
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+      </antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
+      <antcall target="ping-topic">
          <param name="example.topic.name" value="DistributedSmokeTestTopic"/>
       </antcall>
 
@@ -400,23 +443,36 @@
       <antcall target="start">
          <param name="jboss.configuration" value="${jboss.configuration}-node1"/>
       </antcall>
-
-      <antcall target="record-running-jboss-instance">
+      <antcall target="record-running-jboss-instance1">
          <param name="jboss.configuration" value="${jboss.configuration}-node1"/>
       </antcall>
-
       <antcall target="sleep"><param name="sleep.interval" value="25"/></antcall>
-
       <antcall target="ping-jms-server">
          <param name="jnpPort" value="1199"/>
       </antcall>
 
+      <!--
+          Deploy the clustered queue.
+      -->
+
+      <antcall target="deploy-clustered-scoped-queue">
+         <param name="jboss.configuration" value="${jboss.configuration}-node1"/>
+      </antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
+      <antcall target="ping-queue">
+         <param name="example.queue.name" value="DistributedSmokeTestQueue"/>
+         <param name="jnpPort" value="1199"/>
+      </antcall>
+
+
+      <!--
+          Deploy the clustered topic.
+      -->
+
       <antcall target="deploy-clustered-scoped-topic">
          <param name="jboss.configuration" value="${jboss.configuration}-node1"/>
       </antcall>
-
       <antcall target="sleep"><param name="sleep.interval" value="8"/></antcall>
-
       <antcall target="ping-topic">
          <param name="example.topic.name" value="DistributedSmokeTestTopic"/>
          <param name="jnpPort" value="1199"/>
@@ -424,31 +480,92 @@
 
       <!-- ====================================================  -->
       <!--                                                       -->
-      <!--  List your example here:                              -->
+      <!--  LIST YOUR CLUSTERED EXAMPLES HERE:                   -->
       <!--                                                       -->
       <!-- ====================================================  -->
 
+      <!--
+           Single-node examples that runs in a clustered configuration. The list should be
+           identical with the one used for non-clustered tests
+      -->
+      <antcall target="run-example">
+         <param name="example.name" value="queue"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+
+      <antcall target="run-example">
+         <param name="example.name" value="topic"/>
+         <param name="example.topic.name" value="SmokeTestTopic"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+                                                                                                <!--
+      <antcall target="run-example">
+         <param name="example.name" value="mdb"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+
+      <antcall target="run-example">
+         <param name="example.name" value="stateless"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+
+      <antcall target="run-example">
+         <param name="example.name" value="ejb3mdb"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+                                                                                                 -->
+      <antcall target="run-example">
+         <param name="example.name" value="secure-socket"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+
+      <antcall target="run-example">
+         <param name="example.name" value="http"/>
+         <param name="example.queue.name" value="SmokeTestQueue"/>
+         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
+         <param name="clustered" value="true"/>
+      </antcall>
+
+      <!--
+           Genuine clustered examples.
+      -->
+
       <antcall target="run-clustered-example">
+         <param name="example.name" value="distributed-queue"/>
+         <param name="example.queue.name" value="DistributedSmokeTestQueue"/>
+      </antcall>
+
+      <antcall target="run-clustered-example">
          <param name="example.name" value="distributed-topic"/>
          <param name="example.topic.name" value="DistributedSmokeTestTopic"/>
       </antcall>
 
+      <antcall target="run-clustered-example">
+         <param name="example.name" value="queue-failover"/>
+         <param name="example.queue.name" value="DistributedSmokeTestQueue"/>
+      </antcall>
+
       <!-- ====================================================  -->
       <!--                                                       -->
-      <!--  End of example list                                  -->
+      <!--  END OF CLUSTERED EXAMPLE LIST                        -->
       <!--                                                       -->
       <!-- ====================================================  -->
 
-      <antcall target="stop">
-         <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
-      </antcall>
-      <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+      <!-- this will stop both nodes -->
+      <antcall target="stop"/>
 
-      <antcall target="stop">
-         <param name="jboss.configuration" value="${jboss.configuration}-node1"/>
-         <param name="jnpPort" value="1199"/>
-      </antcall>
-      <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+      <antcall target="sleep"><param name="sleep.interval" value="20"/></antcall>
 
       <antcall target="display-warnings-and-errors">
          <param name="jboss.configuration" value="${jboss.configuration}-node0"/>
@@ -460,7 +577,6 @@
 
    </target>
 
-
    <target name="run-example">
 
       <!--
@@ -512,21 +628,29 @@
       <condition property="do.run" value="true">
          <or>
             <and>
+               <equals arg1="${example.name}" arg2="distributed-queue"/>
+               <istrue value="${run.distributed-queue.example}"/>
+            </and>
+            <and>
                <equals arg1="${example.name}" arg2="distributed-topic"/>
                <istrue value="${run.distributed-topic.example}"/>
             </and>
+            <and>
+               <equals arg1="${example.name}" arg2="queue-failover"/>
+               <istrue value="${run.queue-failover.example}"/>
+            </and>
          </or>
       </condition>
       <antcall target="run-clustered-example-internal"/>
 
    </target>
 
-
    <!-- ======================================================================== -->
    <!--      Internal Targets                                                    -->
    <!-- ======================================================================== -->
 
-   <target name="installation-test" depends="check-java-version, check-jboss-availability" unless="skip.current.java">
+   <target name="installation-test"
+           depends="check-java-version, check-jboss-availability" unless="skip.current.java">
 
       <echo message="Testing installation on ${jboss.home}"/>
       <!--
@@ -535,13 +659,14 @@
       <antcall target="create-messaging-config"/>
       <antcall target="run-all-examples"/>
       <antcall target="clean-messaging-config"/>
+
       <!--
           Run clustered tests
-      -->                                                                                       <!--
+      -->
       <antcall target="create-clustered-messaging-config"/>
       <antcall target="run-all-clustered-examples"/>
       <antcall target="clean-clustered-messaging-config"/>
-                                                                                                 -->
+
    </target>
 
    <target name="check-java-version">
@@ -648,14 +773,23 @@
 
    </target>
 
-   <target name="clean-messaging-config">
+   <target name="clean-messaging-config" description="Cleans the non-clustered JBoss instance, and also the clustered ones, if necessary">
       <fail unless="jboss.home" message="jboss.home property not set!"/>
       <echo message="Cleaning ${jboss.home}/server/${jboss.configuration}"/>
       <delete dir="${jboss.home}/server/${jboss.configuration}" quiet="false" failonerror="true"/>
+      <antcall target="clean-messaging-config1"/>
       <delete file="./output/last-run.properties" quiet="true"/>
    </target>
 
-   <target name="clean-clustered-messaging-config">
+   <target name="clean-messaging-config1" description="Cleans the second clustered JBoss instance" if="jboss.home1">
+      <fail unless="jboss.home1" message="jboss.home1 property not set!"/>
+      <fail unless="jboss.configuration1" message="jboss.configuration1 property not set!"/>
+      <echo message="Cleaning ${jboss.home1}/server/${jboss.configuration1}"/>
+      <delete dir="${jboss.home1}/server/${jboss.configuration1}" quiet="false" failonerror="true"/>
+   </target>
+
+   <target name="clean-clustered-messaging-config" description="Cleans all clustered JBoss configurations">
+      <fail unless="jboss.home" message="jboss.home property not set!"/>
       <echo message="Cleaning ${jboss.home}/server/${jboss.configuration}-node0"/>
       <delete dir="${jboss.home}/server/${jboss.configuration}-node0" quiet="false" failonerror="true"/>
       <echo message="Cleaning ${jboss.home}/server/${jboss.configuration}-node1"/>
@@ -672,7 +806,7 @@
       <antcall target="fail-on-serialization-debug-output"/>
 
       <!-- record successful run -->
-      <echo message="TEST_TYPE=${smoke.test.type} JBOSS_HOME=${jboss.home} JBOSS_CONFIGURATION=${jboss.configuration} CLIENT_VERSION=${jboss.messaging.version} INSTALLATION_TYPE=${release.admin.target} SERVER_ARTIFACT_NAME=${messaging.server.artifact.name} EXAMPLE_NAME=${example.name}${line.separator}"
+      <echo message="TEST_TYPE=${smoke.test.type} JBOSS_HOME=${jboss.home} JBOSS_CONFIGURATION=${jboss.configuration} CLIENT_VERSION=${jboss.messaging.version} INSTALLATION_TYPE=${release.admin.target} SERVER_ARTIFACT_NAME=${messaging.server.artifact.name} EXAMPLE_NAME=${example.name}  CLUSTERED=${clustered}${line.separator}"
             file="./output/smoke.log" append="yes"/>
 
    </target>
@@ -699,33 +833,20 @@
       </antcall>
 
       <!-- record successful run -->
-      <echo message="TEST_TYPE=${smoke.test.type} JBOSS_HOME=${jboss.home} JBOSS_CONFIGURATION=${jboss.configuration}-node0 CLIENT_VERSION=${jboss.messaging.version} INSTALLATION_TYPE=${release.admin.target} SERVER_ARTIFACT_NAME=${messaging.server.artifact.name} EXAMPLE_NAME=${example.name}${line.separator}"
+      <echo message="TEST_TYPE=${smoke.test.type} JBOSS_HOME=${jboss.home} JBOSS_CONFIGURATION=${jboss.configuration}-node0 CLIENT_VERSION=${jboss.messaging.version} INSTALLATION_TYPE=${release.admin.target} SERVER_ARTIFACT_NAME=${messaging.server.artifact.name} EXAMPLE_NAME=${example.name} CLUSTERED=true${line.separator}"
             file="./output/smoke.log" append="yes"/>
 
    </target>
 
    <target name="run-example-internal-common">
 
-      <ant dir="../../docs/examples/${example.name}" antfile="build.xml" inheritAll="false" target="clean">
-         <property name="jboss.home" value="${jboss.home}"/>
-         <property name="jboss.configuration" value="${jboss.configuration}"/>
-      </ant>
+      <ant dir="../../docs/examples/${example.name}" antfile="build.xml" target="clean"/>
 
-      <ant dir="../../docs/examples/${example.name}" antfile="build.xml" inheritAll="false">
-         <property name="example.queue.name" value="${example.queue.name}"/>
-         <property name="example.topic.name" value="${example.topic.name}"/>
-         <property name="messaging.client.jar.path" value="${messaging.client.jar.path}"/>
-         <property name="messaging.client.jar.name" value="${messaging.client.jar.name}"/>
-         <property name="jboss.home" value="${jboss.home}"/>
-         <property name="jboss.configuration" value="${jboss.configuration}"/>
-      </ant>
+      <ant dir="../../docs/examples/${example.name}" antfile="build.xml"/>
 
       <echo message="Example ${example.name} executed successfully, cleaning ..."/>
 
-      <ant dir="../../docs/examples/${example.name}" antfile="build.xml" inheritAll="false" target="clean">
-         <property name="jboss.home" value="${jboss.home}"/>
-         <property name="jboss.configuration" value="${jboss.configuration}"/>
-      </ant>
+      <ant dir="../../docs/examples/${example.name}" antfile="build.xml" target="clean"/>
 
    </target>
 
@@ -773,15 +894,19 @@
    </target>
 
    <target name="record-running-jboss-instance">
-
       <path id="crt.jboss.home"><pathelement location="${jboss.home}"/></path>
       <pathconvert targetos="unix" property="crt.jboss.home.tostring" refid="crt.jboss.home"/>
       <echo message="${line.separator}jboss.home=${crt.jboss.home.tostring}" file="./output/last-run.properties" append="true"/>
       <echo message="${line.separator}jboss.configuration=${jboss.configuration}" file="./output/last-run.properties" append="true"/>
+   </target>
 
+   <target name="record-running-jboss-instance1">
+      <path id="crt.jboss.home"><pathelement location="${jboss.home}"/></path>
+      <pathconvert targetos="unix" property="crt.jboss.home.tostring" refid="crt.jboss.home"/>
+      <echo message="${line.separator}jboss.home1=${crt.jboss.home.tostring}" file="./output/last-run.properties" append="true"/>
+      <echo message="${line.separator}jboss.configuration1=${jboss.configuration}" file="./output/last-run.properties" append="true"/>
    </target>
 
-
    <target name="twiddle">
 
       <java classname="org.jboss.console.twiddle.Twiddle" fork="yes" failonerror="yes"
@@ -807,13 +932,11 @@
    </target>
 
    <target name="deploy-queue">
-
-      <copy file="artifacts/smoketest-queue-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
-
+      <copy file="artifacts/smoketest-queue-service.xml"
+            todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
    </target>
 
    <target name="deploy-scoped-queue">
-
       <copy file="artifacts/smoketest-queue-service.xml" tofile="./smoketest-queue-service.xml"/>
       <!-- enable scoping -->
       <replaceregexp file="./smoketest-queue-service.xml" flags="s">
@@ -821,29 +944,36 @@
          <substitution expression="\2"/>
       </replaceregexp>
       <move file="./smoketest-queue-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
+   </target>
 
+   <target name="deploy-clustered-scoped-queue">
+      <copy file="artifacts/smoketest-clustered-queue-service.xml"
+            tofile="./smoketest-clustered-queue-service.xml"/>
+      <!-- enable scoping -->
+      <replaceregexp file="./smoketest-clustered-queue-service.xml" flags="s">
+         <regexp pattern="\x3c!\x2d-([ \t\n\r]*)(\x3cloader-repository\x3e.*\x3c/loader-repository\x3e)([ \t\n\r]*)\x2d-\x3e"/>
+         <substitution expression="\2"/>
+      </replaceregexp>
+      <move file="./smoketest-clustered-queue-service.xml"
+            todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
    </target>
 
    <target name="ping-queue">
-
       <java classname="org.jboss.console.twiddle.Twiddle" fork="yes" failonerror="yes"
           dir="${jboss.home}/bin">
-         <arg line="-s jnp://localhost:${jnpPort} get jboss.messaging.destination:name=SmokeTestQueue,service=Queue Name"/>
+         <arg line="-s jnp://localhost:${jnpPort} get jboss.messaging.destination:name=${example.queue.name},service=Queue Name"/>
          <classpath>
             <path refid="twiddle.classpath"/>
          </classpath>
       </java>
-
    </target>
 
    <target name="deploy-topic">
-
-       <copy file="artifacts/smoketest-topic-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
-
+       <copy file="artifacts/smoketest-topic-service.xml"
+             todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
    </target>
 
    <target name="deploy-scoped-topic">
-
       <copy file="artifacts/smoketest-topic-service.xml" tofile="./smoketest-topic-service.xml"/>
       <!-- enable scoping -->
       <replaceregexp file="./smoketest-topic-service.xml" flags="s">
@@ -851,24 +981,21 @@
          <substitution expression="\2"/>
       </replaceregexp>
       <move file="./smoketest-topic-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
-
    </target>
 
    <target name="deploy-clustered-scoped-topic">
-
-      <copy file="artifacts/smoketest-clustered-topic-service.xml" tofile="./smoketest-clustered-topic-service.xml"/>
+      <copy file="artifacts/smoketest-clustered-topic-service.xml"
+            tofile="./smoketest-clustered-topic-service.xml"/>
       <!-- enable scoping -->
       <replaceregexp file="./smoketest-clustered-topic-service.xml" flags="s">
          <regexp pattern="\x3c!\x2d-([ \t\n\r]*)(\x3cloader-repository\x3e.*\x3c/loader-repository\x3e)([ \t\n\r]*)\x2d-\x3e"/>
          <substitution expression="\2"/>
       </replaceregexp>
-      <move file="./smoketest-clustered-topic-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
-
+      <move file="./smoketest-clustered-topic-service.xml"
+            todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
    </target>
 
-
    <target name="ping-topic">
-
       <java classname="org.jboss.console.twiddle.Twiddle" fork="yes" failonerror="yes"
           dir="${jboss.home}/bin">
          <arg line="-s jnp://localhost:${jnpPort} get jboss.messaging.destination:name=${example.topic.name},service=Topic Name"/>
@@ -876,10 +1003,9 @@
             <path refid="twiddle.classpath"/>
          </classpath>
       </java>
-
    </target>
 
-   <target name="stop" description="Stops the jboss instance">
+   <target name="stop" description="Stops the unique (or the first in a cluster) JBoss instance">
 
       <fail unless="jboss.home" message="jboss.home property not set!"/>
       <java classname="org.jboss.Shutdown" fork="yes" dir="${jboss.home}/bin">
@@ -887,7 +1013,6 @@
          <jvmarg value="-Xms128m"/>
          <jvmarg value="-Xmx128m"/>
          <arg line="-s jnp://localhost:${jnpPort} -S"/>
-         <!-- <arg value="-S"/> -->
          <arg value="--user=${user}"/>
          <arg value="--password=${password}"/>
          <classpath>
@@ -896,8 +1021,29 @@
          </classpath>
       </java>
 
+      <antcall target="stop1">
+         <param name="jnpPort" value="1199"/>
+      </antcall>
+
    </target>
 
+   <target name="stop1" description="Stops the second cluster instance" if="jboss.home1">
+
+      <fail unless="jboss.home1" message="jboss.home1 property not set!"/>
+      <java classname="org.jboss.Shutdown" fork="yes" dir="${jboss.home}/bin">
+         <jvmarg value="-server"/>
+         <jvmarg value="-Xms128m"/>
+         <jvmarg value="-Xmx128m"/>
+         <arg line="-s jnp://localhost:${jnpPort} -S"/>
+         <arg value="--user=${user}"/>
+         <arg value="--password=${password}"/>
+         <classpath>
+            <pathelement location="${jboss.home}/bin/shutdown.jar"/>
+            <pathelement location="${jboss.home}/client/jbossall-client.jar"/>
+         </classpath>
+      </java>
+   </target>
+
    <target name="display-warnings-and-errors">
 
       <java classname="org.jboss.test.messaging.tools.ant.DisplayWarningsAndErrors">
@@ -948,10 +1094,11 @@
    </target>
 
    <target name="clean">
-
       <delete dir="./output"/>
+      <!--
+          This also works on a clustered configuration when output/last-run.properties is correctly set.
+      -->
       <antcall target="clean-messaging-config"/>
-
    </target>
 
    <target name="print-classpath">

Modified: trunk/tests/src/org/jboss/test/messaging/tools/ant/GenerateSmokeReport.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ant/GenerateSmokeReport.java	2007-02-14 07:04:56 UTC (rev 2309)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ant/GenerateSmokeReport.java	2007-02-14 07:21:07 UTC (rev 2310)
@@ -252,8 +252,35 @@
             }
             String exampleName = line.substring(bi + 13, ei);
 
+            bi = line.indexOf("CLUSTERED=");
+            if (bi == -1)
+            {
+               throw new Exception("CLUSTERED= not found in \"" + line + "\"");
+            }
+            ei = line.indexOf(' ', bi);
+            if (ei == -1)
+            {
+               ei = line.length();
+            }
+            String clusteredValue = line.substring(bi + 10, ei);
+            clusteredValue = clusteredValue.toLowerCase();
+            boolean clustered;
+            if ("true".equals(clusteredValue))
+            {
+               clustered = true;
+            }
+            else if ("false".equals(clusteredValue))
+            {
+               clustered = false;
+            }
+            else
+            {
+               throw new Exception(
+                  "CLUSTERED must be either 'true' or 'false' but it's " + clusteredValue);
+            }
+
             result.addTestRun(testType, jbossHome, jbossConfiguration, clientVersion,
-                              installationType, serverArtifactName, exampleName);
+                              installationType, serverArtifactName, exampleName, clustered);
          }
       }
       finally
@@ -478,11 +505,13 @@
 
       public void addTestRun(String testType, String jbossHome, String jbossConfiguration,
                              String clientVersion, String installationType,
-                             String serverArtifactName, String exampleName) throws Exception
+                             String serverArtifactName, String exampleName,
+                             boolean clustered) throws Exception
       {
          if ("installation".equals(testType))
          {
-            addInstallationTestRun(jbossHome, installationType, serverArtifactName, exampleName);
+            addInstallationTestRun(jbossHome, installationType,
+                                   serverArtifactName, exampleName, clustered);
          }
          else if ("client.compatibility".equals(testType))
          {
@@ -546,8 +575,8 @@
       }
 
       private void addInstallationTestRun(String jbossHome, String installationType,
-                                          String serverArtifactName, String exampleName)
-         throws Exception
+                                          String serverArtifactName, String exampleName,
+                                          boolean clustered) throws Exception
       {
          String jbossVersion;
          boolean installerGenerated = false;
@@ -586,7 +615,7 @@
          scoped = serverArtifactName.indexOf("-scoped") != -1;
 
          JBossInstallation jbi =
-            new JBossInstallation(jbossVersion, installerGenerated, standalone, scoped);
+            new JBossInstallation(jbossVersion, installerGenerated, standalone, scoped, clustered);
 
          Set examples = (Set)installationTests.get(jbi);
 
@@ -655,16 +684,19 @@
       private boolean installerGenerated;
       private boolean standalone;
       private boolean scoped;
+      private boolean clustered;
 
       private JBossInstallation(String version,
                                 boolean installerGenerated,
                                 boolean standalone,
-                                boolean scoped)
+                                boolean scoped,
+                                boolean clustered)
       {
          this.version = version;
          this.installerGenerated = installerGenerated;
          this.standalone = standalone;
          this.scoped = scoped;
+         this.clustered = clustered;
       }
 
       public int compareTo(Object o)
@@ -679,11 +711,13 @@
          }
 
          int thisScore =
+            (this.isClustered() ? 1000 : 0) +
             (this.isStandalone() ? 100 : 0) +
             (this.isInstallerGenerated() ? 10 : 0) +
             (this.isScoped() ? 1 : 0);
 
          int thatScore =
+            (that.isClustered() ? 1000 : 0) +
             (that.isStandalone() ? 100 : 0) +
             (that.isInstallerGenerated() ? 10 : 0) +
             (that.isScoped() ? 1 : 0);
@@ -711,6 +745,11 @@
          return scoped;
       }
 
+      public boolean isClustered()
+      {
+         return clustered;
+      }
+
       public boolean equals(Object o)
       {
          if (this == o)
@@ -729,7 +768,8 @@
             this.version.equals(that.version) &&
             this.installerGenerated == that.installerGenerated &&
             this.standalone == that.standalone &&
-            this.scoped == that.scoped;
+            this.scoped == that.scoped &&
+            this.clustered == that.clustered;
       }
 
       public int hashCode()
@@ -738,7 +778,8 @@
             version.hashCode() +
             (installerGenerated ? 17 : 0) +
             (standalone ? 37 : 0) +
-            (scoped ? 57 : 0);
+            (scoped ? 57 : 0) +
+            (clustered ? 129 : 0);
       }
 
       public String toString()
@@ -767,6 +808,16 @@
          {
             sb.append(", installer generated");
          }
+
+         if (clustered)
+         {
+            sb.append(", CLUSTERED");
+         }
+         else
+         {
+            sb.append(", not clustered");
+         }
+
          sb.append(")");
 
          return sb.toString();




More information about the jboss-cvs-commits mailing list