[jboss-cvs] JBoss Messaging SVN: r5871 - in trunk: tests and 21 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 16 09:39:58 EST 2009


Author: jmesnil
Date: 2009-02-16 09:39:58 -0500 (Mon, 16 Feb 2009)
New Revision: 5871

Added:
   trunk/tests/joram-tests/
   trunk/tests/joram-tests/config/
   trunk/tests/joram-tests/config/provider.properties
   trunk/tests/joram-tests/config/test.properties
   trunk/tests/joram-tests/src/
   trunk/tests/joram-tests/src/org/
   trunk/tests/joram-tests/src/org/jboss/
   trunk/tests/joram-tests/src/org/jboss/test/
   trunk/tests/joram-tests/src/org/jboss/test/jms/
   trunk/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java
   trunk/tests/joram-tests/src/org/jboss/test/jms/GenericAdmin.java
   trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java
   trunk/tests/joram-tests/src/org/objectweb/
   trunk/tests/joram-tests/src/org/objectweb/jtests/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/Admin.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/AdminFactory.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/ConnectionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageBodyTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageDefaultTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageTypeTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyConversionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/TemporaryQueueTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorSyntaxTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/QueueSessionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/SessionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/TemporaryTopicTest.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/package.html
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/JMSTestCase.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PTPTestCase.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PubSubTestCase.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/TestConfig.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
   trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/package.html
Modified:
   trunk/.classpath
   trunk/build-messaging.xml
   trunk/build.xml
Log:
JBMESSAGING-1499: Setup JORAM JMS compliance tests to run against JBM 2.0

* added JORAM test suite in joram-tests
* modified the Admin interface to all the JORAM test suite to run with an embedded server (so that every tests can be fully run in process)
* added Ant target "joram-tests" to run the JORAM test-suite

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2009-02-16 14:38:04 UTC (rev 5870)
+++ trunk/.classpath	2009-02-16 14:39:58 UTC (rev 5871)
@@ -13,6 +13,8 @@
 	</classpathentry>
 	<classpathentry kind="src" path="tests/jms-tests/src"/>
 	<classpathentry kind="src" path="src/schemas"/>
+	<classpathentry kind="src" path="tests/joram-tests/src"/>
+	<classpathentry kind="src" path="tests/joram-tests/config"/>
 	<classpathentry kind="lib" path="thirdparty/oswego-concurrent/lib/concurrent.jar"/>
 	<classpathentry kind="lib" path="thirdparty/apache-log4j/lib/log4j.jar"/>
 	<classpathentry kind="lib" path="thirdparty/junit/lib/junit.jar"/>
@@ -50,6 +52,7 @@
 	<classpathentry kind="lib" path="thirdparty/jboss/integration/lib/jboss-transaction-spi.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss/jboss-jaspi-api/lib/jboss-jaspi-api.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss/common/lib/jboss-common.jar"/>
+	<classpathentry kind="lib" path="thirdparty/jboss/jnpserver/lib/jnpserver.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="thirdparty/jboss/jbossts14/lib/jbossjta-integration.jar"/>
 	<classpathentry kind="lib" path="thirdparty/jboss/jboss-javaee/lib/jboss-javaee.jar"/>
@@ -59,7 +62,7 @@
 	<classpathentry kind="lib" path="thirdparty/easymock-classextension/lib/easymockclassextension.jar"/>
 	<classpathentry kind="lib" path="thirdparty/cglib/lib/cglib.jar"/>
 	<classpathentry kind="lib" path="tests/tmpfiles"/>
-	<classpathentry kind="lib" path="thirdparty/netty/lib/netty-3.1.0.ALPHA2.jar"/>
+	<classpathentry kind="lib" path="thirdparty/netty/lib/netty-3.1.0.ALPHA2.jar" sourcepath="thirdparty/netty/lib/netty-3.1.0.ALPHA2-sources.jar"/>
 	<classpathentry kind="lib" path="thirdparty/apache-mina/lib/mina-core-2.0.0-M4.jar"/>
 	<classpathentry kind="lib" path="thirdparty/slf4j/log4j/lib/slf4j-log4j12-1.5.2.jar"/>
 	<classpathentry kind="output" path="eclipse-output"/>

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2009-02-16 14:38:04 UTC (rev 5870)
+++ trunk/build-messaging.xml	2009-02-16 14:39:58 UTC (rev 5871)
@@ -158,6 +158,11 @@
    <property name="test.jms.build.dir" value="${test.jms.dir}/build"/>
    <property name="test.jms.src.dir" value="${test.jms.dir}/src"/>
    <property name="test.jms.classes.dir" value="${test.jms.dir}/build/classes"/>
+   <property name="test.joram.dir" value="${test.dir}/joram-tests"/>
+   <property name="test.joram.src.dir" value="${test.joram.dir}/src"/>
+   <property name="test.joram.config.dir" value="${test.joram.dir}/config"/>
+   <property name="test.joram.build.dir" value="${test.joram.dir}/build"/>
+   <property name="test.joram.classes.dir" value="${test.joram.build.dir}/classes"/>
    <property name="disable.invm" value="false"/>
 
    <!--
@@ -271,6 +276,11 @@
       <path location="${build.jars.dir}/${logging.jar.name}"/>
    </path>
 
+   <path id="joram.test.compilation.classpath">
+      <path refid="jms.test.compilation.classpath"/>
+      <path refid="jboss.jnpserver.classpath"/>
+   </path>
+   
    <path id="findbugs.classpath">
       <path refid="jms.compilation.classpath"/>
       <path location="${build.jars.dir}/jboss-${module.name}.jar"/>
@@ -337,6 +347,13 @@
       <!--<path refid="jboss.common.classpath"/>-->
       <!--<path refid="jboss.jnpserver.classpath"/>-->
    </path>
+    
+   <path id="joram.test.execution.classpath">
+      <pathelement location="${test.joram.classes.dir}"/>
+      <pathelement location="${test.joram.config.dir}"/>
+      <path refid="joram.test.compilation.classpath"/>
+      <path refid="jms.test.execution.classpath"/>
+   </path>
 
    <path id="jms.standalone.server.classpath">
       <pathelement location="${test.dir}/config"/>
@@ -390,6 +407,7 @@
       <delete dir="${test.build.dir}"/>
       <delete dir="${test.output.dir}"/>
       <delete dir="${test.jms.build.dir}"/>
+      <delete dir="${test.joram.build.dir}"/>
    </target>
 
    <target name="init" depends="createthirdparty">
@@ -1096,6 +1114,24 @@
          <classpath refid="jms.test.compilation.classpath"/>
       </javac>
    </target>
+    
+   <target name="compile-joram-tests">
+      <mkdir dir="${test.joram.classes.dir}"/>
+      <javac target="${javac.target}"
+             source="${javac.source}"
+             optimize="${javac.optimize}"
+             debug="${javac.debug}"
+             depend="${javac.depend}"
+             verbose="${javac.verbose}"
+             deprecation="${javac.deprecation}"
+             includeAntRuntime="true"
+             includeJavaRuntime="${javac.include.java.runtime}"
+             failonerror="${javac.fail.onerror}"
+             srcdir="${test.joram.src.dir}"
+             destdir="${test.joram.classes.dir}">
+          <classpath refid="joram.test.compilation.classpath"/>
+      </javac>
+   </target>
 
    <target name="performance-tests" depends="jar, compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
@@ -1231,7 +1267,45 @@
          </batchtest>
       </junit>
    </target>
+    
+   <target name="joram-tests" depends="jar, compile-joram-tests">
+      <echo message=""/>
+      <echo message="Running JORAM tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
+      <echo message=""/>
+      <mkdir dir="${test.output.dir}"/>
+      <mkdir dir="${test.reports.dir}"/>
+      <junit printsummary="${junit.printsummary}"
+             fork="on"
+             forkMode="once"
+             includeantruntime="${junit.includeantruntime}"
+             haltonerror="${junit.haltonerror}"
+             haltonfailure="${junit.haltonfailure}"
+             showoutput="${junit.showoutput}"
+             timeout="${junit.timeout}">
 
+         <jvmarg value="-Xmx1024M"/>
+         <jvmarg value="-Djava.library.path=native/bin"/>
+         <jvmarg value="-Dmodule.output=./"/>
+         <jvmarg value="-Djava.util.logging.config.file=src/config/logging.properties"/>
+         <jvmarg
+               value="-Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin"/>
+         <!--<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>-->
+         <!--<jvmarg value="-ea"/>-->
+         <sysproperty key="jbm.remoting.disable.invm" value="${disable.invm}"/>
+        <sysproperty key="java.io.tmpdir" value="${java.io.tmpdir}"/>
+         <classpath refid="joram.test.execution.classpath"/>
+         <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+         <batchtest todir="${junit.batchtest.todir}"
+                    haltonfailure="${junit.batchtest.haltonfailure}"
+                    haltonerror="${junit.batchtest.haltonerror}">
+            <formatter type="plain" usefile="${junit.formatter.usefile}"/>
+            <fileset dir="${test.joram.classes.dir}">
+               <include name="**/${test-mask}.class"/>
+            </fileset>
+         </batchtest>
+      </junit>
+   </target>  
+
    <target name="stress-tests" depends="jar, compile-unit-tests">
       <echo message=""/>
       <echo message="Running unit tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
@@ -1306,6 +1380,12 @@
       <echo message="${test.execution.classpath.unix}" file="${test.execution.classpath.file}"/>
    </target>
 
+   <target name="get-joram-test-execution-classpath" depends="init">
+      <pathconvert refid="joram.test.execution.classpath"
+                   property="test.execution.classpath.unix"/>
+      <echo message="${test.execution.classpath.unix}" file="${test.execution.classpath.file}"/>
+   </target>
+
    <target name="emma" depends="jar, compile-unit-tests">
       <property name="emma.dir" location="${build.dir}/emma"/>
 

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2009-02-16 14:38:04 UTC (rev 5870)
+++ trunk/build.xml	2009-02-16 14:39:58 UTC (rev 5871)
@@ -188,6 +188,10 @@
       <ant antfile="build-messaging.xml" target="compile"/>
    </target>
 
+   <target name="compile-joram-tests" depends="createthirdparty">
+      <ant antfile="build-messaging.xml" target="compile"/>
+   </target>
+
    <target name="unit-tests" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="unit-tests"/>
       <ant antfile="build-messaging.xml" target="compile-reports"/>
@@ -218,11 +222,15 @@
       <ant antfile="build-messaging.xml" target="compile-reports"/>
    </target>
    
-
    <target name="jms-tests" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="jms-tests"/>
       <ant antfile="build-messaging.xml" target="compile-reports"/>
    </target>
+    
+   <target name="joram-tests" depends="createthirdparty">
+      <ant antfile="build-messaging.xml" target="joram-tests"/>
+      <ant antfile="build-messaging.xml" target="compile-reports"/>
+   </target>
 
    <target name="all-tests" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="all-tests"/>

Added: trunk/tests/joram-tests/config/provider.properties
===================================================================
--- trunk/tests/joram-tests/config/provider.properties	                        (rev 0)
+++ trunk/tests/joram-tests/config/provider.properties	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,36 @@
+## 
+# JORAM: Java(TM) Open Reliable Asynchronous Messaging
+# Copyright (C) 2002 INRIA
+# Contact: joram-team at objectweb.org
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+# USA
+#
+# Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
+# Contributor(s): ______________________________________.
+##
+
+##
+# This property is used to chose which provider is to be tested
+# Uncomment the chosen provider and comment the other ones
+##
+
+jms.provider.admin.class=org.jboss.test.jms.JBossMessagingAdmin
+#jms.provider.admin.class = org.jboss.test.jms.GenericAdmin
+#jms.provider.admin.class = org.objectweb.jtests.providers.admin.JoramAdmin
+#jms.provider.admin.class = org.objectweb.jtests.providers.admin.AshnaMQAdmin
+#jms.provider.admin.class = org.objectweb.jtests.providers.admin.FioranoMQAdmin
+#jms.provider.admin.class = org.objectweb.jtests.providers.admin.PramatiAdmin
+#jms.provider.admin.class = org.objectweb.jtests.providers.admin.SwiftMQAdmin
\ No newline at end of file

