You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2016/12/07 14:42:14 UTC

svn commit: r1773089 - in /qpid/java/trunk: broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ systests/src/test/java/org/apache/qpid/client/ test-profiles/

Author: lquack
Date: Wed Dec  7 14:42:14 2016
New Revision: 1773089

URL: http://svn.apache.org/viewvc?rev=1773089&view=rev
Log:
QPID-7578: [Java Broker] make AMQP 1.0 temporary queues globally addressable

Modified:
    qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
    qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/TemporaryQueuePrefixTest.java
    qpid/java/trunk/test-profiles/Java10BrokenTestsExcludes

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java?rev=1773089&r1=1773088&r2=1773089&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java Wed Dec  7 14:42:14 2016
@@ -180,6 +180,7 @@ public class Session_1_0 implements AMQS
             new Error(LinkError.DETACH_FORCED,
                       "Force detach the link because the session is remotely ended.");
 
+    private final String _primaryDomain;
     private final Set<Object> _blockingEntities = Collections.newSetFromMap(new ConcurrentHashMap<Object,Boolean>());
     private volatile long _startedTransactions;
     private volatile long _committedTransactions;
@@ -211,6 +212,7 @@ public class Session_1_0 implements AMQS
                 ? ((ConfiguredObject)connection.getAddressSpace()).newToken(_subject)
                 : connection.getBroker().newToken(_subject);
         _logSubject = new ChannelLogSubject(this);
+        _primaryDomain = getPrimaryDomain();
     }
 
     public void setReceivingChannel(final short receivingChannel)
@@ -1111,7 +1113,7 @@ public class Session_1_0 implements AMQS
 
     private Queue<?> createTemporaryQueue(Map properties)
     {
-        final String queueName = UUID.randomUUID().toString();
+        final String queueName = _primaryDomain + "TempQueue" + UUID.randomUUID().toString();
         Queue<?> queue = null;
         try
         {
@@ -1834,6 +1836,26 @@ public class Session_1_0 implements AMQS
         MessageSource source = getAddressSpace().getAttainedMessageSource(name);
         return source instanceof Queue ? (Queue<?>) source : null;
     }
+
+    private String getPrimaryDomain()
+    {
+        String primaryDomain = "";
+        final List<String> globalAddressDomains = getAddressSpace().getGlobalAddressDomains();
+        if (globalAddressDomains != null && !globalAddressDomains.isEmpty())
+        {
+            primaryDomain = globalAddressDomains.get(0);
+            if(primaryDomain != null)
+            {
+                primaryDomain = primaryDomain.trim();
+                if(!primaryDomain.endsWith("/"))
+                {
+                    primaryDomain += "/";
+                }
+            }
+        }
+        return primaryDomain;
+    }
+
     private final class CapacityCheckAction implements Action<MessageInstance>
     {
         @Override

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/TemporaryQueuePrefixTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/TemporaryQueuePrefixTest.java?rev=1773089&r1=1773088&r2=1773089&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/TemporaryQueuePrefixTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/TemporaryQueuePrefixTest.java Wed Dec  7 14:42:14 2016
@@ -29,6 +29,14 @@ import javax.jms.TemporaryQueue;
 public class TemporaryQueuePrefixTest extends QpidBrokerTestCase
 {
     @Override
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        // FIXME: This seems to be necessary to run this test from IntelliJ. Otherwise the context var ${qpid.globalAddressDomains} in the blueprint will be expanded. Not sure why.
+        setTestSystemProperty("virtualhostnode.context.blueprint", "{\"type\":\"ProvidedStore\",\"globalAddressDomains\":\"${qpid.globalAddressDomains}\"}");
+    }
+
+    @Override
     public void startDefaultBroker() throws Exception
     {
         // deliberately don't start broker

Modified: qpid/java/trunk/test-profiles/Java10BrokenTestsExcludes
URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/Java10BrokenTestsExcludes?rev=1773089&r1=1773088&r2=1773089&view=diff
==============================================================================
--- qpid/java/trunk/test-profiles/Java10BrokenTestsExcludes (original)
+++ qpid/java/trunk/test-profiles/Java10BrokenTestsExcludes Wed Dec  7 14:42:14 2016
@@ -23,8 +23,6 @@
 
 // Broker side defect - not creating temp queues with prefixes
 
-org.apache.qpid.client.TemporaryQueuePrefixTest#*
-
 // AMQP 1.0 allows more than one txn per session, so our mechanism of installing transaction timeout tickers will need to change
 org.apache.qpid.test.unit.transacted.TransactionTimeoutTest#*
 org.apache.qpid.test.unit.transacted.TransactionTimeoutDisabledTest#*



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org