[jboss-cvs] JBossAS SVN: r100068 - in projects/joram-tests/trunk: src/main/java/org/objectweb/jtests/jms/conform/message/properties and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 28 13:49:25 EST 2010
Author: clebert.suconic at jboss.com
Date: 2010-01-28 13:49:24 -0500 (Thu, 28 Jan 2010)
New Revision: 100068
Modified:
projects/joram-tests/trunk/
projects/joram-tests/trunk/.classpath
projects/joram-tests/trunk/.project
projects/joram-tests/trunk/pom.xml
projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java
projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java
projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
Log:
Applying Jeff Mesnil's latest changes to those tests
Property changes on: projects/joram-tests/trunk
___________________________________________________________________
Name: svn:ignore
- output
target
+ output
target
.settings
Modified: projects/joram-tests/trunk/.classpath
===================================================================
--- projects/joram-tests/trunk/.classpath 2010-01-28 17:58:15 UTC (rev 100067)
+++ projects/joram-tests/trunk/.classpath 2010-01-28 18:49:24 UTC (rev 100068)
@@ -1,16 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry exported="true" kind="lib" path="src/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="MVN_REPO/apache-log4j/log4j/1.2.8/log4j-1.2.8.jar"/>
- <classpathentry kind="var" path="MVN_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
- <classpathentry kind="var" path="MVN_REPO/jboss/jboss-test/1.0.1.GA/jboss-test-1.0.1.GA.jar"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
- <classpathentry kind="var" path="MVN_REPO/jboss/jboss-common-core/2.0.3.GA/jboss-common-core-2.0.3.GA.jar"/>
- <classpathentry kind="var" path="MVN_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA.jar"/>
- <classpathentry kind="var" path="MVN_REPO/jboss/jboss-logging-log4j/2.0.3.GA/jboss-logging-log4j-2.0.3.GA.jar"/>
- <classpathentry kind="var" path="MVN_REPO/jboss/jboss-j2ee/4.0.2/jboss-j2ee-4.0.2.jar"/>
- <classpathentry kind="var" path="MVN_REPO/jboss/jboss-j2se/5.0-SNAPSHOT/jboss-j2se-5.0-SNAPSHOT.jar"/>
- <classpathentry kind="output" path="output/eclipse-classes"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/joram-tests/trunk/.project
===================================================================
--- projects/joram-tests/trunk/.project 2010-01-28 17:58:15 UTC (rev 100067)
+++ projects/joram-tests/trunk/.project 2010-01-28 18:49:24 UTC (rev 100068)
@@ -14,8 +14,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Modified: projects/joram-tests/trunk/pom.xml
===================================================================
--- projects/joram-tests/trunk/pom.xml 2010-01-28 17:58:15 UTC (rev 100067)
+++ projects/joram-tests/trunk/pom.xml 2010-01-28 18:49:24 UTC (rev 100068)
@@ -1,10 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>jboss</groupId>
+ <groupId>objectweb-joramtests</groupId>
<artifactId>joramtests</artifactId>
<packaging>jar</packaging>
- <version>1.3</version>
+ <version>1.6</version>
<name>JBoss ported Object Joram JMS tests</name>
<url>http://www.jboss.org</url>
<licenses>
@@ -106,27 +106,24 @@
<groupId>jboss</groupId>
<artifactId>jboss-common-core</artifactId>
<version>2.0.3.GA</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-j2ee</artifactId>
<version>4.0.2</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
- <artifactId>jboss-j2se</artifactId>
- <version>5.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
<artifactId>jboss-logging-log4j</artifactId>
<version>2.0.3.GA</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss.test</groupId>
<artifactId>jboss-test</artifactId>
- <version>1.0.1.GA</version>
+ <version>1.1.5.GA</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Modified: projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java
===================================================================
--- projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java 2010-01-28 17:58:15 UTC (rev 100067)
+++ projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/JMSXPropertyTest.java 2010-01-28 18:49:24 UTC (rev 100068)
@@ -100,32 +100,6 @@
}
/**
- * 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()
Modified: projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java
===================================================================
--- projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java 2010-01-28 17:58:15 UTC (rev 100067)
+++ projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyTest.java 2010-01-28 18:49:24 UTC (rev 100068)
@@ -32,6 +32,7 @@
import javax.jms.MessageFormatException;
import javax.jms.TextMessage;
+import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -40,9 +41,9 @@
/**
* Test the <code>javax.jms.Message</code> properties.
* <br />
- * See JMS Specification, §3.5 Message Properties (p.32-37)
+ * See JMS Specification, sec. 3.5 Message Properties (p.32-37)
*
- * @author Jeff Mesnil (jmesnil at inrialpes.fr)
+ * @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
@@ -59,15 +60,14 @@
{
Message message = senderSession.createMessage();
message.setObjectProperty("prop", new Vector());
- fail("§3.5.5 An attempt to use any other class [than Boolean, Byte,...,String] must throw "
- + "a JMS MessageFormatException.\n");
+ Assert.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);
+ Assert.fail("Should throw a javax.jms.MessageFormatException, not a " + e);
}
}
@@ -81,7 +81,7 @@
{
Message message = senderSession.createMessage();
message.setObjectProperty("pi", new Float(3.14159f));
- assertEquals(3.14159f, message.getFloatProperty("pi"), 0);
+ Assert.assertEquals(3.14159f, message.getFloatProperty("pi"), 0);
}
catch (JMSException e)
{
@@ -98,9 +98,9 @@
try
{
Message message = senderSession.createMessage();
- assertEquals(
- "§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"));
+ Assert.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)
{
@@ -117,9 +117,9 @@
try
{
Message message = senderSession.createMessage();
- assertEquals(
- "§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"));
+ Assert.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)
{
@@ -137,7 +137,7 @@
{
Message message = senderSession.createMessage();
message.getDoubleProperty("prop");
- fail("Should raise a NullPointerException.\n");
+ Assert.fail("Should raise a NullPointerException.\n");
}
catch (NullPointerException e)
{
@@ -158,7 +158,7 @@
{
Message message = senderSession.createMessage();
message.getFloatProperty("prop");
- fail("Should raise a NullPointerException.\n");
+ Assert.fail("Should raise a NullPointerException.\n");
}
catch (NullPointerException e)
{
@@ -179,7 +179,7 @@
{
Message message = senderSession.createMessage();
message.getLongProperty("prop");
- fail("Should raise a NumberFormatException.\n");
+ Assert.fail("Should raise a NumberFormatException.\n");
}
catch (NumberFormatException e)
{
@@ -200,7 +200,7 @@
{
Message message = senderSession.createMessage();
message.getIntProperty("prop");
- fail("Should raise a NumberFormatException.\n");
+ Assert.fail("Should raise a NumberFormatException.\n");
}
catch (NumberFormatException e)
{
@@ -221,7 +221,7 @@
{
Message message = senderSession.createMessage();
message.getShortProperty("prop");
- fail("Should raise a NumberFormatException.\n");
+ Assert.fail("Should raise a NumberFormatException.\n");
}
catch (NumberFormatException e)
{
@@ -242,7 +242,7 @@
{
Message message = senderSession.createMessage();
message.getByteProperty("prop");
- fail("Should raise a NumberFormatException.\n");
+ Assert.fail("Should raise a NumberFormatException.\n");
}
catch (NumberFormatException e)
{
@@ -262,7 +262,7 @@
try
{
Message message = senderSession.createMessage();
- assertEquals(false, message.getBooleanProperty("prop"));
+ Assert.assertEquals(false, message.getBooleanProperty("prop"));
}
catch (JMSException e)
{
@@ -272,7 +272,7 @@
/**
* Test that the <code>Message.getPropertyNames()</code> method does not return
- * the name of the JMS standard header fields (e.g. <code>JMSCorrelationID</code>.
+ * the name of the JMS standard header fields (e.g. <code>JMSCorrelationID</code>).
*/
public void testGetPropertyNames()
{
@@ -281,8 +281,14 @@
Message message = senderSession.createMessage();
message.setJMSCorrelationID("foo");
Enumeration enumeration = message.getPropertyNames();
- assertTrue("§3.5.6 The getPropertyNames method does not return the names of "
- + "the JMS standard header field [e.g. JMSCorrelationID].\n", !enumeration.hasMoreElements());
+ while (enumeration.hasMoreElements())
+ {
+ String propName = (String)enumeration.nextElement();
+ boolean valid = !propName.startsWith("JMS") || propName.startsWith("JMSX");
+ Assert.assertTrue("sec. 3.5.6 The getPropertyNames method does not return the names of " + "the JMS standard header field [e.g. JMSCorrelationID]: " +
+ propName,
+ valid);
+ }
}
catch (JMSException e)
{
@@ -291,10 +297,7 @@
}
/**
- * 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.
+ * Test that the <code>Message.getPropertyNames()</code> methods.
*/
public void testPropertyIteration()
{
@@ -302,10 +305,28 @@
{
Message message = senderSession.createMessage();
Enumeration enumeration = message.getPropertyNames();
- assertTrue("No property yet defined.\n", !enumeration.hasMoreElements());
+ // there can be some properties already defined (e.g. JMSXDeliveryCount)
+ int originalCount = 0;
+ while (enumeration.hasMoreElements())
+ {
+ enumeration.nextElement();
+ originalCount++;
+ }
message.setDoubleProperty("pi", 3.14159);
enumeration = message.getPropertyNames();
- assertEquals("One property defined of name 'pi'.\n", "pi", (String) enumeration.nextElement());
+ boolean foundPiProperty = false;
+ int newCount = 0;
+ while (enumeration.hasMoreElements())
+ {
+ String propName = (String)enumeration.nextElement();
+ newCount++;
+ if ("pi".equals(propName))
+ {
+ foundPiProperty = true;
+ }
+ }
+ Assert.assertEquals(originalCount + 1, newCount);
+ Assert.assertTrue(foundPiProperty);
}
catch (JMSException e)
{
@@ -324,8 +345,9 @@
TextMessage message = senderSession.createTextMessage();
message.setText("foo");
message.clearProperties();
- assertEquals("§3.5.7 Clearing a message's property entries does not clear the value of its body.\n", "foo",
- message.getText());
+ Assert.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)
{
@@ -344,8 +366,9 @@
TextMessage message = senderSession.createTextMessage();
message.setStringProperty("prop", "foo");
message.clearProperties();
- assertEquals("§3.5.7 A message's properties are deleted by the clearProperties method.\n", null, message
- .getStringProperty("prop"));
+ Assert.assertEquals("sec. 3.5.7 A message's properties are deleted by the clearProperties method.\n",
+ null,
+ message.getStringProperty("prop"));
}
catch (JMSException e)
{
@@ -361,7 +384,7 @@
return new TestSuite(MessagePropertyTest.class);
}
- public MessagePropertyTest(String name)
+ public MessagePropertyTest(final String name)
{
super(name);
}
Modified: projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
===================================================================
--- projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java 2010-01-28 17:58:15 UTC (rev 100067)
+++ projects/joram-tests/trunk/src/main/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java 2010-01-28 18:49:24 UTC (rev 100068)
@@ -32,6 +32,7 @@
import javax.jms.TextMessage;
import javax.jms.Topic;
+import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -39,8 +40,7 @@
import org.objectweb.jtests.jms.framework.TestConfig;
/**
- * Test topic sessions
- * <br />
+ * Test topic sessions <br />
* See JMS specifications, �4.4 Session
*
* @author Jeff Mesnil (jmesnil at inrialpes.fr)
@@ -50,8 +50,8 @@
{
/**
- * Test that if we rollback a transaction which has consumed a message,
- * the message is effectively redelivered.
+ * Test that if we rollback a transaction which has consumed a message, the
+ * message is effectively redelivered.
*/
public void testRollbackReceivedMessage()
{
@@ -61,7 +61,7 @@
// publisherSession has been declared has non transacted
// we recreate it as a transacted session
publisherSession = publisherConnection.createTopicSession(true, 0);
- assertEquals(true, publisherSession.getTransacted());
+ Assert.assertEquals(true, publisherSession.getTransacted());
// we also recreate the publisher
publisher = publisherSession.createPublisher(publisherTopic);
publisherConnection.start();
@@ -70,7 +70,7 @@
// subscriberSession has been declared has non transacted
// we recreate it as a transacted session
subscriberSession = subscriberConnection.createTopicSession(true, 0);
- assertEquals(true, subscriberSession.getTransacted());
+ Assert.assertEquals(true, subscriberSession.getTransacted());
// we also recreate the subscriber
subscriber = subscriberSession.createSubscriber(subscriberTopic);
subscriberConnection.start();
@@ -85,18 +85,18 @@
// we receive it
Message msg1 = subscriber.receive(TestConfig.TIMEOUT);
- assertTrue("no message received", msg1 != null);
- assertTrue(msg1 instanceof TextMessage);
- assertEquals("testRollbackReceivedMessage", ((TextMessage) msg1).getText());
+ Assert.assertTrue("no message received", msg1 != null);
+ Assert.assertTrue(msg1 instanceof TextMessage);
+ Assert.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());
+ Assert.assertTrue("no message received after rollbacking subscriber session.", msg2 != null);
+ Assert.assertTrue(msg2 instanceof TextMessage);
+ Assert.assertEquals("testRollbackReceivedMessage", ((TextMessage) msg2).getText());
// finally we commit the subscriberSession transaction
subscriberSession.commit();
@@ -108,8 +108,8 @@
}
/**
- * Test that a durable subscriber effectively receives the messages sent to its
- * topic while it was inactive.
+ * Test that a durable subscriber effectively receives the messages sent to
+ * its topic while it was inactive.
*/
public void testDurableSubscriber()
{
@@ -130,8 +130,8 @@
subscriberConnection.start();
TextMessage m = (TextMessage) subscriber.receive(TestConfig.TIMEOUT);
- assertTrue(m != null);
- assertEquals("test", m.getText());
+ Assert.assertTrue(m != null);
+ Assert.assertEquals("test", m.getText());
}
catch (JMSException e)
{
@@ -158,87 +158,90 @@
}
/**
- * Test that a call to the <code>createDurableSubscriber()</code> method with an invalid
- * message selector throws a <code>javax.jms.InvalidSelectorException</code>.
+ * 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");
+ subscriberSession.createDurableSubscriber(subscriberTopic, "topic", "definitely not a message selector!", true);
+ Assert.fail("Should throw a javax.jms.InvalidSelectorException.\n");
}
catch (InvalidSelectorException e)
{
}
catch (JMSException e)
{
- fail("Should throw a javax.jms.InvalidSelectorException, not a " + e);
+ Assert.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>.
+ * 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");
+ Assert.fail("Should throw a javax.jms.InvalidDestinationException.\n");
}
catch (InvalidDestinationException e)
{
}
catch (JMSException e)
{
- fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
+ Assert.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>.
+ * 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");
+ Assert.fail("Should throw a javax.jms.InvalidSelectorException.\n");
}
catch (InvalidSelectorException e)
{
}
catch (JMSException e)
{
- fail("Should throw a javax.jms.InvalidSelectorException, not a " + e);
+ Assert.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>.
+ * 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");
+ Assert.fail("Should throw a javax.jms.InvalidDestinationException.\n");
}
catch (InvalidDestinationException e)
{
}
catch (JMSException e)
{
- fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
+ Assert.fail("Should throw a javax.jms.InvalidDestinationException, not a " + e);
}
}
- /**
+ /**
* Method to use this class in a Test suite
*/
public static Test suite()
@@ -246,7 +249,7 @@
return new TestSuite(TopicSessionTest.class);
}
- public TopicSessionTest(String name)
+ public TopicSessionTest(final String name)
{
super(name);
}
More information about the jboss-cvs-commits
mailing list