Added: trunk/tests/joram-tests/config/test.properties
===================================================================
--- trunk/tests/joram-tests/config/test.properties	                        (rev 0)
+++ trunk/tests/joram-tests/config/test.properties	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,29 @@
+## 
+# JORAM: Java(TM) Open Reliable Asynchronous Messaging
+# Copyright (C) 2002 INRIA
+# Contact: joram-team at objectweb.org
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+# USA
+#
+# Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
+# Contributor(s): ______________________________________.
+##
+
+# Timeout specified for receive(long time) method
+# Time in milliseconds or 0 for never expiring
+# Default is set to 30 seconds (long enough to receive slow messages
+# and won't hang up tests infinitely)
+timeout = 30000
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java
===================================================================
--- trunk/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/jboss/test/jms/AbstractAdmin.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,115 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.jms;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.util.NotImplementedException;
+import org.objectweb.jtests.jms.admin.Admin;
+
+/**
+ * AbstractAdmin.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractAdmin implements Admin
+{
+   public String getName()
+   {
+      return getClass().getName();
+   }
+   
+   public void start()
+   {
+   }
+
+   public void stop() throws Exception
+   {
+      // TODO Auto-generated method stub
+      
+   }
+   
+   public InitialContext createInitialContext() throws NamingException
+   {
+      return new InitialContext();
+   }
+   
+   public void createConnectionFactory(String name)
+   {
+      throw new NotImplementedException("FIXME NYI createConnectionFactory");
+   }
+
+   public void deleteConnectionFactory(String name)
+   {
+      throw new NotImplementedException("FIXME NYI deleteConnectionFactory");
+   }
+
+   public void createQueue(String name)
+   {
+      throw new NotImplementedException("FIXME NYI createQueue");
+   }
+
+   public void deleteQueue(String name)
+   {
+      throw new NotImplementedException("FIXME NYI deleteQueue");
+   }
+
+   public void createQueueConnectionFactory(String name)
+   {
+      createConnectionFactory(name);
+   }
+
+   public void deleteQueueConnectionFactory(String name)
+   {
+      deleteConnectionFactory(name);
+   }
+
+   public void createTopic(String name)
+   {
+      throw new NotImplementedException("FIXME NYI createTopic");
+   }
+
+   public void deleteTopic(String name)
+   {
+      throw new NotImplementedException("FIXME NYI deleteTopic");
+   }
+
+   public void createTopicConnectionFactory(String name)
+   {
+      createConnectionFactory(name);
+   }
+
+   public void deleteTopicConnectionFactory(String name)
+   {
+      deleteConnectionFactory(name);
+   }
+   
+   public void startEmbeddedServer()
+   {
+   }
+   
+   public void stopEmbeddedServer()
+   {
+   }
+}

Added: trunk/tests/joram-tests/src/org/jboss/test/jms/GenericAdmin.java
===================================================================
--- trunk/tests/joram-tests/src/org/jboss/test/jms/GenericAdmin.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/jboss/test/jms/GenericAdmin.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,136 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.jms;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.objectweb.jtests.jms.admin.Admin;
+
+/**
+ * GenericAdmin.
+ * 
+ * @FIXME delegate to a JBoss defined admin class
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class GenericAdmin implements Admin
+{
+   public static final Logger log = Logger.getLogger(GenericAdmin.class);
+   
+   public static Admin delegate = new AbstractAdmin();
+
+   public String getName()
+   {
+      String name = delegate.getName();
+      log.debug("Using admin '" + name + "' delegate=" + delegate);
+      return name;
+   }
+   
+   public void start() throws Exception
+   {
+   }
+   
+   public void stop() throws Exception
+   {
+   }
+   
+   public InitialContext createInitialContext() throws NamingException
+   {
+      InitialContext ctx = delegate.createInitialContext();
+      log.debug("Using initial context: " + ctx.getEnvironment());
+      return ctx;
+   }
+
+   public void createConnectionFactory(String name)
+   {
+      log.debug("createConnectionFactory '" + name + "'");
+      delegate.createConnectionFactory(name);
+   }
+
+   public void deleteConnectionFactory(String name)
+   {
+      log.debug("deleteConnectionFactory '" + name + "'");
+      delegate.deleteConnectionFactory(name);
+   }
+
+   public void createQueue(String name)
+   {
+      log.debug("createQueue '" + name + "'");
+      delegate.createQueue(name);
+   }
+
+   public void deleteQueue(String name)
+   {
+      log.debug("deleteQueue '" + name + "'");
+      delegate.deleteQueue(name);
+   }
+
+   public void createQueueConnectionFactory(String name)
+   {
+      log.debug("createQueueConnectionFactory '" + name + "'");
+      delegate.createQueueConnectionFactory(name);
+   }
+
+   public void deleteQueueConnectionFactory(String name)
+   {
+      log.debug("deleteQueueConnectionFactory '" + name + "'");
+      delegate.deleteQueueConnectionFactory(name);
+   }
+
+   public void createTopic(String name)
+   {
+      log.debug("createTopic '" + name + "'");
+      delegate.createTopic(name);
+   }
+
+   public void deleteTopic(String name)
+   {
+      log.debug("deleteTopic '" + name + "'");
+      delegate.deleteTopic(name);
+   }
+
+   public void createTopicConnectionFactory(String name)
+   {
+      log.debug("createTopicConnectionFactory '" + name + "'");
+      delegate.createTopicConnectionFactory(name);
+   }
+
+   public void deleteTopicConnectionFactory(String name)
+   {
+      log.debug("deleteTopicConnectionFactory '" + name + "'");
+      delegate.deleteTopicConnectionFactory(name);
+   }
+   
+   public void startEmbeddedServer() throws Exception
+   {
+      log.debug("startEmbeddedServer");
+      delegate.startEmbeddedServer();
+   }
+   
+   public void stopEmbeddedServer() throws Exception
+   {
+      log.debug("stopEmbeddedServer");
+      delegate.stopEmbeddedServer();
+   }
+}

Added: trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java
===================================================================
--- trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/jboss/test/jms/JBossMessagingAdmin.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,339 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.jms;
+
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_AFTER_FAILOVER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_BEFORE_FAILOVER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
+
+import java.util.Hashtable;
+
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import junit.framework.Assert;
+
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientRequestor;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
+import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
+import org.jboss.messaging.util.SimpleString;
+import org.jnp.server.Main;
+import org.jnp.server.NamingBeanImpl;
+import org.objectweb.jtests.jms.admin.Admin;
+
+/**
+ * A JBossMessagingAdmin
+ *
+ * @author jmesnil
+ * 
+ * Created 16 fŽvr. 2009 10:36:29
+ *
+ *
+ */
+public class JBossMessagingAdmin implements Admin
+{
+
+   private ClientSession clientSession;
+
+   private ClientRequestor requestor;
+
+   private MessagingServiceImpl embeddedServer;
+
+   private NamingBeanImpl namingInfo;
+
+   private Main jndiServer;
+
+   public JBossMessagingAdmin()
+   {
+   }
+   
+   public void start() throws Exception
+   {
+      ClientSessionFactoryImpl sf = new ClientSessionFactoryImpl(new TransportConfiguration(NettyConnectorFactory.class.getName()));
+      clientSession = sf.createSession(SecurityStoreImpl.CLUSTER_ADMIN_USER,
+                                       ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD,
+                                       false,
+                                       true,
+                                       true,
+                                       false,
+                                       1);
+      requestor = new ClientRequestor(clientSession, ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS);
+      clientSession.start();
+   }
+   
+   public void stop() throws Exception
+   {
+      requestor.close();
+   }
+
+   public void createConnectionFactory(String name)
+   {
+      try
+      {
+         invokeSyncOperation(ObjectNames.getJMSServerObjectName(),
+                             "createSimpleConnectionFactory",
+                             name,
+                             NettyConnectorFactory.class.getName(),
+                             DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+                             DEFAULT_PING_PERIOD,
+                             DEFAULT_CONNECTION_TTL,
+                             DEFAULT_CALL_TIMEOUT,
+                             null,
+                             DEFAULT_ACK_BATCH_SIZE,
+                             DEFAULT_ACK_BATCH_SIZE,
+                             DEFAULT_CONSUMER_WINDOW_SIZE,
+                             DEFAULT_CONSUMER_MAX_RATE,
+                             DEFAULT_SEND_WINDOW_SIZE,
+                             DEFAULT_PRODUCER_MAX_RATE,
+                             DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+                             DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+                             true,
+                             true,
+                             DEFAULT_AUTO_GROUP,
+                             DEFAULT_MAX_CONNECTIONS,
+                             DEFAULT_PRE_ACKNOWLEDGE,
+                             DEFAULT_RETRY_INTERVAL,
+                             DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+                             DEFAULT_MAX_RETRIES_BEFORE_FAILOVER,
+                             DEFAULT_MAX_RETRIES_AFTER_FAILOVER,
+                             name);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+
+   }
+
+   public InitialContext createInitialContext() throws NamingException
+   {
+      Hashtable<String, String> env = new Hashtable<String, String>();
+      env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+      env.put("java.naming.provider.url", "jnp://localhost:1099");
+      env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+
+      return new InitialContext(env);
+   }
+
+   public void createQueue(String name)
+   {
+      Boolean result;
+      try
+      {
+         result = (Boolean)invokeSyncOperation(ObjectNames.getJMSServerObjectName(), "createQueue", name, name);
+         Assert.assertEquals(true, result.booleanValue());
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public void createQueueConnectionFactory(String name)
+   {
+      createConnectionFactory(name);
+   }
+
+   public void createTopic(String name)
+   {
+      Boolean result;
+      try
+      {
+         result = (Boolean)invokeSyncOperation(ObjectNames.getJMSServerObjectName(), "createTopic", name, name);
+         Assert.assertEquals(true, result.booleanValue());
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public void createTopicConnectionFactory(String name)
+   {
+      createConnectionFactory(name);
+   }
+
+   public void deleteConnectionFactory(String name)
+   {
+      try
+      {
+         invokeSyncOperation(ObjectNames.getJMSServerObjectName(), "destroyConnectionFactory", name);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public void deleteQueue(String name)
+   {
+      Boolean result;
+      try
+      {
+         result = (Boolean)invokeSyncOperation(ObjectNames.getJMSServerObjectName(), "destroyQueue", name);
+         Assert.assertEquals(true, result.booleanValue());
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public void deleteQueueConnectionFactory(String name)
+   {
+      deleteConnectionFactory(name);
+   }
+
+   public void deleteTopic(String name)
+   {
+      Boolean result;
+      try
+      {
+         result = (Boolean)invokeSyncOperation(ObjectNames.getJMSServerObjectName(), "destroyTopic", name);
+         Assert.assertEquals(true, result.booleanValue());
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException(e);
+      }
+   }
+
+   public void deleteTopicConnectionFactory(String name)
+   {
+      deleteConnectionFactory(name);
+   }
+
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public void startEmbeddedServer() throws Exception
+   {
+      Configuration conf = new ConfigurationImpl();
+      conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
+      conf.setSecurityEnabled(false);
+      embeddedServer = Messaging.newNullStorageMessagingService(conf);
+      
+      embeddedServer.start();
+      JMSServerManagerImpl serverManager = JMSServerManagerImpl.newJMSServerManagerImpl(embeddedServer.getServer());
+      serverManager.start();
+      serverManager.setInitialContext(createInitialContext());
+      
+      System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+      System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+
+      namingInfo = new NamingBeanImpl();
+      namingInfo.start();
+      jndiServer = new Main();
+      jndiServer.setNamingInfo(namingInfo);
+      jndiServer.setPort(1099);
+      jndiServer.setBindAddress("localhost");
+      jndiServer.setRmiPort(1098);
+      jndiServer.setRmiBindAddress("localhost");
+      jndiServer.start();
+   }
+   
+   public void stopEmbeddedServer() throws Exception
+   {
+      embeddedServer.stop();
+      jndiServer.stop();
+      namingInfo.stop();
+   }
+   
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   private Object invokeSyncOperation(ObjectName objectName, String operationName, Object... parameters)
+   {
+      ClientMessage message = clientSession.createClientMessage(false);
+      ManagementHelper.putOperationInvocation(message, objectName, operationName, parameters);
+      ClientMessage reply;
+      try
+      {
+         reply = requestor.request(message, 3000);
+      }
+      catch (Exception e)
+      {
+         throw new IllegalStateException("Exception while invoking " + operationName + " on " + objectName, e);
+      }
+      if (reply == null)
+      {
+         throw new IllegalStateException("no reply received when invoking " + operationName + " on " + objectName);
+      }
+      if (!ManagementHelper.hasOperationSucceeded(reply))
+      {
+         throw new IllegalStateException("opertation failed when invoking " + operationName +
+                                         " on " +
+                                         objectName +
+                                         ": " +
+                                         ManagementHelper.getOperationExceptionMessage(reply));
+
+      }
+      return reply.getProperty(new SimpleString(operationName));
+   }
+
+   // Inner classes -------------------------------------------------
+
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/Admin.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/Admin.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/Admin.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,152 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.admin;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * Simple Administration interface.
+ * <br />
+ * JMS Provider has to implement this 
+ * simple interface to be able to use the test suite.
+ */
+public interface Admin
+{
+
+   /**
+    * Returns the name of the JMS Provider.
+    *
+    * @return name of the JMS Provider
+    */
+   public String getName();
+
+   /** 
+    * Returns an <code>InitialContext</code> with correct properties from
+    * the JMS Provider.
+    *
+    * @return an <code>InitialContext</code> with correct properties from the JMS Provider.
+    */
+   public InitialContext createInitialContext() throws NamingException;
+
+   /** 
+    * Creates a <code>ConnectionFactory</code> and makes it available 
+    *from JNDI with name <code>name</code>.
+    *
+    * @since JMS 1.1
+    * @param name JNDI name of the <code>ConnectionFactory</code>
+    */
+   public void createConnectionFactory(String name);
+
+   /** 
+    * Creates a <code>QueueConnectionFactory</code> and makes it available 
+    *from JNDI with name <code>name</code>.
+    *
+    * @param name JNDI name of the <code>QueueConnectionFactory</code>
+    */
+   public void createQueueConnectionFactory(String name);
+
+   /** 
+    * Creates a <code>TopicConnectionFactory</code> and makes it available 
+    *from JNDI with name <code>name</code>.
+    *
+    * @param name JNDI name of the <code>TopicConnectionFactory</code>
+    */
+   public void createTopicConnectionFactory(String name);
+
+   /** 
+    * Creates a <code>Queue</code> and makes it available 
+    *from JNDI with name <code>name</code>.
+    *
+    * @param name JNDI name of the <code>Queue</code>
+    */
+   public void createQueue(String name);
+
+   /** 
+    * Creates a <code>Topic</code> and makes it available 
+    *from JNDI with name <code>name</code>.
+    *
+    * @param name JNDI name of the <code>Topic</code>
+    */
+   public void createTopic(String name);
+
+   /** 
+    * Removes the <code>Queue</code> of name <code>name</code> from JNDI and deletes it
+    *
+    * @param name JNDI name of the <code>Queue</code>
+    */
+   public void deleteQueue(String name);
+
+   /** 
+    * Removes the <code>Topic</code> of name <code>name</code> from JNDI and deletes it
+    *
+    * @param name JNDI name of the <code>Topic</code>
+    */
+   public void deleteTopic(String name);
+
+   /** 
+    * Removes the <code>ConnectionFactory</code> of name <code>name</code> from JNDI and deletes it
+    *
+    * @since JMS 1.1
+    * @param name JNDI name of the <code>ConnectionFactory</code>
+    */
+   public void deleteConnectionFactory(String name);
+
+   /** 
+    * Removes the <code>QueueConnectionFactory</code> of name <code>name</code> from JNDI and deletes it
+    *
+    * @param name JNDI name of the <code>QueueConnectionFactory</code>
+    */
+   public void deleteQueueConnectionFactory(String name);
+
+   /** 
+    * Removes the <code>TopicConnectionFactory</code> of name <code>name</code> from JNDI and deletes it
+    *
+    * @param name JNDI name of the <code>TopicConnectionFactory</code>
+    */
+   public void deleteTopicConnectionFactory(String name);
+
+   /**
+    * Optional method to start the server embedded (instead of running an external server)
+    */
+   public void startEmbeddedServer() throws Exception;
+   
+   /**
+    * Optional method to stop the server embedded (instead of running an external server)
+    */
+   public void stopEmbeddedServer() throws Exception;
+
+   /**
+    * Optional method for processing to be made after the Admin is instantiated and before
+    * it is used to create the administrated objects
+    */
+   void start() throws Exception;
+
+   /**
+    * Optional method for processing to be made after the administrated objects have been cleaned up
+    */
+   void stop() throws Exception;
+
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/AdminFactory.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/AdminFactory.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/AdminFactory.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,64 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.admin;
+
+import java.util.Properties;
+
+import org.jboss.util.NestedRuntimeException;
+
+public class AdminFactory
+{
+   private static final String PROP_NAME = "jms.provider.admin.class";
+
+   protected static String getAdminClassName(Properties props)
+   {
+      String adminClassName = props.getProperty(PROP_NAME);
+      return adminClassName;
+   }
+
+   public static Admin getAdmin(Properties props)
+   {
+      String adminClassName = getAdminClassName(props);
+      Admin admin = null;
+      if (adminClassName == null)
+      {
+         throw new NestedRuntimeException("Property " + PROP_NAME + " has not been found in input props");
+      }
+      try
+      {
+         Class adminClass = Class.forName(adminClassName);
+         admin = (Admin) adminClass.newInstance();
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new NestedRuntimeException("Class " + adminClassName + " not found.", e);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+      return admin;
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/admin/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,9 @@
+  <body>
+    Administration classes and interfaces used by the test suite to
+    manageJMS administrated object in a provider-independent way. 
+    <br />
+    Each JMS Provider has to implement the very simple Admin interface to be able to
+    use the test suite (see <a
+      href="http://www.objectweb.org/joram/current/doc/tests/index.html">documentation</a>).
+  </body>
+

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/ConnectionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/ConnectionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/ConnectionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,250 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): Andreas Mueller <am at iit.de>.                 
+ */
+
+package org.objectweb.jtests.jms.conform.connection;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test connections.
+ * 
+ * See JMS specifications, sec. 4.3.5 Closing a Connection
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: ConnectionTest.java,v 1.2 2007/06/15 20:55:20 csuconic Exp $
+ */
+public class ConnectionTest extends PTPTestCase
+{
+
+   /**
+    * Test that invoking the <code>acknowledge()</code> method of a received message 
+    * from a closed connection's session must throw an <code>IllegalStateException</code>.
+    */
+   public void testAcknowledge()
+   {
+      try
+      {
+         receiverConnection.stop();
+         receiverSession = receiverConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+         receiver.close(); // Before assigning a new receiver, we need to close the old one...
+                           // Not closing it could cause load balancing between receivers.
+                           // Not having this close might be valid for JORAM or JBossMQ, but it's not valid for JBossMessaging (and still legal)
+
+         receiver = receiverSession.createReceiver(receiverQueue);
+         receiverConnection.start();
+
+         Message message = senderSession.createMessage();
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         receiverConnection.close();
+         m.acknowledge();
+         fail("�4.3.5 Invoking the acknowledge method of a received message from a closed "
+               + "connection's session must throw a [javax.jms.]IllegalStateException.\n");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("�4.3.5 Invoking the acknowledge method of a received message from a closed "
+               + "connection's session must throw a [javax.jms.]IllegalStateException, not a " + e);
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("�4.3.5 Invoking the acknowledge method of a received message from a closed "
+               + "connection's session must throw an [javax.jms.]IllegalStateException "
+               + "[not a java.lang.IllegalStateException]");
+      }
+   }
+
+   /**
+    * Test that an attempt to use a <code>Connection</code> which has been closed 
+    * throws a <code>javax.jms.IllegalStateException</code>.
+    */
+   public void testUseClosedConnection()
+   {
+      try
+      {
+         senderConnection.close();
+         senderConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         fail("Should raise a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException");
+      }
+   }
+
+   /**
+    * Test that a <code>MessageProducer</code> can send messages while a 
+    * <code>Connection</code> is stopped.
+    */
+   public void testMessageSentWhenConnectionClosed()
+   {
+      try
+      {
+         senderConnection.stop();
+         Message message = senderSession.createTextMessage();
+         sender.send(message);
+
+         receiver.receive(TestConfig.TIMEOUT);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that closing a closed connectiondoes not throw an exception.
+    */
+   public void testCloseClosedConnection()
+   {
+      try
+      {
+         // senderConnection is already started
+         // we close it once
+         senderConnection.close();
+         // we close it a second time
+         senderConnection.close();
+      }
+      catch (Exception e)
+      {
+         fail("�4.3.5 Closing a closed connection must not throw an exception.\n");
+      }
+   }
+
+   /**
+    * Test that starting a started connection is ignored
+    */
+   public void testStartStartedConnection()
+   {
+      try
+      {
+         // senderConnection is already started
+         // start it again should be ignored
+         senderConnection.start();
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that stopping a stopped connection is ignored
+    */
+   public void testStopStoppedConnection()
+   {
+      try
+      {
+         // senderConnection is started
+         // we stop it once
+         senderConnection.stop();
+         // stopping it a second time is ignored
+         senderConnection.stop();
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that delivery of message is stopped if the message consumer connection is stopped
+    */
+   public void testStopConsumerConnection()
+   {
+      try
+      {
+         receiverConnection.stop();
+
+         receiver.setMessageListener(new MessageListener()
+         {
+            public void onMessage(Message m)
+            {
+               try
+               {
+                  fail("The message must not be received, the consumer connection is stopped");
+                  assertEquals("test", ((TextMessage) m).getText());
+               }
+               catch (JMSException e)
+               {
+                  fail(e);
+               }
+            }
+         });
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("test");
+         sender.send(message);
+         synchronized (this)
+         {
+            try
+            {
+               wait(1000);
+            }
+            catch (Exception e)
+            {
+               fail(e);
+            }
+         }
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(ConnectionTest.class);
+   }
+
+   public ConnectionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,183 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): Andreas Mueller <am at iit.de>
+ */
+
+package org.objectweb.jtests.jms.conform.connection;
+
+import javax.jms.InvalidClientIDException;
+import javax.jms.JMSException;
+import javax.jms.TopicConnection;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PubSubTestCase;
+
+/**
+ * Test topic-specific connection features.
+ *
+ * Test setting of client ID which is relevant only for Durable Subscribtion
+ */
+
+public class TopicConnectionTest extends PubSubTestCase
+{
+
+   /**
+    * Test that a call to <code>setClientID</code> will throw an 
+    * <code>IllegalStateException</code> if a client ID has already been set
+    * see JMS javadoc 
+    * http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#setClientID(java.lang.String)
+    */
+   public void testSetClientID_1()
+   {
+      try
+      {
+         // we start from a clean state for the connection
+         subscriberConnection.close();
+         subscriberConnection = null;
+
+         subscriberConnection = subscriberTCF.createTopicConnection();
+         // if the JMS provider does not set a client ID, we do.
+         if (subscriberConnection.getClientID() == null)
+         {
+            subscriberConnection.setClientID("testSetClientID_1");
+            assertEquals("testSetClientID_1", subscriberConnection.getClientID());
+         }
+         // now the connection has a client ID (either "testSetClientID_1" or one set by the provider
+         assertTrue(subscriberConnection.getClientID() != null);
+
+         // a attempt to set a client ID should now throw an IllegalStateException
+         subscriberConnection.setClientID("another client ID");
+         fail("Should raise a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException");
+      }
+   }
+
+   /** 
+    * Test that a call to <code>setClientID</code> can occur only after connection creation 
+    * and before any other action on the connection.
+    * <em>This test is relevant only if the ID is set by the JMS client</em>
+    * see JMS javadoc 
+    * http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#setClientID(java.lang.String)
+    */
+   public void testSetClientID_2()
+   {
+      try
+      {
+         // we start from a clean state for the first connection
+         subscriberConnection.close();
+         subscriberConnection = null;
+
+         subscriberConnection = subscriberTCF.createTopicConnection();
+         // if the JMS provider has set a client ID, this test is not relevant
+         if (subscriberConnection.getClientID() != null)
+         {
+            return;
+         }
+
+         //we start the connection 
+         subscriberConnection.start();
+
+         // an attempt to set the client ID now should throw a IllegalStateException
+         subscriberConnection.setClientID("testSetClientID_2");
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException");
+      }
+   }
+
+   /**
+    * Test that if another connection with the same clientID is already running when 
+    * <code>setClientID</code> is called, the JMS provider should detect the duplicate
+    * ID and throw an <code>InvalidClientIDException</code>
+    * <em>This test is relevant only if the ID is set by the JMS client</em>
+    * see JMS javadoc 
+    * http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#setClientID(java.lang.String)
+    * 
+    *... This test is not valid... as getClientID is caleld before setClientID
+    */
+   /*public void testSetClientID_3()
+   {
+      try
+      {
+         // we start from a clean state for the first connection
+         subscriberConnection.close();
+         subscriberConnection = null;
+
+         subscriberConnection = subscriberTCF.createTopicConnection();
+         // if the JMS provider has set a client ID, this test is not relevant
+         if (subscriberConnection.getClientID() != null)
+         {
+            return;
+         }
+         // the JMS provider has not set a client ID, so we do
+         subscriberConnection.setClientID("testSetClientID_3");
+         assertEquals("testSetClientID_3", subscriberConnection.getClientID());
+
+         // we create a new connection and try to set the same ID than for subscriberConnection
+         TopicConnection connection_2 = subscriberTCF.createTopicConnection();
+         assertTrue(connection_2.getClientID() == null);
+         connection_2.setClientID("testSetClientID_3");
+         fail("Should throw a javax.jms.InvalidClientIDException");
+      }
+      catch (InvalidClientIDException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }*/
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(TopicConnectionTest.class);
+   }
+
+   public TopicConnectionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/connection/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+  <body>
+    Tests JMS <em>Connection</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageBodyTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageBodyTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageBodyTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,131 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.message;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageNotWriteableException;
+import javax.jms.TextMessage;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Tests on message body.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: MessageBodyTest.java,v 1.1 2007/03/29 04:28:37 starksm Exp $
+ */
+public class MessageBodyTest extends PTPTestCase
+{
+
+   /**
+    * Test that the <code>TextMessage.clearBody()</code> method does nto clear the 
+    * message properties.
+    */
+   public void testClearBody_2()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("prop", "foo");
+         message.clearBody();
+         assertEquals("sec. 3.11.1 Clearing a message's body does not clear its property entries.\n",
+                      "foo",
+                      message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>TextMessage.clearBody()</code> effectively clear the body of the message
+    */
+   public void testClearBody_1()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("bar");
+         message.clearBody();
+         assertEquals("sec. 3 .11.1 the clearBody method of Message resets the value of the message body " + "to the 'empty' initial message value as set by the message type's create "
+                               + "method provided by Session.\n",
+                      null,
+                      message.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>TextMessage.setText()</code> method on a 
+    * received message raises a <code>javax.jms.MessageNotWriteableException</code>.
+    */
+   public void testWriteOnReceivedBody()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("foo");
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of TextMessage.\n", m instanceof TextMessage);
+         TextMessage msg = (TextMessage)m;
+         msg.setText("bar");
+         fail("should raise a MessageNotWriteableException (sec. 3.11.2)");
+      }
+      catch (MessageNotWriteableException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   public MessageBodyTest(String name)
+   {
+      super(name);
+   }
+   
+   @Override
+   protected void setUp() throws Exception
+   {
+      
+      super.setUp();
+   }
+   
+   @Override
+   protected void tearDown() throws Exception
+   {      
+      super.tearDown();
+      
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageDefaultTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageDefaultTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageDefaultTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,75 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.message;
+
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.JMSTestCase;
+
+/**
+ * Test the default constants of the <code>javax.jms.Message</code> interface.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: MessageDefaultTest.java,v 1.1 2007/03/29 04:28:37 starksm Exp $
+ */
+public class MessageDefaultTest extends JMSTestCase
+{
+
+   /**
+    * test that the <code>DEFAULT_DELIVERY_MODE</code> of <code>javax.jms.Message</code>
+    * corresponds to <code>javax.jms.Delivery.PERSISTENT</code>.
+    */
+   public void testDEFAULT_DELIVERY_MODE()
+   {
+      assertEquals("The delivery mode is persistent by default.\n", DeliveryMode.PERSISTENT,
+            Message.DEFAULT_DELIVERY_MODE);
+   }
+
+   /**
+    * test that the <code>DEFAULT_PRIORITY</code> of <code>javax.jms.Message</code>
+    * corresponds to 4.
+    */
+   public void testDEFAULT_PRIORITY()
+   {
+      assertEquals("The default priority is 4.\n", 4, Message.DEFAULT_PRIORITY);
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(MessageDefaultTest.class);
+   }
+
+   public MessageDefaultTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageTypeTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageTypeTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/MessageTypeTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,420 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.message;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.StreamMessage;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the different types of messages provided by JMS.
+ * <br />
+ * JMS provides 6 types of messages which differs by the type of their body:
+ * <ol>
+ *   <li><code>Message</code> which doesn't have a body</li>
+ *   <li><code>TextMessage</code> with a <code>String</code> as body</li>
+ *   <li><code>ObjectMessage</code> with any <code>Object</code> as body</li>
+ *   <li><code>BytesMessage</code> with a body made of <code>bytes</code></li>
+ *   <li><code>MapMessage</code> with name-value pairs of Java primitives in its body</li>
+ *   <li><code>StreamMessage</code> with a stream of Java primitives as body</li>
+ *  </ol>
+ * <br />
+ * For each of this type of message, we test that a message can be sent and received
+ * with an empty body or not.
+ * 
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: MessageTypeTest.java,v 1.1 2007/03/29 04:28:37 starksm Exp $
+ */
+public class MessageTypeTest extends PTPTestCase
+{
+
+   /**
+    * Send a <code>StreamMessage</code> with 2 Java primitives in its body (a <code>
+    * String</code> and a <code>double</code>).
+    * <br />
+    * Receive it and test that the values of the primitives of the body are correct
+    */
+   public void testStreamMessage_2()
+   {
+      try
+      {
+         StreamMessage message = senderSession.createStreamMessage();
+         message.writeString("pi");
+         message.writeDouble(3.14159);
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of StreamMessage.\n", m instanceof StreamMessage);
+         StreamMessage msg = (StreamMessage) m;
+         assertEquals("pi", msg.readString());
+         assertEquals(3.14159, msg.readDouble(), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>StreamMessage</code> with an empty body.
+    * <br />
+    * Receive it and test if the message is effectively an instance of 
+    * <code>StreamMessage</code>
+    */
+   public void testStreamMessage_1()
+   {
+      try
+      {
+         StreamMessage message = senderSession.createStreamMessage();
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of StreamMessage.\n", msg instanceof StreamMessage);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test in MapMessage the conversion between <code>getObject("foo")</code> and
+    * <code>getDouble("foo")</code> (the later returning a java.lang.Double and the former a double)
+    */
+   public void testMapMessageConversion()
+   {
+      try
+      {
+         MapMessage message = senderSession.createMapMessage();
+         message.setDouble("pi", 3.14159);
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of MapMessage.\n", m instanceof MapMessage);
+         MapMessage msg = (MapMessage) m;
+         assertTrue(msg.getObject("pi") instanceof Double);
+         assertEquals(3.14159, ((Double) msg.getObject("pi")).doubleValue(), 0);
+         assertEquals(3.14159, msg.getDouble("pi"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the if the name parameter of the set methods of a <code>MapMessage</code> is <code>null</code>, 
+    * the method must throw the error <code>java.lang.IllegalArgumentException</code>.
+    * <br />
+    * @since JMS 1.1
+    */
+   public void testNullInSetMethodsForMapMessage()
+   {
+      try
+      {
+         MapMessage message = senderSession.createMapMessage();
+         message.setBoolean(null, true);
+         fail("Should throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw an IllegalArgumentException, not a" + e);
+      }
+   }
+
+   /**
+    * Test that the if the name parameter of the set methods of a <code>MapMessage</code> is an empty String,
+    * the method must throw the error <code>java.lang.IllegalArgumentException</code>.
+    * <br />
+    * @since JMS 1.1
+    */
+   public void testEmptyStringInSetMethodsForMapMessage()
+   {
+      try
+      {
+         MapMessage message = senderSession.createMapMessage();
+         message.setBoolean("", true);
+         fail("Should throw an IllegalArgumentException");
+      }
+      catch (IllegalArgumentException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw an IllegalArgumentException, not a" + e);
+      }
+   }
+
+   /**
+    * Test that the <code>MapMessage.getMapNames()</code> method returns an
+    * empty <code>Enumeration</code> when no map has been defined before.
+    * <br />
+    * Also test that the same method returns the correct names of the map.
+    */
+   public void testgetMapNames()
+   {
+      try
+      {
+         MapMessage message = senderSession.createMapMessage();
+         Enumeration e = message.getMapNames();
+         assertTrue("No map yet defined.\n", !e.hasMoreElements());
+         message.setDouble("pi", 3.14159);
+         e = message.getMapNames();
+         assertEquals("pi", (String) (e.nextElement()));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>MapMessage</code> with 2 Java primitives in its body (a <code>
+    * String</code> and a <code>double</code>).
+    * <br />
+    * Receive it and test that the values of the primitives of the body are correct
+    */
+   public void testMapMessage_2()
+   {
+      try
+      {
+         MapMessage message = senderSession.createMapMessage();
+         message.setString("name", "pi");
+         message.setDouble("value", 3.14159);
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of MapMessage.\n", m instanceof MapMessage);
+         MapMessage msg = (MapMessage) m;
+         assertEquals("pi", msg.getString("name"));
+         assertEquals(3.14159, msg.getDouble("value"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>MapMessage</code> with an empty body.
+    * <br />
+    * Receive it and test if the message is effectively an instance of 
+    * <code>MapMessage</code>
+    */
+   public void testMapMessage_1()
+   {
+      try
+      {
+         MapMessage message = senderSession.createMapMessage();
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of MapMessage.\n", msg instanceof MapMessage);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send an <code>ObjectMessage</code> with a <code>Vector</code> (composed of a <code>
+    * String</code> and a <code>double</code>) in its body.
+    * <br />
+    * Receive it and test that the values of the primitives of the body are correct
+    */
+   public void testObjectMessage_2()
+   {
+      try
+      {
+         Vector vector = new Vector();
+         vector.add("pi");
+         vector.add(new Double(3.14159));
+
+         ObjectMessage message = senderSession.createObjectMessage();
+         message.setObject(vector);
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of ObjectMessage.\n", m instanceof ObjectMessage);
+         ObjectMessage msg = (ObjectMessage) m;
+         assertEquals(vector, msg.getObject());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>ObjectMessage</code> with an empty body.
+    * <br />
+    * Receive it and test if the message is effectively an instance of 
+    * <code>ObjectMessage</code>
+    */
+   public void testObjectMessage_1()
+   {
+      try
+      {
+         ObjectMessage message = senderSession.createObjectMessage();
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of ObjectMessage.\n", msg instanceof ObjectMessage);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>BytesMessage</code> with 2 Java primitives in its body (a <code>
+    * String</code> and a <code>double</code>).
+    * <br />
+    * Receive it and test that the values of the primitives of the body are correct
+    */
+   public void testBytesMessage_2()
+   {
+      try
+      {
+         byte[] bytes = new String("pi").getBytes();
+         BytesMessage message = senderSession.createBytesMessage();
+         message.writeBytes(bytes);
+         message.writeDouble(3.14159);
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of BytesMessage.\n", m instanceof BytesMessage);
+         BytesMessage msg = (BytesMessage) m;
+         byte[] receivedBytes = new byte[bytes.length];
+         msg.readBytes(receivedBytes);
+         assertEquals(new String(bytes), new String(receivedBytes));
+         assertEquals(3.14159, msg.readDouble(), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>BytesMessage</code> with an empty body.
+    * <br />
+    * Receive it and test if the message is effectively an instance of 
+    * <code>BytesMessage</code>
+    */
+   public void testBytesMessage_1()
+   {
+      try
+      {
+         BytesMessage message = senderSession.createBytesMessage();
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of BytesMessage.\n", msg instanceof BytesMessage);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>TextMessage</code> with a <code>String</code> in its body.
+    * <br />
+    * Receive it and test that the received <code>String</code> corresponds to
+    * the sent one.
+    */
+   public void testTextMessage_2()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testTextMessage_2");
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of TextMessage.\n", m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         assertEquals("testTextMessage_2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Send a <code>TextMessage</code> with an empty body.
+    * <br />
+    * Receive it and test if the message is effectively an instance of 
+    * <code>TextMessage</code>
+    */
+   public void testTextMessage_1()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("The message should be an instance of TextMessage.\n", msg instanceof TextMessage);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(MessageTypeTest.class);
+   }
+
+   public MessageTypeTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/MessageHeaderTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,298 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): Andreas Mueller <am at iit.de>.
+ */
+
+package org.objectweb.jtests.jms.conform.message.headers;
+
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.TemporaryQueue;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the headers of a message
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: MessageHeaderTest.java,v 1.1 2007/03/29 04:28:36 starksm Exp $
+ */
+public class MessageHeaderTest extends PTPTestCase
+{
+
+   /**
+    * Test that the <code>MessageProducer.setPriority()</code> changes effectively
+    * priority of the message.
+    */
+   public void testJMSPriority_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         sender.send(message);
+         sender.setPriority(9);
+         sender.send(message);
+         assertEquals("sec. 3.4.9 After completion of the send it holds the value specified by the "
+               + "method sending the message.\n", 9, message.getJMSPriority());
+
+         receiver.receive(TestConfig.TIMEOUT);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the priority set by <code>Message.setJMSPriority()</code> is ignored when a 
+    * message is sent and that it holds the value specified when sending the message (i.e. 
+    * <code>Message.DEFAULT_PRIORITY</code> in this test).
+    */
+   public void testJMSPriority_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setJMSPriority(0);
+         sender.send(message);
+         assertTrue("sec. 3.4.9 When a message is sent this value is ignored.\n", message.getJMSPriority() != 0);
+         assertEquals("sec. 3.4.9 After completion of the send it holds the value specified by the "
+               + "method sending the message.\n", Message.DEFAULT_PRIORITY, message.getJMSPriority());
+
+         receiver.receive(TestConfig.TIMEOUT);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the value of the <code>JMSExpiration<code> header field is the same
+    * for the sent message and the received one.
+    */
+   public void testJMSExpiration()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("sec. 3.4.9 When a message is received its JMSExpiration header field contains this same "
+               + "value [i.e. set on return of the send method].\n", message.getJMSExpiration(), msg.getJMSExpiration());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>JMSMessageID</code> is set by the provider when the <code>send</code> method returns 
+    * and that it starts with <code>"ID:"</code>.
+    */
+   public void testJMSMessageID_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         sender.send(message);
+         assertTrue("sec. 3.4.3 When the send method returns it contains a provider-assigned value.\n", message
+               .getJMSMessageID() != null);
+         assertTrue("sec. 3.4.3 All JMSMessageID values must start with the prefix 'ID:'.\n", message.getJMSMessageID()
+               .startsWith("ID:"));
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("sec. 3.4.3 All JMSMessageID values must start with the prefix 'ID:'.\n", msg.getJMSMessageID()
+               .startsWith("ID:"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>JMSMessageID</code> header field value is 
+    * ignored when the message is sent.
+    */
+   public void testJMSMessageID_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setJMSMessageID("ID:foo");
+         sender.send(message);
+         assertTrue("sec. 3.4.3 When a message is sent this value is ignored.\n", message.getJMSMessageID() != "ID:foo");
+         receiver.receive(TestConfig.TIMEOUT);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>JMSDeliveryMode</code> header field value is ignored
+    * when the message is sent and that it holds the value specified by the sending 
+    * method (i.e. <code>Message.DEFAULT_DELIVERY_MODE</code> in this test when the message is received.
+    */
+   public void testJMSDeliveryMode()
+   {
+      try
+      {
+         // sender has been created with the DEFAULT_DELIVERY_MODE which is PERSISTENT
+         assertEquals(DeliveryMode.PERSISTENT, sender.getDeliveryMode());
+         Message message = senderSession.createMessage();
+         // send a message specfiying NON_PERSISTENT for the JMSDeliveryMode header field
+         message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
+         sender.send(message);
+         assertTrue("sec. 3.4.2 When a message is sent this value is ignored",
+               message.getJMSDeliveryMode() != DeliveryMode.NON_PERSISTENT);
+         assertEquals("sec. 3.4.2 After completion of the send it holds the delivery mode specified "
+               + "by the sending method (persistent by default).\n", Message.DEFAULT_DELIVERY_MODE, message
+               .getJMSDeliveryMode());
+
+         receiver.receive(TestConfig.TIMEOUT);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>JMSDestination</code> header field value is ignored when the message
+    * is sent and that after completion of the sending method, it holds the <code>Destination</code>
+    * specified by the sending method.
+    * Also test that the value of the header on the received message is the same that on the sent message.
+    */
+   public void testJMSDestination()
+   {
+      try
+      {
+         admin.createQueue("anotherQueue");
+         Context ctx = admin.createInitialContext();
+         Queue anotherQueue = (Queue) ctx.lookup("anotherQueue");
+         assertTrue(anotherQueue != senderQueue);
+
+         // set the JMSDestination header field to the anotherQueue Destination
+         Message message = senderSession.createMessage();
+         message.setJMSDestination(anotherQueue);
+         sender.send(message);
+         assertTrue("sec. 3.4.1 When a message is sent this value is ignored.\n",
+               message.getJMSDestination() != anotherQueue);
+         assertEquals("sec. 3.4.1 After completion of the send it holds the destination object specified "
+               + "by the sending method.\n", senderQueue, message.getJMSDestination());
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("sec. 3.4.1 When a message is received, its destination value must be equivalent  "
+               + " to the value assigned when it was sent.\n", ((Queue) message.getJMSDestination()).getQueueName(),
+               ((Queue) msg.getJMSDestination()).getQueueName());
+
+         admin.deleteQueue("anotherQueue");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+      catch (NamingException e)
+      {
+         fail(e.getMessage());
+      }
+   }
+
+   /**
+    * Test that a <code>Destination</code> set by the <code>setJMSReplyTo()</code>
+    * method on a sended message corresponds to the <code>Destination</code> get by 
+    * the </code>getJMSReplyTo()</code> method.
+    */
+   public void testJMSReplyTo_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setJMSReplyTo(senderQueue);
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         Destination dest = msg.getJMSReplyTo();
+         assertTrue("JMS ReplyTo header field should be a Queue", dest instanceof Queue);
+         Queue replyTo = (Queue) dest;
+         assertEquals("JMS ReplyTo header field should be equals to the sender queue",
+               replyTo.getQueueName(), senderQueue.getQueueName());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that if the JMS ReplyTo header field has been set as a <code>TemporaryQueue</code>,
+    * it will be rightly get also as a <code>TemporaryQueue</code> 
+    * (and not only as a <code>Queue</code>).
+    */
+   public void testJMSReplyTo_2()
+   {
+      try
+      {
+         TemporaryQueue tempQueue = senderSession.createTemporaryQueue();
+         Message message = senderSession.createMessage();
+         message.setJMSReplyTo(tempQueue);
+         sender.send(message);
+
+         Message msg = receiver.receive(TestConfig.TIMEOUT);
+         Destination dest = msg.getJMSReplyTo();
+         assertTrue("JMS ReplyTo header field should be a TemporaryQueue", dest instanceof TemporaryQueue);
+         Queue replyTo = (Queue) dest;
+         assertEquals("JMS ReplyTo header field should be equals to the temporary queue", replyTo.getQueueName(), tempQueue.getQueueName());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(MessageHeaderTest.class);
+   }
+
+   public MessageHeaderTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/headers/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+ <body>
+    Tests JMS <em>Message Header Fields</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+ <body>
+    Tests JMS <em>Message</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,240 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.message.properties;
+
+import java.util.Enumeration;
+
+import javax.jms.ConnectionMetaData;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the JMSX defined properties.
+ * <br />
+ *  See JMS Specification, sec. 3.5.9 JMS Defined Properties
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: JMSXPropertyTest.java,v 1.2 2007/06/19 23:32:34 csuconic Exp $
+ */
+public class JMSXPropertyTest extends PTPTestCase
+{
+
+   /**
+    * Test that the JMSX property <code>JMSXGroupID</code> is supported.
+    */
+   public void testSupportsJMSXGroupID()
+   {
+      try
+      {
+         boolean found = false;
+         ConnectionMetaData metaData = senderConnection.getMetaData();
+         Enumeration enumeration = metaData.getJMSXPropertyNames();
+         while (enumeration.hasMoreElements())
+         {
+            String jmsxPropertyName = (String) enumeration.nextElement();
+            if (jmsxPropertyName.equals("JMSXGroupID"))
+            {
+               found = true;
+            }
+         }
+         assertTrue("JMSXGroupID property is not supported", found);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the JMSX property <code>JMSXGroupID</code> works
+    */
+   public void testJMSXGroupID_1()
+   {
+      try
+      {
+         String groupID = "testSupportsJMSXGroupID_1:group";
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("JMSXGroupID", groupID);
+         message.setText("testSupportsJMSXGroupID_1");
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         assertEquals(groupID, msg.getStringProperty("JMSXGroupID"));
+         assertEquals("testSupportsJMSXGroupID_1", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the JMSX property <code>JMSXGroupSeq</code> is supported.
+    */
+   public void testSupportsJMSXGroupSeq()
+   {
+      try
+      {
+         boolean found = false;
+         ConnectionMetaData metaData = senderConnection.getMetaData();
+         Enumeration enumeration = metaData.getJMSXPropertyNames();
+         while (enumeration.hasMoreElements())
+         {
+            String jmsxPropertyName = (String) enumeration.nextElement();
+            if (jmsxPropertyName.equals("JMSXGroupSeq"))
+            {
+               found = true;
+            }
+         }
+         assertTrue("JMSXGroupSeq property is not supported", found);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the JMSX property <code>JMSXDeliveryCount</code> is supported.
+    */
+   public void testSupportsJMSXDeliveryCount()
+   {
+      try
+      {
+         boolean found = false;
+         ConnectionMetaData metaData = senderConnection.getMetaData();
+         Enumeration enumeration = metaData.getJMSXPropertyNames();
+         while (enumeration.hasMoreElements())
+         {
+            String jmsxPropertyName = (String) enumeration.nextElement();
+            if (jmsxPropertyName.equals("JMSXDeliveryCount"))
+            {
+               found = true;
+            }
+         }
+         assertTrue("JMSXDeliveryCount property is not supported", found);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the JMSX property <code>JMSXDeliveryCount</code> works.
+    */
+   public void testJMSXDeliveryCount()
+   {
+      try
+      {
+         senderConnection.stop();
+         // senderSession has been created as non transacted
+         // we create it again but as a transacted session
+         senderSession = senderConnection.createQueueSession(true, 0);
+         assertEquals(true, senderSession.getTransacted());
+         // we create again the sender
+         sender = senderSession.createSender(senderQueue);
+         senderConnection.start();
+
+         receiverConnection.stop();
+         // receiverSession has been created as non transacted
+         // we create it again but as a transacted session
+         receiverSession = receiverConnection.createQueueSession(true, 0);
+         assertEquals(true, receiverSession.getTransacted());
+         // we create again the receiver
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue);
+         receiverConnection.start();
+
+         // we send a message...
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testJMSXDeliveryCount");
+         sender.send(message);
+         // ... and commit the *producer* transaction
+         senderSession.commit();
+
+         // we receive a message...
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m != null);
+         assertTrue(m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         // ... which is the one which was sent...
+         assertEquals("testJMSXDeliveryCount", msg.getText());
+         // ...and has not been redelivered
+         assertEquals(false, msg.getJMSRedelivered());
+         // ... so it has been delivered once
+         int jmsxDeliveryCount = msg.getIntProperty("JMSXDeliveryCount");
+         assertEquals(1, jmsxDeliveryCount);
+         // we rollback the *consumer* transaction
+         receiverSession.rollback();
+
+         // we receive again a message
+         m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m != null);
+         assertTrue(m instanceof TextMessage);
+         msg = (TextMessage) m;
+         // ... which is still the one which was sent...
+         assertEquals("testJMSXDeliveryCount", msg.getText());
+         // .. but this time, it has been redelivered
+         assertEquals(true, msg.getJMSRedelivered());
+         // ... so it has been delivered a second time
+         jmsxDeliveryCount = msg.getIntProperty("JMSXDeliveryCount");
+         assertEquals(2, jmsxDeliveryCount);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+      catch (Exception e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(JMSXPropertyTest.class);
+   }
+
+   public JMSXPropertyTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyConversionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyConversionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyConversionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,1577 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.message.properties;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageFormatException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+
+/**
+ * Test the conversion of primitive types for the <code>javax.jms.Message</code> properties.
+ * <br />
+ * See JMS Specification, sec. 3.5.4 Property Value Conversion and the corresponding table (p.33-34).
+ * <br />
+ * The method name <code>testXXX2YYY</code> means that we test if a property
+ * which has been set as a <code>XXX</code> type can be read as a <code>YYY</code> type, 
+ * where <code>XXX</code> and <code>YYY</code> can be <code>boolean, byte, short, long, float
+ * double</code> or <code>String</code>.
+ *
+ * <pre>
+ *          ---------------------------------------------------------------|
+ *          | boolean | byte | short | int | long | float | double | String| 
+ * |-----------------------------------------------------------------------|
+ * |boolean |    X                                                     X   |
+ * |byte    |            X       X      X     X                        X   |
+ * |short   |                    X      X     X                        X   |
+ * |int     |                           X     X                        X   |
+ * |long    |                                 X                        X   |
+ * |float   |                                         X       X        X   |
+ * |double  |                                                 X        X   |
+ * |String  |    Y       Y       Y      Y     Y       Y       Y        X   |
+ * |-----------------------------------------------------------------------|
+ * </pre>
+ * A value set as the row type can be read as the column type.
+ * <br />
+ * The unmarked cases must throw a <code>javax.jms.MessageFormatException</code>
+ * <br />
+ * The cases marked with a Y should throw a <code>java.lang.MessageFormatException</code> <strong>if</strong> the
+ * String is not a correct representation of the column type (otherwise, it returns the property). 
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: MessagePropertyConversionTest.java,v 1.1 2007/03/29 04:28:34 starksm Exp $
+ */
+public class MessagePropertyConversionTest extends PTPTestCase
+{
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>java.lang.String</code>.
+    */
+   public void testString2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         assertEquals("3.14159", message.getStringProperty("pi"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>double</code> throws a <code>java.lang.NuberFormatException</code>
+    * if the <code>String</code> is not a correct representation for a <code>double</code> 
+    * (e.g. <code>"not a number"</code>).
+    */
+   public void testString2Double_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "not_a_number");
+         message.getDoubleProperty("pi");
+         fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException "
+               + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
+      }
+      catch (java.lang.NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>double</code> as long as the <code>String</code>
+    * is a correct representation of a <code>double</code> (e.g. <code>"3.14159"</code>).
+    */
+   public void testString2Double_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         assertEquals(3.14159, message.getDoubleProperty("pi"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>float</code> throws a <code>java.lang.NuberFormatException</code>
+    * if the <code>String</code> is not a correct representation for a <code>float</code> 
+    * (e.g. <code>"not_a_number"</code>).
+    */
+   public void testString2Float_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "not_a_number");
+         message.getFloatProperty("pi");
+         fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException "
+               + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
+      }
+      catch (java.lang.NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>float</code> as long as the <code>String</code>
+    * is a correct representation of a <code>float</code> (e.g. <code>"3.14159"</code>).
+    */
+   public void testString2Float_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         assertEquals(3.14159F, message.getFloatProperty("pi"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>long</code> throws a <code>java.lang.NuberFormatException</code>
+    * if the <code>String</code> is not a correct representation for a <code>long</code> 
+    * (e.g. <code>"3.14159"</code>).
+    */
+   public void testString2Long_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         message.getLongProperty("pi");
+         fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException "
+               + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
+      }
+      catch (java.lang.NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>long</code> as long as the <code>String</code>
+    * is a correct representation of a <code>long</code> (e.g. <code>"0"</code>).
+    */
+   public void testString2Long_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("prop", "0");
+         assertEquals(0l, message.getLongProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>int</code> throws a <code>java.lang.NuberFormatException</code>
+    * if the <code>String</code> is not a correct representation for a <code>int</code> 
+    * (e.g. <code>"3.14159"</code>).
+    */
+   public void testString2Int_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         message.getIntProperty("pi");
+         fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException "
+               + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
+      }
+      catch (java.lang.NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>int</code> as long as the <code>String</code>
+    * is a correct representation of a <code>int</code> (e.g. <code>"0"</code>).
+    */
+   public void testString2Int_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("prop", "0");
+         assertEquals(0, message.getIntProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>short</code> throws a <code>java.lang.NuberFormatException</code>
+    * if the <code>String</code> is not a correct representation for a <code>short</code> 
+    * (e.g. <code>"3.14159"</code>).
+    */
+   public void testString2Short_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         message.getShortProperty("pi");
+         fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException "
+               + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
+      }
+      catch (java.lang.NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>short</code> as long as the <code>String</code>
+    * is a correct representation of a <code>short</code> (e.g. <code>"0"</code>).
+    */
+   public void testString2Short_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("prop", "0");
+         assertEquals((short) 0, message.getShortProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>byte</code> throws a <code>java.lang.NuberFormatException</code>
+    * if the <code>String</code> is not a correct representation for a <code>byte</code> 
+    * (e.g. <code>"3.14159"</code>).
+    */
+   public void testString2Byte_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("pi", "3.14159");
+         message.getByteProperty("pi");
+         fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException "
+               + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
+      }
+      catch (java.lang.NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>byte</code> if the <code>String</code>
+    * is a correct representation of a <code>byte</code> (e.g. <code>"0"</code>).
+    */
+   public void testString2Byte_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("prop", "0");
+         assertEquals((byte) 0, message.getByteProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * to get it as a <code>boolean</code> returns <code>true</code> if the property is not 
+    * null and is equal, ignoring case, to the string "true" (.eg. "True" is ok), else it
+    * returns <code>false</code> (e.g. "test")
+    */
+   public void testString2Boolean_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("prop", "test");
+         assertEquals(false, message.getBooleanProperty("prop"));
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>java.lang.String</code>, 
+    * it can also be read as a <code>boolean</code> if the <code>String</code>
+    * is a correct representation of a <code>boolean</code> (e.g. <code>"true"</code>).
+    */
+   public void testString2Boolean_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setStringProperty("prop", "true");
+         assertEquals(true, message.getBooleanProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * it can also be read as a <code>java.lang.String</code>.
+    */
+   public void testDouble2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setDoubleProperty("prop", 127.0);
+         assertEquals("127.0", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * it can also be read as a <code>double</code>.
+    */
+   public void testDouble2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setDoubleProperty("prop", 127.0);
+         assertEquals(127.0, message.getDoubleProperty("prop"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testDouble2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setDoubleProperty("prop", 127.0);
+         message.getFloatProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testDouble2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setDoubleProperty("prop", 127.0);
+         message.getLongProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * to get is as an <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testDouble2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setDoubleProperty("prop", 127.0);
+         message.getIntProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testDouble2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to short
+         message.setDoubleProperty("prop", 127.0);
+         message.getShortProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testDouble2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to byte
+         message.setDoubleProperty("prop", 127.0);
+         message.getByteProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>double</code>, 
+    * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testDouble2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can be converted to boolean
+         message.setDoubleProperty("prop", 127.0);
+         message.getBooleanProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * it can also be read as a <code>String</code>.
+    */
+   public void testFloat2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setFloatProperty("prop", 127.0F);
+         assertEquals("127.0", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * it can also be read as a <code>double</code>.
+    */
+   public void testFloat2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setFloatProperty("prop", 127.0F);
+         assertEquals(127.0, message.getDoubleProperty("prop"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * it can also be read as a <code>float</code>.
+    */
+   public void testFloat2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setFloatProperty("prop", 127.0F);
+         assertEquals(127.0F, message.getFloatProperty("prop"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testFloat2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setFloatProperty("prop", 127.0F);
+         message.getLongProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * to get is as a <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testFloat2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setFloatProperty("prop", 127.0F);
+         message.getIntProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testFloat2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to short
+         message.setFloatProperty("prop", 127.0F);
+         message.getShortProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testFloat2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to byte
+         message.setFloatProperty("prop", 127.0F);
+         message.getByteProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>float</code>, 
+    * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testFloat2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can be converted to boolean
+         message.setFloatProperty("prop", 127.0F);
+         message.getBooleanProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * it can also be read as a <code>String</code>.
+    */
+   public void testLong2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setLongProperty("prop", 127L);
+         assertEquals("127", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testLong2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setLongProperty("prop", 127L);
+         message.getDoubleProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testLong2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setLongProperty("prop", 127L);
+         message.getFloatProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * it can also be read as a <code>long</code>.
+    */
+   public void testLong2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setLongProperty("prop", 127L);
+         assertEquals(127L, message.getLongProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * to get is as an <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testLong2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setLongProperty("prop", 127L);
+         message.getIntProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testLong2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to short
+         message.setLongProperty("prop", 127L);
+         message.getShortProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testLong2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to byte
+         message.setLongProperty("prop", 127L);
+         message.getByteProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>long</code>, 
+    * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testLong2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can be converted to boolean
+         message.setLongProperty("prop", 127L);
+         message.getBooleanProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as an <code>int</code>, 
+    * it can also be read as a <code>String</code>.
+    */
+   public void testInt2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setIntProperty("prop", 127);
+         assertEquals("127", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>int</code>, 
+    * to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testInt2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setIntProperty("prop", 127);
+         message.getDoubleProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>int</code>, 
+    * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testInt2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setIntProperty("prop", 127);
+         message.getFloatProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as an <code>int</code>, 
+    * it can also be read as a <code>long</code>.
+    */
+   public void testInt2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setIntProperty("prop", 127);
+         assertEquals(127L, message.getLongProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as an <code>int</code>, 
+    * it can also be read as an <code>int</code>.
+    */
+   public void testInt2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setIntProperty("prop", 127);
+         assertEquals(127, message.getIntProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>int</code>, 
+    * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testInt2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to short
+         message.setIntProperty("prop", Integer.MAX_VALUE);
+         message.getShortProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>int</code>, 
+    * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testInt2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to byte
+         message.setIntProperty("prop", Integer.MAX_VALUE);
+         message.getByteProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>int</code>, 
+    * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testInt2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can be converted to boolean
+         message.setIntProperty("prop", Integer.MAX_VALUE);
+         message.getBooleanProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * it can also be read as a <code>String</code>.
+    */
+   public void testShort2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         assertEquals("127", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testShort2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         message.getDoubleProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testShort2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         message.getFloatProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * it can also be read as a <code>long</code>.
+    */
+   public void testShort2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         assertEquals(127L, message.getLongProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * it can also be read as an <code>int</code>.
+    */
+   public void testShort2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         assertEquals(127, message.getIntProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * it can also be read as a <code>short</code>.
+    */
+   public void testShort2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         assertEquals((short) 127, message.getShortProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testShort2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setShortProperty("prop", (short) 127);
+         message.getByteProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>short</code>, 
+    * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testShort2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to boolean
+         message.setShortProperty("prop", (short) 127);
+         message.getBooleanProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * it can also be read as a <code>String</code>.
+    */
+   public void testByte2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         assertEquals("127", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testByte2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         message.getDoubleProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testByte2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         message.getFloatProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * it can also be read as a <code>long</code>.
+    */
+   public void testByte2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         assertEquals(127L, message.getLongProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * it can also be read as an <code>int</code>.
+    */
+   public void testByte2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         assertEquals(127, message.getIntProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * it can also be read as a <code>short</code>.
+    */
+   public void testByte2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         assertEquals((short) 127, message.getShortProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * it can also be read as a <code>byte</code>.
+    */
+   public void testByte2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setByteProperty("prop", (byte) 127);
+         assertEquals((byte) 127, message.getByteProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>byte</code>, 
+    * to get is as a <code>boolean</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testByte2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to boolean
+         message.setByteProperty("prop", (byte) 127);
+         message.getBooleanProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * it can also be read as a <code>String</code>.
+    */
+   public void testBoolean2String()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setBooleanProperty("prop", true);
+         assertEquals("true", message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * to get is as a <code>double</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testBoolean2Double()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to double
+         message.setBooleanProperty("prop", true);
+         message.getDoubleProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testBoolean2Float()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to float
+         message.setBooleanProperty("prop", true);
+         message.getFloatProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * to get is as a <code>long</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testBoolean2Long()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to long
+         message.setBooleanProperty("true", true);
+         message.getLongProperty("true");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * to get is as a <code>int</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testBoolean2Int()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to int
+         message.setBooleanProperty("prop", true);
+         message.getIntProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testBoolean2Short()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to short
+         message.setBooleanProperty("prop", true);
+         message.getShortProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testBoolean2Byte()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         // store a value that can't be converted to byte
+         message.setBooleanProperty("prop", true);
+         message.getByteProperty("prop");
+         fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>boolean</code>, 
+    * it can also be read as a <code>boolean</code>.
+    */
+   public void testBoolean2Boolean()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setBooleanProperty("prop", true);
+         assertEquals(true, message.getBooleanProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(MessagePropertyConversionTest.class);
+   }
+
+   public MessagePropertyConversionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,368 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.message.properties;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageFormatException;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+
+/**
+ * Test the <code>javax.jms.Message</code> properties.
+ * <br />
+ *  See JMS Specification, sec. 3.5 Message Properties (p.32-37)
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: MessagePropertyTest.java,v 1.1 2007/03/29 04:28:34 starksm Exp $
+ */
+public class MessagePropertyTest extends PTPTestCase
+{
+
+   /**
+    * Test that any other class than <code>Boolean, Byte, Short, Integer, Long,
+    * Float, Double</code> and <code>String</code> used in the <code>Message.setObjectProperty()</code>
+    * method throws a <code>javax.jms.MessageFormatException</code>.
+    */
+   public void testSetObjectProperty_2()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setObjectProperty("prop", new Vector());
+         fail("sec. 3.5.5 An attempt to use any other class [than Boolean, Byte,...,String] must throw "
+               + "a JMS MessageFormatException.\n");
+      }
+      catch (MessageFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.MessageFormatException, not a " + e);
+      }
+   }
+
+   /**
+    * if a property is set as a <code>Float</code> with the <code>Message.setObjectProperty()</code>
+    * method, it can be retrieve directly as a <code>double</code> by <code>Message.getFloatProperty()</code>
+    */
+   public void testSetObjectProperty_1()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setObjectProperty("pi", new Float(3.14159f));
+         assertEquals(3.14159f, message.getFloatProperty("pi"), 0);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a <code>null</code> value is returned by the <code>Message.getObjectProperty()</code> method
+    * if a property by the specified name does not exits.
+    */
+   public void testGetObjectProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         assertEquals(
+               "sec. 3.5.5 A null value is returned [by the getObjectProperty method] if a property by the specified "
+                     + "name does not exits.\n", null, message.getObjectProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a <code>null</code> value is returned by the <code>Message.getStringProperty()</code> method
+    * if a property by the specified name does not exits.
+    */
+   public void testGetStringProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         assertEquals(
+               "sec. 3.5.5 A null value is returned [by the getStringProperty method] if a property by the specified "
+                     + "name does not exits.\n", null, message.getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>double</code> property which does not exist throw
+    * a <code>java.lang.NullPointerException</code>
+    */
+   public void testGetDoubleProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.getDoubleProperty("prop");
+         fail("Should raise a NullPointerException.\n");
+      }
+      catch (NullPointerException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>float</code> property which does not exist throw
+    * a <code>java.lang.NullPointerException</code>
+    */
+   public void testGetFloatProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.getFloatProperty("prop");
+         fail("Should raise a NullPointerException.\n");
+      }
+      catch (NullPointerException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>long</code> property which does not exist throw
+    * a <code>java.lang.NumberFormatException</code>
+    */
+   public void testGetLongProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.getLongProperty("prop");
+         fail("Should raise a NumberFormatException.\n");
+      }
+      catch (NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>int</code> property which does not exist throw
+    * a <code>java.lang.NumberFormatException</code>
+    */
+   public void testGetIntProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.getIntProperty("prop");
+         fail("Should raise a NumberFormatException.\n");
+      }
+      catch (NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>short</code> property which does not exist throw
+    * a <code>java.lang.NumberFormatException</code>
+    */
+   public void testGetShortProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.getShortProperty("prop");
+         fail("Should raise a NumberFormatException.\n");
+      }
+      catch (NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>byte</code> property which does not exist throw
+    * a <code>java.lang.NumberFormatException</code>
+    */
+   public void testGetByteProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.getByteProperty("prop");
+         fail("Should raise a NumberFormatException.\n");
+      }
+      catch (NumberFormatException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Test that an attempt to get a <code>boolean</code> property which does not exist 
+    * returns <code>false</code>
+    */
+   public void testGetBooleanProperty()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         assertEquals(false, message.getBooleanProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>Message.getPropertyNames()</code> method does not return
+    * the name of the JMS standard header fields (e.g. <code>JMSCorrelationID</code>.
+    */
+   public void testGetPropertyNames()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         message.setJMSCorrelationID("foo");
+         Enumeration enumeration = message.getPropertyNames();
+         assertTrue("sec. 3.5.6 The getPropertyNames method does not return the names of "
+               + "the JMS standard header field [e.g. JMSCorrelationID].\n", !enumeration.hasMoreElements());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>Message.getPropertyNames()</code> method returns an empty
+    * <code>java.util.Enumeration</code> if there is no properties.
+    * <br />
+    * If there are some, test that it properly return their names.
+    */
+   public void testPropertyIteration()
+   {
+      try
+      {
+         Message message = senderSession.createMessage();
+         Enumeration enumeration = message.getPropertyNames();
+         assertTrue("No property yet defined.\n", !enumeration.hasMoreElements());
+         message.setDoubleProperty("pi", 3.14159);
+         enumeration = message.getPropertyNames();
+         assertEquals("One property defined of name 'pi'.\n", "pi", (String) enumeration.nextElement());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>Message.clearProperties()</code> method does not clear the
+    * value of the Message's body.
+    */
+   public void testClearProperties_2()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("foo");
+         message.clearProperties();
+         assertEquals("sec. 3.5.7 Clearing a message's  property entries does not clear the value of its body.\n", "foo",
+               message.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the <code>Message.clearProperties()</code> method deletes all the 
+    * properties of the Message.
+    */
+   public void testClearProperties_1()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("prop", "foo");
+         message.clearProperties();
+         assertEquals("sec. 3.5.7 A message's properties are deleted by the clearProperties method.\n", null, message
+               .getStringProperty("prop"));
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(MessagePropertyTest.class);
+   }
+
+   public MessagePropertyTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/message/properties/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+  <body>
+    Tests JMS <em>Message Properties</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/QueueBrowserTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,206 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.queue;
+
+import java.util.Enumeration;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.QueueBrowser;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.util.NestedRuntimeException;
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the <code>javax.jms.QueueBrowser</code> features.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: QueueBrowserTest.java,v 1.2 2007/06/19 23:32:35 csuconic Exp $
+ */
+public class QueueBrowserTest extends PTPTestCase
+{
+
+   /**
+    * The <code>QueueBrowser</code> of the receiver's session
+    */
+   protected QueueBrowser receiverBrowser;
+
+   /**
+    * The <code>QueueBrowser</code> of the sender's session
+    */
+   protected QueueBrowser senderBrowser;
+
+   /**
+    * Test the <code>QueueBrowser</code> of the sender.
+    */
+   public void testSenderBrowser()
+   {
+      try
+      {
+         TextMessage message_1 = senderSession.createTextMessage();
+         message_1.setText("testBrowser:message_1");
+         TextMessage message_2 = senderSession.createTextMessage();
+         message_2.setText("testBrowser:message_2");
+         
+         receiver.close();
+
+         // send two messages...
+         sender.send(message_1);
+         sender.send(message_2);
+         
+         // ask the browser to browse the sender's session
+         Enumeration enumeration = senderBrowser.getEnumeration();
+         int count = 0;
+         while (enumeration.hasMoreElements())
+         {
+            // one more message in the queue
+            count++;
+            // check that the message in the queue is one of the two which where sent
+            Object obj = enumeration.nextElement();
+            assertTrue(obj instanceof TextMessage);
+            TextMessage msg = (TextMessage) obj;
+            assertTrue(msg.getText().startsWith("testBrowser:message_"));
+         }
+         // check that there is effectively 2 messages in the queue
+         assertEquals(2, count);
+
+         
+         receiver = receiverSession.createReceiver(receiverQueue);
+         // receive the first message...
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         // ... and check it is the first which was sent.
+         assertTrue(m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         assertEquals("testBrowser:message_1", msg.getText());
+
+         // receive the second message...
+         m = receiver.receive(TestConfig.TIMEOUT);
+         // ... and check it is the second which was sent.
+         assertTrue(m instanceof TextMessage);
+         msg = (TextMessage) m;
+         assertEquals("testBrowser:message_2", msg.getText());
+
+         // ask the browser to browse the sender's session
+         enumeration = receiverBrowser.getEnumeration();
+         // check that there is no messages in the queue
+         // (the two messages have been acknowledged and so removed
+         // from the queue)
+         assertTrue(!enumeration.hasMoreElements());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a <code>QueueBrowser</cdeo> created with a message selector
+    * browses only the messages matching this selector.
+    */
+   public void testBrowserWithMessageSelector()
+   {
+      try
+      {
+         senderBrowser = senderSession.createBrowser(senderQueue, "pi = 3.14159");
+
+         receiver.close();
+         
+         TextMessage message_1 = senderSession.createTextMessage();
+         message_1.setText("testBrowserWithMessageSelector:message_1");
+         TextMessage message_2 = senderSession.createTextMessage();
+         message_2.setDoubleProperty("pi", 3.14159);
+         message_2.setText("testBrowserWithMessageSelector:message_2");
+
+         sender.send(message_1);
+         sender.send(message_2);
+
+         Enumeration enumeration = senderBrowser.getEnumeration();
+         int count = 0;
+         while (enumeration.hasMoreElements())
+         {
+            count++;
+            Object obj = enumeration.nextElement();
+            assertTrue(obj instanceof TextMessage);
+            TextMessage msg = (TextMessage) obj;
+            assertEquals("testBrowserWithMessageSelector:message_2", msg.getText());
+         }
+         assertEquals(1, count);
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   public void setUp() throws Exception
+   {
+      try
+      {
+         super.setUp();
+         receiverBrowser = receiverSession.createBrowser(receiverQueue);
+         senderBrowser = senderSession.createBrowser(senderQueue);
+      }
+      catch (JMSException e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void tearDown() throws Exception
+   {
+      try
+      {
+         receiverBrowser.close();
+         senderBrowser.close();
+         super.tearDown();
+      }
+      catch (JMSException ignored)
+      {
+      }
+      finally
+      {
+         receiverBrowser = null;
+         senderBrowser = null;
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(QueueBrowserTest.class);
+   }
+
+   public QueueBrowserTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/TemporaryQueueTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/TemporaryQueueTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/TemporaryQueueTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,99 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.queue;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.QueueReceiver;
+import javax.jms.TemporaryQueue;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the <code>javax.jms.TemporaryQueue</code> features.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: TemporaryQueueTest.java,v 1.1 2007/03/29 04:28:37 starksm Exp $
+ */
+public class TemporaryQueueTest extends PTPTestCase
+{
+
+   private TemporaryQueue tempQueue;
+
+   private QueueReceiver tempReceiver;
+
+   /**
+    * Test a TemporaryQueue
+    */
+   public void testTemporaryQueue()
+   {
+      try
+      {
+         // we stop both sender and receiver connections
+         senderConnection.stop();
+         receiverConnection.stop();
+         // we create a temporary queue to receive messages
+         tempQueue = receiverSession.createTemporaryQueue();
+         // we recreate the sender because it has been 
+         // already created with a Destination as parameter
+         sender = senderSession.createSender(null);
+         // we create a receiver on the temporary queue
+         tempReceiver = receiverSession.createReceiver(tempQueue);
+         receiverConnection.start();
+         senderConnection.start();
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testTemporaryQueue");
+         sender.send(tempQueue, message);
+
+         Message m = tempReceiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         assertEquals("testTemporaryQueue", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(TemporaryQueueTest.class);
+   }
+
+   public TemporaryQueueTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/queue/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+  <body>
+    Tests JMS <em>Queue</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorSyntaxTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorSyntaxTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorSyntaxTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,437 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.selector;
+
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+
+/**
+ * Test the syntax of of message selector of JMS
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: SelectorSyntaxTest.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
+ */
+public class SelectorSyntaxTest extends PTPTestCase
+{
+
+   /**
+    * Test that identifiers that start with a valid Java identifier start character are valid.
+    * A valid identifier means that the method <code>Character.isJavaIdentifierStart</code> returns 
+    * <code>true</code> for this identifier first character.
+    * 
+    * @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Character.html#isJavaIdentifierStart(char)">Character.isJavaIdentifierStart(char)</a>
+    */
+   public void testValidIdentifiersStart()
+   {
+      String identifier = null;
+      try
+      {
+         identifier = "_correct";
+         assertTrue(identifier + " starts with an invalid Java identifier start character", Character
+               .isJavaIdentifierStart(identifier.charAt(0)));
+         receiver = receiverSession.createReceiver(receiverQueue, identifier + " IS NULL");
+
+         identifier = "$correct";
+         assertTrue(identifier + " starts with an invalid Java identifier start character", Character
+               .isJavaIdentifierStart(identifier.charAt(0)));
+         receiver = receiverSession.createReceiver(receiverQueue, identifier + " IS NULL");
+      }
+      catch (JMSException e)
+      {
+         fail(identifier + " is a correct identifier. \n" + e);
+      }
+   }
+
+   /**
+    * Test that identifiers that start with an invalid Java identifier start character are invalid.       
+    * 
+    * @see #testValidIdentifiersStart()
+    */
+   public void testInvalidIdentifiersStart()
+   {
+      String identifier = null;
+      try
+      {
+         identifier = "1uncorrect";
+
+         assertTrue(identifier + " starts with an invalid Java identifier start character", !Character
+               .isJavaIdentifierStart(identifier.charAt(0)));
+         receiver = receiverSession.createReceiver(receiverQueue, identifier + " IS NULL");
+         fail(identifier + " starts with an invalid Java identifier start character");
+      }
+      catch (JMSException e)
+      {
+      }
+
+      try
+      {
+         identifier = "%uncorrect";
+
+         assertTrue(identifier + " starts with an invalid Java identifier start character", !Character
+               .isJavaIdentifierStart(identifier.charAt(0)));
+         receiver = receiverSession.createReceiver(receiverQueue, identifier + " IS NULL");
+         fail(identifier + " starts with an invalid Java identifier start character");
+      }
+      catch (JMSException e)
+      {
+      }
+
+   }
+
+   /**
+    * Test that message selector can be an empty string.
+    */
+   public void testEmptyStringAsSelector()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>NULL</code>.
+    */
+   public void testIdentifierNULL()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "NULL = ZERO");
+         fail("NULL is not a valid identifier");
+      }
+      catch (InvalidSelectorException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>TRUE</code>.
+    */
+   public void testIdentifierTRUE()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "TRUE > 0");
+         fail("TRUE is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>FALSE</code>.
+    */
+   public void testIdentifierFALSE()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "FALSE > 0");
+         fail("FALSE is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>NOT</code>.
+    */
+   public void testIdentifierNOT()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "NOT > 0");
+         fail("NOT is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>AND</code>.
+    */
+   public void testIdentifierAND()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "AND > 0");
+         fail("AND is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>OR</code>.
+    */
+   public void testIdentifierOR()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "OR > 0");
+         fail("OR is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>BETWEEN</code>.
+    */
+   public void testIdentifierBETWEEN()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "BETWEEN > 0");
+         fail("BETWEEN is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>LIKE</code>.
+    */
+   public void testIdentifierLIKE()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "LIKE > 0");
+         fail("LIKE is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>IN</code>.
+    */
+   public void testIdentifierIN()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "IN > 0");
+         fail("IN is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>IS</code>.
+    */
+   public void testIdentifierIS()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "IS > 0");
+         fail("IS is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test that identifiers can't be <code>ESCAPE</code>.
+    */
+   public void testIdentifierESCAPE()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "ESCAPE > 0");
+         fail("ESCAPE is not a valid identifier");
+      }
+      catch (JMSException e)
+      {
+      }
+   }
+
+   /**
+    * Test syntax of "<em>identifier</em> IS [NOT] NULL"
+    */
+   public void testNull()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "prop_name IS NULL");
+         receiver = receiverSession.createReceiver(receiverQueue, "prop_name IS NOT NULL");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test syntax of "<em>identifier</em> [NOT] LIKE <em>pattern-value</em> [ESCAPE <em>escape-character</em>]"
+    */
+   public void testLike()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "phone LIKE '12%3'");
+         receiver = receiverSession.createReceiver(receiverQueue, "word LIKE 'l_se'");
+         receiver = receiverSession.createReceiver(receiverQueue, "underscored LIKE '\\_%' ESCAPE '\\'");
+         receiver = receiverSession.createReceiver(receiverQueue, "phone NOT LIKE '12%3'");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test syntax of "<em>identifier</em> [NOT] IN (<em>string-literal1</em>, <em>string-literal2</em>,...)"
+    */
+   public void testIn()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "Country IN ('UK', 'US', 'France')");
+         receiver = receiverSession.createReceiver(receiverQueue, "Country NOT IN ('UK', 'US', 'France')");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test syntax of "<em>arithmetic-expr1</em> [NOT] BETWEEN <em>arithmetic-expr2</em> and <em>arithmetic-expr3</em>"
+    */
+   public void testBetween()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "age BETWEEN 15 and 19");
+         receiver = receiverSession.createReceiver(receiverQueue, "age NOT BETWEEN 15 and 19");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test diffent syntax for approximate numeric literal (+6.2, -95.7, 7.)
+    */
+   public void testApproximateNumericLiteral()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "average = +6.2");
+         receiver = receiverSession.createReceiver(receiverQueue, "average = -95.7");
+         receiver = receiverSession.createReceiver(receiverQueue, "average = 7.");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test diffent syntax for exact numeric literal (+62, -957, 57)
+    */
+   public void testExactNumericLiteral()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "average = +62");
+         receiver = receiverSession.createReceiver(receiverQueue, "max = -957");
+         receiver = receiverSession.createReceiver(receiverQueue, "max = 57");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test diffent syntax for zero as an exact or an approximate numeric literal (0, 0.0, 0.)
+    */
+   public void testZero()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "max = 0");
+         receiver = receiverSession.createReceiver(receiverQueue, "max = 0.0");
+         receiver = receiverSession.createReceiver(receiverQueue, "max = 0.");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test diffent syntax for string literal ('literal' and 'literal''s')
+    */
+   public void testString()
+   {
+      try
+      {
+         receiver = receiverSession.createReceiver(receiverQueue, "string = 'literal'");
+         receiver = receiverSession.createReceiver(receiverQueue, "string = 'literal''s'");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(SelectorSyntaxTest.class);
+   }
+
+   public SelectorSyntaxTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,602 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil@)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.selector;
+
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the message selector features of JMS
+ *
+ * @author Jeff Mesnil (jmesnil@)
+ * @version $Id: SelectorTest.java,v 1.3 2007/10/02 14:59:35 csuconic Exp $
+ */
+public class SelectorTest extends PTPTestCase
+{
+
+   /**
+    * Test that an empty string as a message selector indicates that there
+    * is no message selector for the message consumer.
+    */
+   public void testEmptyStringAsSelector()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "");
+         receiverConnection.start();
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testEmptyStringAsSelector");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("No message was received", msg != null);
+         assertEquals("testEmptyStringAsSelector", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Tats that String literals are well handled by the message selector.
+    * <br />
+    * <ul>
+    *   <li><code>"string = 'literal''s;"</code> is <code>true</code> for "literal's" and <code>false</code> for "literal"</li>
+    * </ul>
+    */
+
+   public void testStringLiterals()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "string = 'literal''s'");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("string", "literal");
+         dummyMessage.setText("testStringLiterals:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("string", "literal's");
+         message.setText("testStringLiterals:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("No message was received", msg != null);
+         assertEquals("testStringLiterals:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that the JMS property <code>JMSDeliveryMode</code> is treated as having the values <code>'PERSISTENT'</code>
+    * or <code>'NON_PERSISTENT'</code> when used in a message selector (chapter 3.8.1.3).
+    */
+   public void testJMSDeliveryModeInSelector()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "JMSDeliveryMode = 'PERSISTENT'");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setText("testJMSDeliveryModeInSelector:1");
+         // send a dummy message in *non persistent* mode
+         sender.send(dummyMessage, DeliveryMode.NON_PERSISTENT, sender.getPriority(), sender.getTimeToLive());
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testJMSDeliveryModeInSelector:2");
+         // send a message in *persistent*
+         sender.send(message, DeliveryMode.PERSISTENT, sender.getPriority(), sender.getTimeToLive());
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("No message was received", msg != null);
+         // only the message sent in persistent mode should be received.
+         assertEquals(DeliveryMode.PERSISTENT, msg.getJMSDeliveryMode());
+         assertEquals("testJMSDeliveryModeInSelector:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that conversions that apply to the <code>get</code> methods for properties do not
+    * apply when a property is used in a message selector expression.
+    * Based on the example of chapter 3.8.1.1 about identifiers.
+    */
+   public void testIdentifierConversion()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "NumberOfOrders > 1");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("NumberOfOrders", "2");
+         dummyMessage.setText("testIdentifierConversion:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setIntProperty("NumberOfOrders", 2);
+         message.setText("testIdentifierConversion:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("testIdentifierConversion:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the message selector using the filter example provided by the JMS specifications.
+    * <br />
+    * <ul>
+    *   <li><code>"JMSType = 'car' AND color = 'blue' AND weight > 2500"</code></li>
+    * </ul>
+    */
+   public void testSelectorExampleFromSpecs()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue,
+               "JMSType = 'car' AND color = 'blue' AND weight > 2500");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setJMSType("car");
+         dummyMessage.setStringProperty("color", "red");
+         dummyMessage.setLongProperty("weight", 3000);
+         dummyMessage.setText("testSelectorExampleFromSpecs:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setJMSType("car");
+         message.setStringProperty("color", "blue");
+         message.setLongProperty("weight", 3000);
+         message.setText("testSelectorExampleFromSpecs:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("testSelectorExampleFromSpecs:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the ">" condition in message selector.
+    * <br />
+    * <ul>
+    *   <li><code>"weight > 2500"</code> is <code>true</code> for 3000 and <code>false</code> for 1000</li>
+    * </ul>
+    */
+   public void testGreaterThan()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "weight > 2500");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setLongProperty("weight", 1000);
+         dummyMessage.setText("testGreaterThan:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setLongProperty("weight", 3000);
+         message.setText("testGreaterThan:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("testGreaterThan:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the "=" condition in message selector.
+    * <br />
+    * <ul>
+    *   <li><code>"weight > 2500"</code>  is <code>true</code> for 2500 and <code>false</code> for 1000</li>
+    * </ul>
+    */
+   public void testEquals()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "weight = 2500");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setLongProperty("weight", 1000);
+         dummyMessage.setText("testEquals:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setLongProperty("weight", 2500);
+         message.setText("testEquals:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("testEquals:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the "<>" (not equal) condition in message selector.
+    * <br />
+    * <ul>
+    *   <li><code>"weight <> 2500"</code>  is <code>true</code> for 1000 and <code>false</code> for 2500</li>
+    * </ul>
+    */
+   public void testNotEquals()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "weight <> 2500");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setLongProperty("weight", 2500);
+         dummyMessage.setText("testEquals:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setLongProperty("weight", 1000);
+         message.setText("testEquals:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertEquals("testEquals:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the BETWEEN condition in message selector.
+    * <br />
+    * <ul>
+    *   <li>"age BETWEEN 15 and 19" is <code>true</code> for 17 and <code>false</code> for 20</li>
+    * </ul>
+    */
+   public void testBetween()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "age BETWEEN 15 and 19");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setIntProperty("age", 20);
+         dummyMessage.setText("testBetween:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setIntProperty("age", 17);
+         message.setText("testBetween:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("Message not received", msg != null);
+         assertTrue("Message of another test: " + msg.getText(), msg.getText().startsWith("testBetween"));
+         assertEquals("testBetween:2", msg.getText());
+
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the IN condition in message selector.
+    * <br />
+    * <ul>
+    *   <li>"Country IN ('UK', 'US', 'France')" is <code>true</code> for 'UK' and <code>false</code> for 'Peru'</li>
+    * </ul>
+    */
+   public void testIn()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "Country IN ('UK', 'US', 'France')");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("Country", "Peru");
+         dummyMessage.setText("testIn:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("Country", "UK");
+         message.setText("testIn:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("Message not received", msg != null);
+         assertTrue("Message of another test: " + msg.getText(), msg.getText().startsWith("testIn"));
+         assertEquals("testIn:2", msg.getText());
+
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the LIKE ... ESCAPE condition in message selector
+    * <br />
+    * <ul>
+    *   <li>"underscored LIKE '\_%' ESCAPE '\'" is <code>true</code> for '_foo' and <code>false</code> for 'bar'</li>
+    * </ul>
+    */
+   public void testLikeEscape()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "underscored LIKE '\\_%' ESCAPE '\\'");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("underscored", "bar");
+         dummyMessage.setText("testLikeEscape:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("underscored", "_foo");
+         message.setText("testLikeEscape:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("Message not received", msg != null);
+         assertTrue("Message of another test: " + msg.getText(), msg.getText().startsWith("testLikeEscape"));
+         assertEquals("testLikeEscape:2", msg.getText());
+
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the LIKE condition with '_' in the pattern.
+    * <br />
+    * <ul>
+    *   <li>"word LIKE 'l_se'" is <code>true</code> for 'lose' and <code>false</code> for 'loose'</li>
+    * </ul>
+    */
+   public void testLike_2()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "word LIKE 'l_se'");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("word", "loose");
+         dummyMessage.setText("testLike_2:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("word", "lose");
+         message.setText("testLike_2:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("Message not received", msg != null);
+         assertTrue("Message of another test: " + msg.getText(), msg.getText().startsWith("testLike_2"));
+         assertEquals("testLike_2:2", msg.getText());
+
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the LIKE condition with '%' in the pattern.
+    * <br />
+    * <ul>
+    *   <li>"phone LIKE '12%3'" is <code>true</code> for '12993' and <code>false</code> for '1234'</li>
+    * </ul>
+    */
+   public void testLike_1()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "phone LIKE '12%3'");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("phone", "1234");
+         dummyMessage.setText("testLike_1:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setStringProperty("phone", "12993");
+         message.setText("testLike_1:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue("Message not received", msg != null);
+         assertTrue("Message of another test: " + msg.getText(), msg.getText().startsWith("testLike_1"));
+         assertEquals("testLike_1:2", msg.getText());
+
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the <code>NULL</code> value in message selector.
+    * <br />
+    * <ul>
+    *   <li><code>"prop IS NULL"</code></li>
+    * </ul>
+    */
+   public void testNull()
+   {
+      try
+      {
+         receiverConnection.stop();
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         receiver = receiverSession.createReceiver(receiverQueue, "prop_name IS NULL");
+         receiverConnection.start();
+
+         TextMessage dummyMessage = senderSession.createTextMessage();
+         dummyMessage.setStringProperty("prop_name", "not null");
+         dummyMessage.setText("testNull:1");
+         sender.send(dummyMessage);
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testNull:2");
+         sender.send(message);
+
+         TextMessage msg = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(msg != null);
+         assertEquals("testNull:2", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(SelectorTest.class);
+   }
+
+   public SelectorTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+  <body>
+    Tests JMS <em>Selector</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/QueueSessionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/QueueSessionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/QueueSessionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,211 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.session;
+
+import javax.jms.InvalidDestinationException;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test queue sessions
+ * <br />
+ * See JMS specifications, sec. 4.4 Session
+ * 
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: QueueSessionTest.java,v 1.2 2007/06/19 23:32:35 csuconic Exp $
+ */
+public class QueueSessionTest extends PTPTestCase
+{
+
+   /**
+    * Test that if we rollback a transaction which has consumed a message,
+    * the message is effectively redelivered.
+    */
+   public void testRollbackRececeivedMessage()
+   {
+      try
+      {
+         senderConnection.stop();
+         // senderSession has been created as non transacted
+         // we create it again but as a transacted session
+         senderSession = senderConnection.createQueueSession(true, 0);
+         assertEquals(true, senderSession.getTransacted());
+         // we create again the sender
+         sender = senderSession.createSender(senderQueue);
+         senderConnection.start();
+
+         receiverConnection.stop();
+         // receiverSession has been created as non transacted
+         // we create it again but as a transacted session
+         receiverSession = receiverConnection.createQueueSession(true, 0);
+         assertEquals(true, receiverSession.getTransacted());
+         
+         if (receiver!=null)
+         {
+        	 receiver.close();
+         }
+         // we create again the receiver
+         receiver = receiverSession.createReceiver(receiverQueue);
+         receiverConnection.start();
+
+         // we send a message...
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testRollbackRececeivedMessage");
+         sender.send(message);
+         // ... and commit the *producer* transaction
+         senderSession.commit();
+
+         // we receive a message...
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m != null);
+         assertTrue(m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         // ... which is the one which was sent...
+         assertEquals("testRollbackRececeivedMessage", msg.getText());
+         // ...and has not been redelivered
+         assertEquals(false, msg.getJMSRedelivered());
+
+         // we rollback the *consumer* transaction
+         receiverSession.rollback();
+
+         // we receive again a message
+         m = receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m != null);
+         assertTrue(m instanceof TextMessage);
+         msg = (TextMessage) m;
+         // ... which is still the one which was sent...
+         assertEquals("testRollbackRececeivedMessage", msg.getText());
+         // .. but this time, it has been redelivered
+         assertEquals(true, msg.getJMSRedelivered());
+
+      }
+      catch (Exception e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createBrowser()</code> method with an invalid
+    * messaeg session throws a <code>javax.jms.InvalidSelectorException</code>.
+    */
+   public void testCreateBrowser_2()
+   {
+      try
+      {
+         senderSession.createBrowser(senderQueue, "definitely not a message selector!");
+         fail("Should throw a javax.jms.InvalidSelectorException.\n");
+      }
+      catch (InvalidSelectorException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidSelectorException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createBrowser()</code> method with an invalid
+    * <code>Queue</code> throws a <code>javax.jms.InvalidDestinationException</code>.
+    */
+   public void testCreateBrowser_1()
+   {
+      try
+      {
+         senderSession.createBrowser((Queue) null);
+         fail("Should throw a javax.jms.InvalidDestinationException.\n");
+      }
+      catch (InvalidDestinationException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createReceiver()</code> method with an invalid
+    * message selector throws a <code>javax.jms.InvalidSelectorException</code>.
+    */
+   public void testCreateReceiver_2()
+   {
+      try
+      {
+         receiver = senderSession.createReceiver(senderQueue, "definitely not a message selector!");
+         fail("Should throw a javax.jms.InvalidSelectorException.\n");
+      }
+      catch (InvalidSelectorException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidSelectorException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createReceiver()</code> method with an invalid
+    * <code>Queue</code> throws a <code>javax.jms.InvalidDestinationException</code>>
+    */
+   public void testCreateReceiver_1()
+   {
+      try
+      {
+         receiver = senderSession.createReceiver((Queue) null);
+         fail("Should throw a javax.jms.InvalidDestinationException.\n");
+      }
+      catch (InvalidDestinationException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(QueueSessionTest.class);
+   }
+
+   public QueueSessionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/SessionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/SessionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/SessionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,340 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.session;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PTPTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test sessions
+ * <br />
+ * See JMS specifications, sec. 4.4 Session
+ * 
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: SessionTest.java,v 1.2 2007/06/19 23:32:35 csuconic Exp $
+ */
+public class SessionTest extends PTPTestCase
+{
+
+   /**
+    * Test that an attempt to call the <code>recover()</code> method on a 
+    * <strong>transacted </strong> <code>Session</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    */
+   public void testRecoverTransactedSession()
+   {
+      try
+      {
+         // senderSession has been created as non transacted
+         assertEquals(false, senderSession.getTransacted());
+         // we create it again but as a transacted session
+         senderSession = senderConnection.createQueueSession(true, 0);
+         assertEquals(true, senderSession.getTransacted());
+         senderSession.recover();
+         fail("Should raise an IllegalStateException, the session is not transacted.\n");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n");
+      }
+      catch (Exception e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>rollback()</code> method on a 
+    * <strong>transacted</strong> <code>Session</code> rollbacks all
+    * the messages sent in the transaction.
+    */
+   public void testRollbackTransactedSession()
+   {
+      try
+      {
+         // re-create senderSession as a transacted session
+         senderSession = senderConnection.createQueueSession(true, 0);
+         sender = senderSession.createSender(senderQueue);
+         assertEquals(true, senderSession.getTransacted());
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testRollbackTransactedSession");
+         // send a message within a transacted session
+         sender.send(message);
+
+         // rollback the transaction -> the sent message shouldn't be received
+         senderSession.rollback();
+
+         TextMessage m = (TextMessage) receiver.receiveNoWait();
+         // test that no message has been received
+         assertEquals(null, m);
+      }
+      catch (Exception e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>rollback()</code> method on a 
+    * <strong>transacted</strong> <code>Session</code> rollbacks all
+    * the messages sent in the transaction.
+    */
+   public void testCommitTransactedSession()
+   {
+      try
+      {
+         // re-create senderSession as a transacted session
+         senderSession = senderConnection.createQueueSession(true, 0);
+         sender = senderSession.createSender(senderQueue);
+         assertEquals(true, senderSession.getTransacted());
+
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testCommitTransactedSession");
+         // send a message within a transacted session
+         sender.send(message);
+
+         TextMessage m = (TextMessage) receiver.receiveNoWait();
+         // test that no message has been received (the transaction has not been committed yet)
+         assertEquals(null, m);
+
+         // commit the transaction -> the sent message should be received
+         senderSession.commit();
+
+         m = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         assertTrue(m != null);
+         assertEquals("testCommitTransactedSession", m.getText());
+      }
+      catch (Exception e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that an attempt to call the <code>roolback()</code> method on a 
+    * <strong>non transacted</strong> <code>Session</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    */
+   public void testRollbackNonTransactedSession()
+   {
+      try
+      {
+         // senderSession has been created as non transacted in the setUp() method
+         assertEquals(false, senderSession.getTransacted());
+         senderSession.rollback();
+         fail("Should raise an IllegalStateException, the session is not transacted.\n");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n");
+      }
+      catch (Exception e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that an attempt to call the <code>commit()</code> method on a 
+    * <strong>non transacted</strong> <code>Session</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    */
+   public void testCommitNonTransactedSession()
+   {
+      try
+      {
+         // senderSession has been created as non transacted in the setUp() method
+         assertEquals(false, senderSession.getTransacted());
+         senderSession.commit();
+         fail("Should raise an IllegalStateException, the session is not transacted.\n");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n");
+      }
+      catch (Exception e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that the <code>getTransacted()</code> method of a <code>Session</code> returns <code>true</code>
+    * if the session is transacted, <code>false</code> else.
+    */
+   public void testGetTransacted()
+   {
+      try
+      {
+         // senderSession has been created as non transacted
+         assertEquals(false, senderSession.getTransacted());
+         // we re-create senderSession as a transacted session
+         senderSession = senderConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+         assertEquals(true, senderSession.getTransacted());
+      }
+      catch (Exception e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that invoking the <code>acknowledge()</code> method of a received message 
+    * from a closed session must throw an <code>IllegalStateException</code>.
+    */
+   public void testAcknowledge()
+   {
+      try
+      {
+    	 if (receiverSession!=null)
+    	 {
+    		 receiverSession.close();
+    	 }
+         receiverSession = receiverConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+         receiver = receiverSession.createReceiver(receiverQueue);
+
+         Message message = senderSession.createMessage();
+         sender.send(message);
+
+         Message m = receiver.receive(TestConfig.TIMEOUT);
+         receiverSession.close();
+         m.acknowledge();
+         fail("�4.4.1 Invoking the acknowledge method of a received message from a closed "
+               + " session must throw an [javax.jms.]IllegalStateException.\n");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("�4.4.1 Invoking the acknowledge method of a received message from a closed "
+               + "session must throw an [javax.jms.]IllegalStateException, "
+               + "[not a java.lang.IllegalStateException]");
+      }
+   }
+
+   /** 
+    * Test that it is valid to use message objects created or received via the [closed] session with the
+    * exception of a received message <code>acknowledge()</code> method.
+    */
+   public void testUseMessage()
+   {
+      try
+      {
+         TextMessage message = senderSession.createTextMessage();
+         message.setText("testUseMessage");
+         sender.send(message);
+
+         TextMessage m = (TextMessage) receiver.receive(TestConfig.TIMEOUT);
+         receiverSession.close();
+         assertEquals("testUseMessage", m.getText());
+      }
+      catch (Exception e)
+      {
+         fail("�4.4.1 It is valid to continue to use message objects created or received via "
+               + "the [closed] session.\n");
+      }
+   }
+
+   /**
+    * Test that an attempt to use a <code>Session</code> which has been closed
+    * throws a <code>javax.jms.IllegalStateException</code>.
+    */
+   public void testUsedClosedSession()
+   {
+      try
+      {
+         senderSession.close();
+         senderSession.createMessage();
+         fail("�4.4.1 An attempt to use [a closed session] must throw a [javax.jms.]IllegalStateException.\n");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a " + e);
+      }
+      catch (java.lang.IllegalStateException e)
+      {
+         fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException");
+      }
+   }
+
+   /**
+    * Test that closing a closed session does <strong>not</strong> throw
+    * an exception.
+    */
+   public void testCloseClosedSession()
+   {
+      try
+      {
+         // senderSession is already started
+         // we close it once
+         senderSession.close();
+         // we close it a second time
+         senderSession.close();
+      }
+      catch (Exception e)
+      {
+         fail("�4.4.1 Closing a closed session must NOT throw an exception.\n");
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(SessionTest.class);
+   }
+
+   public SessionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,253 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): Andreas Mueller <am at iit.de>.
+ */
+
+package org.objectweb.jtests.jms.conform.session;
+
+import javax.jms.InvalidDestinationException;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PubSubTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test topic sessions
+ * <br />
+ * See JMS specifications, sec. 4.4 Session
+ * 
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: TopicSessionTest.java,v 1.2 2007/06/19 23:32:35 csuconic Exp $
+ */
+public class TopicSessionTest extends PubSubTestCase
+{
+
+   /**
+    * Test that if we rollback a transaction which has consumed a message,
+    * the message is effectively redelivered.
+    */
+   public void testRollbackReceivedMessage()
+   {
+      try
+      {
+         publisherConnection.stop();
+         // publisherSession has been declared has non transacted
+         // we recreate it as a transacted session
+         publisherSession = publisherConnection.createTopicSession(true, 0);
+         assertEquals(true, publisherSession.getTransacted());
+         // we also recreate the publisher
+         publisher = publisherSession.createPublisher(publisherTopic);
+         publisherConnection.start();
+
+         subscriberConnection.stop();
+         // subscriberSession has been declared has non transacted
+         // we recreate it as a transacted session
+         subscriberSession = subscriberConnection.createTopicSession(true, 0);
+         assertEquals(true, subscriberSession.getTransacted());
+         // we also recreate the subscriber
+         subscriber = subscriberSession.createSubscriber(subscriberTopic);
+         subscriberConnection.start();
+
+         // we create a message...
+         TextMessage message = publisherSession.createTextMessage();
+         message.setText("testRollbackReceivedMessage");
+         // ... publish it ...
+         publisher.publish(message);
+         // ... and commit the transaction
+         publisherSession.commit();
+
+         // we receive it
+         Message msg1 = subscriber.receive(TestConfig.TIMEOUT);
+         assertTrue("no message received", msg1 != null);
+         assertTrue(msg1 instanceof TextMessage);
+         assertEquals("testRollbackReceivedMessage", ((TextMessage) msg1).getText());
+
+         // we rollback the transaction of subscriberSession
+         subscriberSession.rollback();
+
+         // we expect to receive a second time the message
+         Message msg2 = subscriber.receive(TestConfig.TIMEOUT);
+         assertTrue("no message received after rollbacking subscriber session.", msg2 != null);
+         assertTrue(msg2 instanceof TextMessage);
+         assertEquals("testRollbackReceivedMessage", ((TextMessage) msg2).getText());
+
+         // finally we commit the subscriberSession transaction
+         subscriberSession.commit();
+      }
+      catch (Exception e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a durable subscriber effectively receives the messages sent to its
+    * topic while it was inactive.
+    */
+   public void testDurableSubscriber()
+   {
+      try
+      {
+         subscriber = subscriberSession.createDurableSubscriber(subscriberTopic, "testTopic");
+         subscriberConnection.close();
+         subscriberConnection = null;
+
+         TextMessage message = publisherSession.createTextMessage();
+         message.setText("test");
+         publisher.publish(message);
+
+         subscriberConnection = subscriberTCF.createTopicConnection();
+         subscriberConnection.setClientID("subscriberConnection");
+         subscriberSession = subscriberConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subscriberSession.createDurableSubscriber(subscriberTopic, "testTopic");
+         subscriberConnection.start();
+
+         TextMessage m = (TextMessage) subscriber.receive(TestConfig.TIMEOUT);
+         assertTrue(m != null);
+         assertEquals("test", m.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test the unsubscription of a durable subscriber.
+    */
+   public void testUnsubscribe()
+   {
+      try
+      {
+         subscriber = subscriberSession.createDurableSubscriber(subscriberTopic, "topic");
+         subscriber.close();
+         // nothing should happen when unsubscribing the durable subscriber
+         subscriberSession.unsubscribe("topic");
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createDurableSubscriber()</code> method with an invalid
+    * message selector throws a <code>javax.jms.InvalidSelectorException</code>.
+    */
+   public void testCreateDurableSubscriber_2()
+   {
+      try
+      {
+         subscriberSession
+               .createDurableSubscriber(subscriberTopic, "topic", "definitely not a message selector!", true);
+         fail("Should throw a javax.jms.InvalidSelectorException.\n");
+      }
+      catch (InvalidSelectorException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidSelectorException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createDurableSubscriber()</code> method with an invalid
+    * <code>Topic</code> throws a <code>javax.jms.InvalidDestinationException</code>.
+    */
+   public void testCreateDurableSubscriber_1()
+   {
+      try
+      {
+         subscriberSession.createDurableSubscriber((Topic) null, "topic");
+         fail("Should throw a javax.jms.InvalidDestinationException.\n");
+      }
+      catch (InvalidDestinationException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createSubscriber()</code> method with an invalid
+    * message selector throws a <code>javax.jms.InvalidSelectorException</code>.
+    */
+   public void testCreateSubscriber_2()
+   {
+      try
+      {
+         subscriberSession.createSubscriber(subscriberTopic, "definitely not a message selector!", true);
+         fail("Should throw a javax.jms.InvalidSelectorException.\n");
+      }
+      catch (InvalidSelectorException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidSelectorException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to the <code>createSubscriber()</code> method with an invalid
+    * <code>Topic</code> throws a <code>javax.jms.InvalidDestinationException</code>.
+    */
+   public void testCreateSubscriber_1()
+   {
+      try
+      {
+         subscriberSession.createSubscriber((Topic) null);
+         fail("Should throw a javax.jms.InvalidDestinationException.\n");
+      }
+      catch (InvalidDestinationException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(TopicSessionTest.class);
+   }
+
+   public TopicSessionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/UnifiedSessionTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,316 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.session;
+
+import javax.jms.JMSException;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.TopicConnection;
+import javax.jms.TopicSession;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.util.NestedRuntimeException;
+import org.objectweb.jtests.jms.framework.UnifiedTestCase;
+
+/**
+ * Test unified JMS 1.1 sessions.
+ * <br />
+ * See JMS 1.1 specifications
+ * 
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: UnifiedSessionTest.java,v 1.1 2007/03/29 04:28:37 starksm Exp $
+ * @since JMS 1.1
+ */
+public class UnifiedSessionTest extends UnifiedTestCase
+{
+
+   /**
+    * QueueConnection
+    */
+   protected QueueConnection queueConnection;
+
+   /**
+    * QueueSession (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected QueueSession queueSession;
+
+   /**
+    * TopicConnection
+    */
+   protected TopicConnection topicConnection;
+
+   /**
+    * TopicSession (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected TopicSession topicSession;
+
+   /**
+    * Test that a call to <code>createDurableConnectionConsumer()</code> method 
+    * on a <code>QueueConnection</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateDurableConnectionConsumerOnQueueConnection()
+   {
+      try
+      {
+         queueConnection.createDurableConnectionConsumer(topic, "subscriptionName", "", (ServerSessionPool) null, 1);
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>createDurableSubscriber()</code> method 
+    * on a <code>QueueSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateDurableSubscriberOnQueueSession()
+   {
+      try
+      {
+         queueSession.createDurableSubscriber(topic, "subscriptionName");
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>createTemporaryTopic()</code> method 
+    * on a <code>QueueSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateTemporaryTopicOnQueueSession()
+   {
+      try
+      {
+         queueSession.createTemporaryTopic();
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>createTopic()</code> method 
+    * on a <code>QueueSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateTopicOnQueueSession()
+   {
+      try
+      {
+         queueSession.createTopic("topic_name");
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>unsubscribe()</code> method 
+    * on a <code>QueueSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testUnsubscribeOnQueueSession()
+   {
+      try
+      {
+         queueSession.unsubscribe("subscriptionName");
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>createBrowser()</code> method 
+    * on a <code>TopicSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateBrowserOnTopicSession()
+   {
+      try
+      {
+         topicSession.createBrowser(queue);
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>createQueue()</code> method 
+    * on a <code>TopicSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateQueueOnTopicSession()
+   {
+      try
+      {
+         topicSession.createQueue("queue_name");
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   /**
+    * Test that a call to <code>createTemporaryQueue()</code> method 
+    * on a <code>TopicSession</code> throws a 
+    * <code>javax.jms.IllegalStateException</code>.
+    * (see JMS 1.1 specs, table 4-1).
+    * 
+    * @since JMS 1.1
+    */
+   public void testCreateTemporaryQueueOnTopicSession()
+   {
+      try
+      {
+         topicSession.createTemporaryQueue();
+         fail("Should throw a javax.jms.IllegalStateException");
+      }
+      catch (javax.jms.IllegalStateException e)
+      {
+      }
+      catch (JMSException e)
+      {
+         fail("Should throw a javax.jms.IllegalStateException, not a " + e);
+      }
+   }
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      try
+      {
+         queueConnection = queueConnectionFactory.createQueueConnection();
+         queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         topicConnection = topicConnectionFactory.createTopicConnection();
+         topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         queueConnection.start();
+         topicConnection.start();
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void tearDown() throws Exception
+   {
+      try
+      {
+         queueConnection.close();
+         topicConnection.close();
+      }
+      catch (Exception ignored)
+      {
+      }
+      finally
+      {
+         queueConnection = null;
+         queueSession = null;
+         topicConnection = null;
+         topicSession = null;
+         super.tearDown();
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(UnifiedSessionTest.class);
+   }
+
+   public UnifiedSessionTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/session/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,4 @@
+  <body>
+    Tests JMS <em>Session</em> features.
+  </body>
+  

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/TemporaryTopicTest.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/TemporaryTopicTest.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/TemporaryTopicTest.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,99 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.conform.topic;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.TopicSubscriber;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.objectweb.jtests.jms.framework.PubSubTestCase;
+import org.objectweb.jtests.jms.framework.TestConfig;
+
+/**
+ * Test the <code>javax.jms.TemporaryTopic</code> features.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: TemporaryTopicTest.java,v 1.1 2007/03/29 04:28:34 starksm Exp $
+ */
+public class TemporaryTopicTest extends PubSubTestCase
+{
+
+   private TemporaryTopic tempTopic;
+
+   private TopicSubscriber tempSubscriber;
+
+   /**
+    * Test a TemporaryTopic
+    */
+   public void testTemporaryTopic()
+   {
+      try
+      {
+         // we stop both publisher and subscriber connections
+         publisherConnection.stop();
+         subscriberConnection.stop();
+         // we create a temporary topic to receive messages
+         tempTopic = subscriberSession.createTemporaryTopic();
+         // we recreate the sender because it has been 
+         // already created with another Destination as parameter
+         publisher = publisherSession.createPublisher(tempTopic);
+         // we create a temporary subscriber on the temporary topic
+         tempSubscriber = subscriberSession.createSubscriber(tempTopic);
+         subscriberConnection.start();
+         publisherConnection.start();
+
+         TextMessage message = publisherSession.createTextMessage();
+         message.setText("testTemporaryTopic");
+         publisher.publish(message);
+
+         Message m = tempSubscriber.receive(TestConfig.TIMEOUT);
+         assertTrue(m instanceof TextMessage);
+         TextMessage msg = (TextMessage) m;
+         assertEquals("testTemporaryTopic", msg.getText());
+      }
+      catch (JMSException e)
+      {
+         fail(e);
+      }
+   }
+
+   /** 
+    * Method to use this class in a Test suite
+    */
+   public static Test suite()
+   {
+      return new TestSuite(TemporaryTopicTest.class);
+   }
+
+   public TemporaryTopicTest(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/topic/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+  <body>
+    Tests JMS <em>Topic</em> features.
+  </body>
\ No newline at end of file

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/JMSTestCase.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/JMSTestCase.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/JMSTestCase.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,121 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.framework;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.jms.JMSException;
+
+import org.objectweb.jtests.jms.admin.Admin;
+import org.objectweb.jtests.jms.admin.AdminFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * Class extending <code>junit.framework.TestCase</code> to
+ * provide a new <code>fail()</code> method with an <code>Exception</code>
+ * as parameter.
+ *<br />
+ * Every Test Case for JMS should extend this class instead of <code>junit.framework.TestCase</code>
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: JMSTestCase.java,v 1.2 2007/07/19 21:20:08 csuconic Exp $
+ */
+public abstract class JMSTestCase extends TestCase
+{
+    private static final String PROP_FILE_NAME = "provider.properties";
+    
+    protected Admin admin;
+
+   /**
+    * Fails a test with an exception which will be used for a message.
+    * 
+    * If the exception is an instance of <code>javax.jms.JMSException</code>, the
+    * message of the failure will contained both the JMSException and its linked exception
+    * (provided there's one).
+    */
+   public void fail(Exception e)
+   {
+      if (e instanceof javax.jms.JMSException)
+      {
+         JMSException exception = (JMSException) e;
+         String message = e.toString();
+         Exception linkedException = exception.getLinkedException();
+         if (linkedException != null)
+         {
+            message += " [linked exception: " + linkedException + "]";
+         }
+         super.fail(message);
+      }
+      else
+      {
+         super.fail(e.getMessage());
+      }
+   }
+
+   public JMSTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Should be overriden 
+    * @return
+    */
+   protected Properties getProviderProperties()
+   throws IOException
+   {
+       Properties props = new Properties();
+       props.load(ClassLoader.getSystemResourceAsStream(PROP_FILE_NAME));
+	   return props;
+   }
+   
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      // Admin step
+      // gets the provider administration wrapper...
+      Properties props = getProviderProperties();
+      admin = AdminFactory.getAdmin(props);
+      
+      admin.startEmbeddedServer();
+      
+      admin.start();
+   }
+   
+   @Override
+   protected void tearDown() throws Exception
+   {
+      admin.stop();
+      
+      admin.stopEmbeddedServer();
+      
+      super.tearDown();
+   }
+
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PTPTestCase.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PTPTestCase.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PTPTestCase.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,189 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.framework;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+
+import org.jboss.util.NestedRuntimeException;
+
+/**
+ * Creates convenient Point to Point JMS objects which can be needed for tests.
+ * <br />
+ * This class defines the setUp and tearDown methods so
+ * that JMS administrated objects and  other "ready to use" PTP objects (that is to say queues,
+ * sessions, senders and receviers) are available conveniently for the test cases.
+ * <br />
+ * Classes which want that convenience should extend <code>PTPTestCase</code> instead of 
+ * <code>JMSTestCase</code>.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: PTPTestCase.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
+ */
+public abstract class PTPTestCase extends JMSTestCase
+{
+
+   protected InitialContext ctx;
+
+   private static final String QCF_NAME = "testQCF";
+
+   private static final String QUEUE_NAME = "testJoramQueue";
+
+   /**
+    * Queue used by a sender
+    */
+   protected Queue senderQueue;
+
+   /**
+    * Sender on queue
+    */
+   protected QueueSender sender;
+
+   /**
+    * QueueConnectionFactory of the sender
+    */
+   protected QueueConnectionFactory senderQCF;
+
+   /**
+    * QueueConnection of the sender
+    */
+   protected QueueConnection senderConnection;
+
+   /**
+    * QueueSession of the sender (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected QueueSession senderSession;
+
+   /**
+    * Queue used by a receiver
+    */
+   protected Queue receiverQueue;
+
+   /**
+    * Receiver on queue
+    */
+   protected QueueReceiver receiver;
+
+   /**
+    * QueueConnectionFactory of the receiver
+    */
+   protected QueueConnectionFactory receiverQCF;
+
+   /**
+    * QueueConnection of the receiver
+    */
+   protected QueueConnection receiverConnection;
+
+   /**
+    * QueueSession of the receiver (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected QueueSession receiverSession;
+
+   /**
+    * Create all administrated objects connections and sessions ready to use for tests.
+    * <br />
+    * Start connections.
+    */
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      try
+      {
+         // ...and creates administrated objects and binds them
+         admin.createQueueConnectionFactory(QCF_NAME);
+         admin.createQueue(QUEUE_NAME);
+
+         // end of admin step, start of JMS client step
+         ctx = admin.createInitialContext();
+
+         senderQCF = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
+         senderQueue = (Queue) ctx.lookup(QUEUE_NAME);
+         senderConnection = senderQCF.createQueueConnection();
+         senderSession = senderConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         sender = senderSession.createSender(senderQueue);
+
+         receiverQCF = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
+         receiverQueue = (Queue) ctx.lookup(QUEUE_NAME);
+         receiverConnection = receiverQCF.createQueueConnection();
+         receiverSession = receiverConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         receiver = receiverSession.createReceiver(receiverQueue);
+
+         senderConnection.start();
+         receiverConnection.start();
+         //end of client step
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   /**
+    *  Close connections and delete administrated objects
+    */
+   protected void tearDown() throws Exception
+   {
+      try
+      {
+         senderConnection.close();
+         receiverConnection.close();
+
+         admin.deleteQueueConnectionFactory(QCF_NAME);
+         admin.deleteQueue(QUEUE_NAME);
+      }
+      catch (Exception ignored)
+      {
+         ignored.printStackTrace();
+      }
+      finally
+      {
+         senderQueue = null;
+         sender = null;
+         senderQCF = null;
+         senderSession = null;
+         senderConnection = null;
+
+         receiverQueue = null;
+         receiver = null;
+         receiverQCF = null;
+         receiverSession = null;
+         receiverConnection = null;
+      }
+      
+      super.tearDown();
+   }
+
+   public PTPTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PubSubTestCase.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PubSubTestCase.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/PubSubTestCase.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,190 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.framework;
+
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.InitialContext;
+
+import org.jboss.util.NestedRuntimeException;
+
+/**
+ * Creates convenient JMS Publish/Subscribe objects which can be needed for tests.
+ * <br />
+ * This class defines the setUp and tearDown methods so
+ * that JMS administrated objects and  other "ready to use" Pub/Sub objects (that is to say topics,
+ * sessions, publishers and subscribers) are available conveniently for the test cases.
+ * <br />
+ * Classes which want that convenience should extend <code>PubSubTestCase</code> instead of 
+ * <code>JMSTestCase</code>.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: PubSubTestCase.java,v 1.2 2007/06/19 23:32:35 csuconic Exp $
+ */
+public abstract class PubSubTestCase extends JMSTestCase
+{
+
+   private InitialContext ctx;
+
+   private static final String TCF_NAME = "testTCF";
+
+   private static final String TOPIC_NAME = "testJoramTopic";
+
+   /**
+    * Topic used by a publisher
+    */
+   protected Topic publisherTopic;
+
+   /**
+    * Publisher on queue
+    */
+   protected TopicPublisher publisher;
+
+   /**
+    * TopicConnectionFactory of the publisher
+    */
+   protected TopicConnectionFactory publisherTCF;
+
+   /**
+    * TopicConnection of the publisher
+    */
+   protected TopicConnection publisherConnection;
+
+   /**
+    * TopicSession of the publisher (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected TopicSession publisherSession;
+
+   /**
+    * Topic used by a subscriber
+    */
+   protected Topic subscriberTopic;
+
+   /**
+    * Subscriber on queue
+    */
+   protected TopicSubscriber subscriber;
+
+   /**
+    * TopicConnectionFactory of the subscriber
+    */
+   protected TopicConnectionFactory subscriberTCF;
+
+   /**
+    * TopicConnection of the subscriber
+    */
+   protected TopicConnection subscriberConnection;
+
+   /**
+    * TopicSession of the subscriber (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected TopicSession subscriberSession;
+
+   /**
+    * Create all administrated objects connections and sessions ready to use for tests.
+    * <br />
+    * Start connections.
+    */
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      try
+      {
+         // ...and creates administrated objects and binds them
+         admin.createTopicConnectionFactory(TCF_NAME);
+         admin.createTopic(TOPIC_NAME);
+
+         // end of admin step, start of JMS client step
+         ctx = admin.createInitialContext();
+
+         publisherTCF = (TopicConnectionFactory) ctx.lookup(TCF_NAME);
+         publisherTopic = (Topic) ctx.lookup(TOPIC_NAME);
+         publisherConnection = publisherTCF.createTopicConnection();
+         publisherConnection.setClientID("publisherConnection");
+         publisherSession = publisherConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         publisher = publisherSession.createPublisher(publisherTopic);
+
+         subscriberTCF = (TopicConnectionFactory) ctx.lookup(TCF_NAME);
+         subscriberTopic = (Topic) ctx.lookup(TOPIC_NAME);
+         subscriberConnection = subscriberTCF.createTopicConnection();
+         subscriberConnection.setClientID("subscriberConnection");
+         subscriberSession = subscriberConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subscriberSession.createSubscriber(subscriberTopic);
+
+         publisherConnection.start();
+         subscriberConnection.start();
+         //end of client step
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   /**
+    *  Close connections and delete administrated objects
+    */
+   protected void tearDown() throws Exception
+   {
+      try
+      {
+         publisherConnection.close();
+         subscriberConnection.close();
+
+         admin.deleteTopicConnectionFactory(TCF_NAME);
+         admin.deleteTopic(TOPIC_NAME);
+      }
+      catch (Exception ignored)
+      {
+      }
+      finally
+      {
+         publisherTopic = null;
+         publisher = null;
+         publisherTCF = null;
+         publisherSession = null;
+         publisherConnection = null;
+
+         subscriberTopic = null;
+         subscriber = null;
+         subscriberTCF = null;
+         subscriberSession = null;
+         subscriberConnection = null;
+      }
+      
+      super.tearDown();
+   }
+
+   public PubSubTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/TestConfig.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/TestConfig.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/TestConfig.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,70 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.framework;
+
+import java.util.Properties;
+
+/**
+ * Class used to provide configurable options in a convenient way
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: TestConfig.java,v 1.2 2007/06/14 18:39:51 csuconic Exp $
+ */
+public class TestConfig
+{
+   // name of the configuration file
+   private static final String PROP_FILE_NAME = "test.properties";
+
+   // name of the timeout property
+   private static final String PROP_NAME = "timeout";
+
+   /**
+    * timeout value used by <code>receive</code> method in the tests. 
+    * the value is specified in the <code>config/test.properties</code> file.
+    */
+   public static final long TIMEOUT;
+
+   static
+   {
+      // load tests.properties	 
+      long tempTimeOut = 0;
+      try
+      {
+         Properties props = new Properties();
+         props.load(ClassLoader.getSystemResourceAsStream(PROP_FILE_NAME));
+         System.out.println("Found " + PROP_FILE_NAME);
+         tempTimeOut = Long.parseLong(props.getProperty(PROP_NAME, "0"));
+      }
+      catch (Exception e)
+      {
+    	 e.printStackTrace();
+         tempTimeOut = 30000;
+      }
+      finally
+      {
+         TIMEOUT = tempTimeOut;
+      }
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/UnifiedTestCase.java	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/UnifiedTestCase.java	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,257 @@
+/*
+ * JORAM: Java(TM) Open Reliable Asynchronous Messaging
+ * Copyright (C) 2002 INRIA
+ * Contact: joram-team at objectweb.org
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ * USA
+ * 
+ * Initial developer(s): Jeff Mesnil (jmesnil at gmail.com)
+ * Contributor(s): ______________________________________.
+ */
+
+package org.objectweb.jtests.jms.framework;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnectionFactory;
+import javax.naming.InitialContext;
+
+import org.jboss.util.NestedRuntimeException;
+
+/**
+ * Creates convenient Unified JMS 1.1 objects which can be needed for tests.
+ * <br />
+ * This class defines the setUp and tearDown methods so
+ * that JMS administrated objects and  other "ready to use" JMS objects (that is to say destinations,
+ * sessions, producers and consumers) are available conveniently for the test cases.
+ * <br />
+ * Classes which want that convenience should extend <code>UnifiedTestCase</code> instead of 
+ * <code>JMSTestCase</code>.
+ *
+ * @author Jeff Mesnil (jmesnil at gmail.com)
+ * @version $Id: UnifiedTestCase.java,v 1.1 2007/03/29 04:28:35 starksm Exp $
+ * @since JMS 1.1
+ */
+public abstract class UnifiedTestCase extends JMSTestCase
+{
+
+   protected InitialContext ctx;
+
+   private static final String CF_NAME = "testCF";
+
+   private static final String TCF_NAME = "testTCF";
+
+   private static final String QCF_NAME = "testQCF";
+
+   private static final String DESTINATION_NAME = "testDestination";
+
+   private static final String QUEUE_NAME = "testJoramQueue";
+
+   private static final String TOPIC_NAME = "testJoramTopic";
+
+   ////////////////////
+   // Unified Domain //
+   ////////////////////
+
+   /**
+    * Destination used by a producer
+    */
+   protected Destination producerDestination;
+
+   /**
+    * Producer
+    */
+   protected MessageProducer producer;
+
+   /**
+    * ConnectionFactory of the producer
+    */
+   protected ConnectionFactory producerCF;
+
+   /**
+    * Connection of the producer
+    */
+   protected Connection producerConnection;
+
+   /**
+    * Session of the producer (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected Session producerSession;
+
+   /**
+    * Destination used by a consumer
+    */
+   protected Destination consumerDestination;
+
+   /**
+    * Consumer on destination
+    */
+   protected MessageConsumer consumer;
+
+   /**
+    * ConnectionFactory of the consumer
+    */
+   protected ConnectionFactory consumerCF;
+
+   /**
+    * Connection of the consumer
+    */
+   protected Connection consumerConnection;
+
+   /**
+    * Session of the consumer (non transacted, AUTO_ACKNOWLEDGE)
+    */
+   protected Session consumerSession;
+
+   ////////////////
+   // PTP Domain //
+   ////////////////
+
+   /**
+    * QueueConnectionFactory
+    */
+   protected QueueConnectionFactory queueConnectionFactory;
+
+   /**
+    * Queue
+    */
+   protected Queue queue;
+
+   ////////////////////
+   // Pub/Sub Domain //
+   ////////////////////
+
+   /**
+    * TopicConnectionFactory
+    */
+   protected TopicConnectionFactory topicConnectionFactory;
+
+   /**
+    * Topic
+    */
+   protected Topic topic;
+
+   /**
+    * Create all administrated objects connections and sessions ready to use for tests.
+    * <br />
+    * Start connections.
+    */
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      try
+      {
+         // ...and creates administrated objects and binds them
+         admin.createConnectionFactory(CF_NAME);
+         admin.createQueueConnectionFactory(QCF_NAME);
+         admin.createTopicConnectionFactory(TCF_NAME);
+         // destination for unified domain is a queue
+         admin.createQueue(DESTINATION_NAME);
+         admin.createQueue(QUEUE_NAME);
+         admin.createTopic(TOPIC_NAME);
+
+         // end of admin step, start of JMS client step
+         ctx = admin.createInitialContext();
+
+         producerCF = (ConnectionFactory) ctx.lookup(CF_NAME);
+         // we see destination of the unified domain as a javax.jms.Destination
+         // instead of a javax.jms.Queue to be more generic
+         producerDestination = (Destination) ctx.lookup(DESTINATION_NAME);
+         producerConnection = producerCF.createConnection();
+         producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         producer = producerSession.createProducer(producerDestination);
+
+         consumerCF = (ConnectionFactory) ctx.lookup(CF_NAME);
+         // we see destination of the unified domain as a javax.jms.Destination
+         // instead of a javax.jms.Queue to be more generic
+         consumerDestination = (Destination) ctx.lookup(DESTINATION_NAME);
+         consumerConnection = consumerCF.createConnection();
+         consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         consumer = consumerSession.createConsumer(consumerDestination);
+
+         queueConnectionFactory = (QueueConnectionFactory) ctx.lookup(QCF_NAME);
+         queue = (Queue) ctx.lookup(QUEUE_NAME);
+
+         topicConnectionFactory = (TopicConnectionFactory) ctx.lookup(TCF_NAME);
+         topic = (Topic) ctx.lookup(TOPIC_NAME);
+
+         producerConnection.start();
+         consumerConnection.start();
+         //end of client step
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   /**
+    *  Close connections and delete administrated objects
+    */
+   protected void tearDown() throws Exception
+   {
+      try
+      {
+         consumerConnection.close();
+         producerConnection.close();
+
+         admin.deleteConnectionFactory(CF_NAME);
+         admin.deleteQueueConnectionFactory(QCF_NAME);
+         admin.deleteTopicConnectionFactory(TCF_NAME);
+         admin.deleteQueue(DESTINATION_NAME);
+         admin.deleteQueue(QUEUE_NAME);
+         admin.deleteTopic(TOPIC_NAME);
+      }
+      catch (Exception ignored)
+      {
+      }
+      finally
+      {
+         producerDestination = null;
+         producer = null;
+         producerCF = null;
+         producerSession = null;
+         producerConnection = null;
+
+         consumerDestination = null;
+         consumer = null;
+         consumerCF = null;
+         consumerSession = null;
+         consumerConnection = null;
+
+         queueConnectionFactory = null;
+         queue = null;
+
+         topicConnectionFactory = null;
+         topic = null;
+      }
+      
+      super.tearDown();
+   }
+
+   public UnifiedTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/package.html
===================================================================
--- trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/package.html	                        (rev 0)
+++ trunk/tests/joram-tests/src/org/objectweb/jtests/jms/framework/package.html	2009-02-16 14:39:58 UTC (rev 5871)
@@ -0,0 +1,3 @@
+<body>
+Extension of JUnit Testing framework to take into account JMS specific features.
+</body>




More information about the jboss-cvs-commits mailing list