Author: jmesnil
Date: 2009-11-04 06:07:46 -0500 (Wed, 04 Nov 2009)
New Revision: 8207
Modified:
trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorTest.java
Log:
simplified tests
Modified:
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 2009-11-04
10:12:56 UTC (rev 8206)
+++
trunk/tests/joram-tests/src/org/objectweb/jtests/jms/conform/selector/SelectorTest.java 2009-11-04
11:07:46 UTC (rev 8207)
@@ -14,7 +14,6 @@
package org.objectweb.jtests.jms.conform.selector;
import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
import javax.jms.TextMessage;
import junit.framework.Test;
@@ -36,30 +35,21 @@
* Test that an empty string as a message selector indicates that there
* is no message selector for the message consumer.
*/
- public void testEmptyStringAsSelector()
+ public void testEmptyStringAsSelector() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "");
- TextMessage message = senderSession.createTextMessage();
- message.setText("testEmptyStringAsSelector");
- sender.send(message);
+ 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertTrue("No message was received", msg != null);
+ assertEquals("testEmptyStringAsSelector", msg.getText());
}
/**
@@ -70,74 +60,56 @@
* </ul>
*/
- public void testStringLiterals()
+ public void testStringLiterals() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "string =
'literal''s'");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "string =
'literal''s'");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setStringProperty("string", "literal");
- dummyMessage.setText("testStringLiterals:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertTrue("No message was received", msg != null);
+ assertEquals("testStringLiterals:2", msg.getText());
}
/**
* 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()
+ public void testJMSDeliveryModeInSelector() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "JMSDeliveryMode =
'PERSISTENT'");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "JMSDeliveryMode =
'PERSISTENT'");
- 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 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 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);
- }
+ 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());
}
/**
@@ -145,35 +117,26 @@
* 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()
+ public void testIdentifierConversion() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "NumberOfOrders
> 1");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "NumberOfOrders >
1");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setStringProperty("NumberOfOrders", "2");
- dummyMessage.setText("testIdentifierConversion:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertEquals("testIdentifierConversion:2", msg.getText());
}
/**
@@ -183,40 +146,31 @@
* <li><code>"JMSType = 'car' AND color = 'blue'
AND weight > 2500"</code></li>
* </ul>
*/
- public void testSelectorExampleFromSpecs()
+ public void testSelectorExampleFromSpecs() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue,
- "JMSType = 'car' AND
color = 'blue' AND weight > 2500");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue,
+ "JMSType = 'car' AND color = 'blue' AND weight >
2500");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setJMSType("car");
- dummyMessage.setStringProperty("color", "red");
- dummyMessage.setLongProperty("weight", 3000);
- dummyMessage.setText("testSelectorExampleFromSpecs:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertEquals("testSelectorExampleFromSpecs:2", msg.getText());
}
/**
@@ -226,73 +180,55 @@
* <li><code>"weight > 2500"</code> is
<code>true</code> for 3000 and <code>false</code> for
1000</li>
* </ul>
*/
- public void testGreaterThan()
+ public void testGreaterThan() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "weight >
2500");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "weight >
2500");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setLongProperty("weight", 1000);
- dummyMessage.setText("testGreaterThan:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertEquals("testGreaterThan:2", msg.getText());
}
/**
* 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>
+ * <li><code>"weight = 2500"</code> is
<code>true</code> for 2500 and <code>false</code> for
1000</li>
* </ul>
*/
- public void testEquals()
+ public void testEquals() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "weight =
2500");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "weight =
2500");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setLongProperty("weight", 1000);
- dummyMessage.setText("testEquals:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertEquals("testEquals:2", msg.getText());
}
/**
@@ -302,35 +238,26 @@
* <li><code>"weight <> 2500"</code> is
<code>true</code> for 1000 and <code>false</code> for
2500</li>
* </ul>
*/
- public void testNotEquals()
+ public void testNotEquals() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "weight <>
2500");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "weight <>
2500");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setLongProperty("weight", 2500);
- dummyMessage.setText("testEquals:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
+ assertEquals("testEquals:2", msg.getText());
}
/**
@@ -340,38 +267,28 @@
* <li>"age BETWEEN 15 and 19" is <code>true</code> for
17 and <code>false</code> for 20</li>
* </ul>
*/
- public void testBetween()
+ public void testBetween() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "age BETWEEN 15
and 19");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "age BETWEEN 15 and
19");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setIntProperty("age", 20);
- dummyMessage.setText("testBetween:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ 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());
}
/**
@@ -381,38 +298,28 @@
* <li>"Country IN ('UK', 'US', 'France')"
is <code>true</code> for 'UK' and <code>false</code> for
'Peru'</li>
* </ul>
*/
- public void testIn()
+ public void testIn() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "Country IN
('UK', 'US', 'France')");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "Country IN
('UK', 'US', 'France')");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setStringProperty("Country", "Peru");
- dummyMessage.setText("testIn:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ 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());
}
/**
@@ -422,38 +329,28 @@
* <li>"underscored LIKE '\_%' ESCAPE '\'" is
<code>true</code> for '_foo' and <code>false</code> for
'bar'</li>
* </ul>
*/
- public void testLikeEscape()
+ public void testLikeEscape() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "underscored LIKE
'\\_%' ESCAPE '\\'");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "underscored LIKE
'\\_%' ESCAPE '\\'");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setStringProperty("underscored", "bar");
- dummyMessage.setText("testLikeEscape:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ 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());
}
/**
@@ -463,38 +360,28 @@
* <li>"word LIKE 'l_se'" is <code>true</code>
for 'lose' and <code>false</code> for 'loose'</li>
* </ul>
*/
- public void testLike_2()
+ public void testLike_2() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "word LIKE
'l_se'");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "word LIKE
'l_se'");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setStringProperty("word", "loose");
- dummyMessage.setText("testLike_2:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ 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());
}
/**
@@ -504,38 +391,28 @@
* <li>"phone LIKE '12%3'" is <code>true</code>
for '12993' and <code>false</code> for '1234'</li>
* </ul>
*/
- public void testLike_1()
+ public void testLike_1() throws Exception
{
- try
+ if (receiver != null)
{
- receiverConnection.stop();
- if (receiver != null)
- {
- receiver.close();
- }
- receiver = receiverSession.createReceiver(receiverQueue, "phone LIKE
'12%3'");
- receiverConnection.start();
+ receiver.close();
+ }
+ receiver = receiverSession.createReceiver(receiverQueue, "phone LIKE
'12%3'");
- TextMessage dummyMessage = senderSession.createTextMessage();
- dummyMessage.setStringProperty("phone", "1234");
- dummyMessage.setText("testLike_1:1");
- sender.send(dummyMessage);
+ 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 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);
- }
+ 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());
}
/**
@@ -545,17 +422,13 @@
* <li><code>"prop IS NULL"</code></li>
* </ul>
*/
- public void testNull()
+ public void testNull() throws Exception
{
- 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");
@@ -569,11 +442,6 @@
TextMessage msg = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
assertTrue(msg != null);
assertEquals("testNull:2", msg.getText());
- }
- catch (JMSException e)
- {
- fail(e);
- }
}
/**