User: chirino
Date: 01/12/08 20:30:54
Modified: src/main/org/jboss/test/jbossmq/test
JBossMQUnitTestCase.java
Log:
Added a test to see if NoLocal works.
Revision Changes Path
1.6 +14 -10
jbosstest/src/main/org/jboss/test/jbossmq/test/JBossMQUnitTestCase.java
Index: JBossMQUnitTestCase.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jbossmq/test/JBossMQUnitTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JBossMQUnitTestCase.java 2001/12/09 04:17:13 1.5
+++ JBossMQUnitTestCase.java 2001/12/09 04:30:54 1.6
@@ -451,7 +451,7 @@
* be received by Subscribers on the same connection.
*/
public void testTopicNoLocal() throws Exception {
- getLog().debug("Starting Topic test");
+ getLog().debug("Starting TopicNoLocal test");
TopicConnectionFactory topicFactory =
(TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
TopicConnection topicConnection1 = topicFactory.createTopicConnection();
@@ -460,9 +460,9 @@
topicConnection2.start();
// We don't want local messages on this topic.
- TopicSession session1 = topicConnection1.createTopicSession(true,
Session.AUTO_ACKNOWLEDGE);
+ TopicSession session1 = topicConnection1.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topic = (Topic)context.lookup(TEST_TOPIC);
- TopicSubscriber sub = session1.createSubscriber(topic);
+ TopicSubscriber sub = session1.createSubscriber(topic, null, true);
TopicPublisher sender1 = session1.createPublisher(topic);
//Now a sender
@@ -478,14 +478,18 @@
// Get the messages, we should get the remote message
// but not the local message
TextMessage msg1 = (TextMessage)sub.receive(2000);
- assertTrue("Did not get any messages", msg1!=null);
- if( msg1 != null ) {
- assertTrue("Got a local message", !msg1.getText().equals("Local
Message"));
-
+ if( msg1 == null ) {
+ fail("Did not get any messages");
+ } else {
+ if(msg1.getText().equals("Local Message")) {
+ fail("Got a local message");
+ }
+ TextMessage msg2 = (TextMessage)sub.receive(2000);
+ if( msg2 != null ) {
+ fail("Got an extra message. msg1:"+msg1+", msg2:"+msg2);
+ }
}
- TextMessage msg2 = (TextMessage)sub.receive(2000);
- assertTrue("Got an extra message. msg1:"+msg1+", msg2:"+msg2, msg2==null);
-
+
topicConnection1.stop();
topicConnection1.close();
topicConnection2.stop();
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development