[hornetq-commits] JBoss hornetq SVN: r7978 - in trunk: src/main/org/hornetq/jms/client and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Sep 22 09:57:55 EDT 2009
Author: jmesnil
Date: 2009-09-22 09:57:55 -0400 (Tue, 22 Sep 2009)
New Revision: 7978
Modified:
trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/hornetq/jms/client/HornetQSession.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/MessageProducerTest.java
Log:
HORNETQ-29: Need to check permissions on create producer for JMS
* uncommented code in HornetQSession.createProducer(Destination)
* in HornetQSession, added a special case when the client query if the management queue
exists (it does not exist but we return that it exists to allow JMS client to send messages to it)
* uncommented test in MessageProducerTest to check that a JMS producer can not be created if the destination
does not exist
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-09-22 09:26:46 UTC (rev 7977)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-09-22 13:57:55 UTC (rev 7978)
@@ -1483,6 +1483,11 @@
filterString,
binding.getAddress());
}
+ // make an exception for the management address (see HORNETQ-29)
+ else if (name.equals(managementAddress))
+ {
+ response = new SessionQueueQueryResponseMessage(true, -1, -1, null, managementAddress);
+ }
else
{
response = new SessionQueueQueryResponseMessage();
Modified: trunk/src/main/org/hornetq/jms/client/HornetQSession.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQSession.java 2009-09-22 09:26:46 UTC (rev 7977)
+++ trunk/src/main/org/hornetq/jms/client/HornetQSession.java 2009-09-22 13:57:55 UTC (rev 7978)
@@ -513,29 +513,28 @@
{
HornetQDestination jbd = (HornetQDestination)destination;
- //TODO Uncomment when https://jira.jboss.org/jira/browse/JBMESSAGING-1565 is complete
-// if (jbd != null)
-// {
-// if (jbd instanceof Queue)
-// {
-// SessionQueueQueryResponseMessage response = session.queueQuery(jbd.getSimpleAddress());
-//
-// if (!response.isExists())
-// {
-// throw new InvalidDestinationException("Queue " + jbd.getName() + " does not exist");
-// }
-// }
-// else
-// {
-// SessionBindingQueryResponseMessage response = session.bindingQuery(jbd.getSimpleAddress());
-//
-// if (!response.isExists())
-// {
-// throw new InvalidDestinationException("Topic " + jbd.getName() + " does not exist");
-// }
-// }
-// }
+ if (jbd != null)
+ {
+ if (jbd instanceof Queue)
+ {
+ SessionQueueQueryResponseMessage response = session.queueQuery(jbd.getSimpleAddress());
+ if (!response.isExists())
+ {
+ throw new InvalidDestinationException("Queue " + jbd.getName() + " does not exist");
+ }
+ }
+ else
+ {
+ SessionBindingQueryResponseMessage response = session.bindingQuery(jbd.getSimpleAddress());
+
+ if (!response.isExists())
+ {
+ throw new InvalidDestinationException("Topic " + jbd.getName() + " does not exist");
+ }
+ }
+ }
+
ClientProducer producer = session.createProducer(jbd == null ? null : jbd.getSimpleAddress());
return new HornetQMessageProducer(connection, producer, jbd, session);
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/MessageProducerTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/MessageProducerTest.java 2009-09-22 09:26:46 UTC (rev 7977)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/MessageProducerTest.java 2009-09-22 13:57:55 UTC (rev 7978)
@@ -18,12 +18,14 @@
import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
+import javax.jms.InvalidDestinationException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
+import org.hornetq.jms.HornetQTopic;
import org.hornetq.jms.tests.message.SimpleJMSMessage;
import org.hornetq.jms.tests.message.SimpleJMSTextMessage;
@@ -386,8 +388,8 @@
pconn.close();
}
}
- //TODO Uncomment when https://jira.jboss.org/jira/browse/JBMESSAGING-1565 is complete
- /*public void testCreateProducerOnInexistentDestination() throws Exception
+
+ public void testCreateProducerOnInexistentDestination() throws Exception
{
Connection pconn = cf.createConnection();
try
@@ -408,7 +410,7 @@
pconn.close();
}
}
-*/
+
//
// disabled MessageID tests
//
More information about the hornetq-commits
mailing list