qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r585295 - /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
Date Wed, 17 Oct 2007 00:15:15 GMT
Author: rajith
Date: Tue Oct 16 17:15:14 2007
New Revision: 585295

URL: http://svn.apache.org/viewvc?rev=585295&view=rev
Log:
Isolated test case to show the selector problem

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java?rev=585295&r1=585294&r2=585295&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
Tue Oct 16 17:15:14 2007
@@ -1,30 +1,44 @@
 package org.apache.qpidity.nclient;
 
-import org.apache.qpidity.njms.ConnectionFactoryImpl;
-import org.apache.qpidity.njms.TopicImpl;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.framing.AMQShortString;
 
 public class JMSTestCase
 {
+
     public static void main(String[] args)
     {
+
         try
         {
-            javax.jms.Connection con = (new ConnectionFactoryImpl("localhost",5672, "test",
"guest","guest")).createConnection();
+            javax.jms.Connection con = new AMQConnection("qpid:password=guest;username=guest;client_id=clientid;virtualhost=test@tcp:127.0.0.1:5672");
             con.start();
-            
+
             javax.jms.Session ssn = con.createSession(false, 1);
-            
-            javax.jms.Destination dest = new TopicImpl("myTopic");
+
+            javax.jms.Destination dest = new AMQTopic(new AMQShortString("amq.topic"),"myTopic");
             javax.jms.MessageProducer prod = ssn.createProducer(dest);
-            javax.jms.MessageConsumer cons = ssn.createConsumer(dest); 
-            
-            javax.jms.BytesMessage msg = ssn.createBytesMessage();
-            msg.writeInt(123);
+            javax.jms.MessageConsumer cons = ssn.createConsumer(dest,"targetMessage = TRUE");
+
+            javax.jms.TextMessage msg = ssn.createTextMessage();
+            msg.setText("This is a test message");
+            msg.setBooleanProperty("targetMessage", false);
             prod.send(msg);
-            
-            javax.jms.BytesMessage m = (javax.jms.BytesMessage)cons.receive();
-            System.out.println("Data : " + m.readInt());
-            
+
+            msg.setBooleanProperty("targetMessage", true);
+            prod.send(msg);
+
+            javax.jms.TextMessage m = (javax.jms.TextMessage)cons.receiveNoWait();
+
+            if (m == null)
+            {
+               System.out.println("message is null");
+            }
+            else
+            {
+               System.out.println("message is not null");
+            }
         }
         catch(Exception e)
         {



Mime
View raw message