qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1726244 - in /qpid/java/trunk: broker-core/src/main/java/org/apache/qpid/server/logging/messages/ broker-core/src/main/java/org/apache/qpid/server/queue/ broker-core/src/test/java/org/apache/qpid/server/logging/messages/ systests/src/test/...
Date Fri, 22 Jan 2016 15:54:06 GMT
Author: kwall
Date: Fri Jan 22 15:54:05 2016
New Revision: 1726244

URL: http://svn.apache.org/viewvc?rev=1726244&view=rev
Log:
QPID-7017: [Java Broker] Include UUID in QUE-1001/2 messages

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueueImpl.java
    qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java
    qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java?rev=1726244&r1=1726243&r2=1726244&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java
Fri Jan 22 15:54:05 2016
@@ -183,12 +183,12 @@ public class QueueMessages
 
     /**
      * Log a Queue message of the Format:
-     * <pre>QUE-1001 : Create :[ Owner: {0}][ AutoDelete][ Durable][ Transient][ Priority:
{1,number,#}]</pre>
+     * <pre>QUE-1001 : Create : ID: {0}[ Owner: {1}][ AutoDelete][ Durable][ Transient][
Priority: {2,number,#}]</pre>
      * Optional values are contained in [square brackets] and are numbered
      * sequentially in the method call.
      *
      */
-    public static LogMessage CREATED(String param1, Number param2, boolean opt1, boolean
opt2, boolean opt3, boolean opt4, boolean opt5)
+    public static LogMessage CREATED(String param1, String param2, Number param3, boolean
opt1, boolean opt2, boolean opt3, boolean opt4, boolean opt5)
     {
         String rawMessage = _messages.getString("CREATED");
         StringBuffer msg = new StringBuffer();
@@ -202,7 +202,7 @@ public class QueueMessages
         if (parts.length > 1)
         {
 
-            // Add Option : Owner: {0}.
+            // Add Option : Owner: {1}.
             end = parts[1].indexOf(']');
             if (opt1)
             {
@@ -242,7 +242,7 @@ public class QueueMessages
             // Use 'end + 1' to remove the ']' from the output
             msg.append(parts[4].substring(end + 1));
 
-            // Add Option : Priority: {1,number,#}.
+            // Add Option : Priority: {2,number,#}.
             end = parts[5].indexOf(']');
             if (opt5)
             {
@@ -255,7 +255,7 @@ public class QueueMessages
 
         rawMessage = msg.toString();
 
-        final Object[] messageArguments = {param1, param2};
+        final Object[] messageArguments = {param1, param2, param3};
         // Create a new MessageFormat to ensure thread safety.
         // Sharing a MessageFormat and using applyPattern is not thread safe
         MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale);
@@ -304,16 +304,21 @@ public class QueueMessages
 
     /**
      * Log a Queue message of the Format:
-     * <pre>QUE-1002 : Deleted</pre>
+     * <pre>QUE-1002 : Deleted : ID: {0}</pre>
      * Optional values are contained in [square brackets] and are numbered
      * sequentially in the method call.
      *
      */
-    public static LogMessage DELETED()
+    public static LogMessage DELETED(String param1)
     {
         String rawMessage = _messages.getString("DELETED");
 
-        final String message = rawMessage;
+        final Object[] messageArguments = {param1};
+        // Create a new MessageFormat to ensure thread safety.
+        // Sharing a MessageFormat and using applyPattern is not thread safe
+        MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale);
+
+        final String message = formatter.format(messageArguments);
 
         return new LogMessage()
         {

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties?rev=1726244&r1=1726243&r2=1726244&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Queue_logmessages.properties
Fri Jan 22 15:54:05 2016
@@ -18,10 +18,11 @@
 #
 # Default File used for all non-defined locales.
 #
-# 0 - owner
-# 1 - priority
-CREATED = QUE-1001 : Create :[ Owner: {0}][ AutoDelete][ Durable][ Transient][ Priority:
{1,number,#}]
-DELETED = QUE-1002 : Deleted
+# 1 - uuid
+# 2 - owner
+# 3 - priority
+CREATED = QUE-1001 : Create : ID: {0}[ Owner: {1}][ AutoDelete][ Durable][ Transient][ Priority:
{2,number,#}]
+DELETED = QUE-1002 : Deleted : ID: {0}
 OVERFULL = QUE-1003 : Overfull : Size : {0,number} bytes, Capacity : {1,number}
 UNDERFULL = QUE-1004 : Underfull : Size : {0,number} bytes, Resume Capacity : {1,number}
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1726244&r1=1726243&r2=1726244&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
Fri Jan 22 15:54:05 2016
@@ -502,7 +502,8 @@ public abstract class AbstractQueue<X ex
     protected LogMessage getCreatedLogMessage()
     {
         String ownerString = getOwner();
-        return QueueMessages.CREATED(ownerString,
+        return QueueMessages.CREATED(getId().toString(),
+                                     ownerString,
                                      0,
                                      ownerString != null,
                                      getLifetimePolicy() != LifetimePolicy.PERMANENT,
@@ -1963,7 +1964,7 @@ public abstract class AbstractQueue<X ex
                         deleted();
 
                         //Log Queue Deletion
-                        getEventLogger().message(_logSubject, QueueMessages.DELETED());
+                        getEventLogger().message(_logSubject, QueueMessages.DELETED(getId().toString()));
 
                         _deleteFuture.set(queueDepthMessages);
                         setState(State.DELETED);

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueueImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueueImpl.java?rev=1726244&r1=1726243&r2=1726244&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueueImpl.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/PriorityQueueImpl.java
Fri Jan 22 15:54:05 2016
@@ -65,7 +65,8 @@ public class PriorityQueueImpl extends O
     protected LogMessage getCreatedLogMessage()
     {
         String ownerString = getOwner();
-        return QueueMessages.CREATED(ownerString,
+        return QueueMessages.CREATED(getId().toString(),
+                                     ownerString,
                                      getPriorities(),
                                      ownerString != null,
                                      getLifetimePolicy() != LifetimePolicy.PERMANENT,

Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java?rev=1726244&r1=1726243&r2=1726244&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java
(original)
+++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/logging/messages/QueueMessagesTest.java
Fri Jan 22 15:54:05 2016
@@ -32,10 +32,10 @@ public class QueueMessagesTest extends A
         String owner = "guest";
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(owner, priority, true, true, true, true, true);
+        _logMessage = QueueMessages.CREATED("uuid",owner, priority, true, true, true, true,
true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete",
                              "Durable", "Transient", "Priority:",
                              String.valueOf(priority)};
 
@@ -46,10 +46,10 @@ public class QueueMessagesTest extends A
     {
         String owner = "guest";
 
-        _logMessage = QueueMessages.CREATED(owner, null, true, true, false, false, false);
+        _logMessage = QueueMessages.CREATED("uuid", owner, null, true, true, false, false,
false);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete"};
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete"};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
@@ -59,10 +59,10 @@ public class QueueMessagesTest extends A
         String owner = "guest";
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(owner, priority, true, false, false, false, true);
+        _logMessage = QueueMessages.CREATED("uuid", owner, priority, true, false, false,
false, true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "Priority:",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "Priority:",
                              String.valueOf(priority)};
 
         validateLogMessage(log, "QUE-1001", expected);
@@ -73,10 +73,10 @@ public class QueueMessagesTest extends A
         String owner = "guest";
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(owner, priority, true, true, false, false, true);
+        _logMessage = QueueMessages.CREATED("uuid", owner, priority, true, true, false, false,
true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete",
                              "Priority:",
                              String.valueOf(priority)};
 
@@ -87,10 +87,10 @@ public class QueueMessagesTest extends A
     {
         String owner = "guest";
 
-        _logMessage = QueueMessages.CREATED(owner, null, true, true, false, true, false);
+        _logMessage = QueueMessages.CREATED("uuid", owner, null, true, true, false, true,
false);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete",
                              "Transient"};
 
         validateLogMessage(log, "QUE-1001", expected);
@@ -101,10 +101,10 @@ public class QueueMessagesTest extends A
         String owner = "guest";
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(owner, priority, true, true, false, true, true);
+        _logMessage = QueueMessages.CREATED("uuid", owner, priority, true, true, false, true,
true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete",
                              "Transient", "Priority:",
                              String.valueOf(priority)};
 
@@ -115,10 +115,10 @@ public class QueueMessagesTest extends A
     {
         String owner = "guest";
 
-        _logMessage = QueueMessages.CREATED(owner, null, true, true, true, false, false);
+        _logMessage = QueueMessages.CREATED("uuid", owner, null, true, true, true, false,
false);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete",
                              "Durable"};
 
         validateLogMessage(log, "QUE-1001", expected);
@@ -129,10 +129,10 @@ public class QueueMessagesTest extends A
         String owner = "guest";
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(owner, priority, true, true, true, false, true);
+        _logMessage = QueueMessages.CREATED("uuid", owner, priority, true, true, true, false,
true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Owner:", owner, "AutoDelete",
+        String[] expected = {"Create :", "ID:", "uuid", "Owner:", owner, "AutoDelete",
                              "Durable", "Priority:",
                              String.valueOf(priority)};
 
@@ -141,10 +141,10 @@ public class QueueMessagesTest extends A
 
     public void testQueueCreatedAutoDelete()
     {
-        _logMessage = QueueMessages.CREATED(null, null, false, true, false, false, false);
+        _logMessage = QueueMessages.CREATED("uuid", null, null, false, true, false, false,
false);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "AutoDelete"};
+        String[] expected = {"Create :", "ID:", "uuid", "AutoDelete"};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
@@ -153,11 +153,11 @@ public class QueueMessagesTest extends A
     {
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(null, priority, false, false, false, false, true);
+        _logMessage = QueueMessages.CREATED("uuid", null, priority, false, false, false,
false, true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "Priority:",
-                             String.valueOf(priority)};
+        String[] expected = {"Create :", "ID:", "uuid",
+                             "Priority:", String.valueOf(priority)};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
@@ -166,7 +166,7 @@ public class QueueMessagesTest extends A
     {
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(null, priority, false, true, false, false, true);
+        _logMessage = QueueMessages.CREATED("uuid", null, priority, false, true, false, false,
true);
         List<Object> log = performLog();
 
         String[] expected = {"Create :", "AutoDelete",
@@ -178,11 +178,11 @@ public class QueueMessagesTest extends A
 
     public void testQueueCreatedAutoDeleteTransient()
     {
-        _logMessage = QueueMessages.CREATED(null, null, false, true, false, true, false);
+        _logMessage = QueueMessages.CREATED("uuid", null, null, false, true, false, true,
false);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "AutoDelete",
-                             "Transient"};
+        String[] expected = {"Create :", "ID:", "uuid",
+                             "AutoDelete", "Transient"};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
@@ -191,23 +191,23 @@ public class QueueMessagesTest extends A
     {
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(null, priority, false, true, false, true, true);
+        _logMessage = QueueMessages.CREATED("uuid", null, priority, false, true, false, true,
true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "AutoDelete",
-                             "Transient", "Priority:",
-                             String.valueOf(priority)};
+        String[] expected = {"Create :", "ID:", "uuid",
+                             "AutoDelete", "Transient", "Priority:",
+                String.valueOf(priority)};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
 
     public void testQueueCreatedAutoDeleteDurable()
     {
-        _logMessage = QueueMessages.CREATED(null, null, false, true, true, false, false);
+        _logMessage = QueueMessages.CREATED("uuid", null, null, false, true, true, false,
false);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "AutoDelete",
-                             "Durable"};
+        String[] expected = {"Create :", "ID:", "uuid",
+                             "AutoDelete", "Durable"};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
@@ -216,22 +216,22 @@ public class QueueMessagesTest extends A
     {
         Integer priority = 3;
 
-        _logMessage = QueueMessages.CREATED(null, priority, false, true, true, false, true);
+        _logMessage = QueueMessages.CREATED("uuid", null, priority, false, true, true, false,
true);
         List<Object> log = performLog();
 
-        String[] expected = {"Create :", "AutoDelete",
-                             "Durable", "Priority:",
-                             String.valueOf(priority)};
+        String[] expected = {"Create :", "ID:", "uuid",
+                             "AutoDelete", "Durable", "Priority:",
+                String.valueOf(priority)};
 
         validateLogMessage(log, "QUE-1001", expected);
     }
 
     public void testQueueDeleted()
     {
-        _logMessage = QueueMessages.DELETED();
+        _logMessage = QueueMessages.DELETED("uuid");
         List<Object> log = performLog();
 
-        String[] expected = {"Deleted"};
+        String[] expected = {"Deleted", "ID:", "uuid"};
 
         validateLogMessage(log, "QUE-1002", expected);
     }

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java?rev=1726244&r1=1726243&r2=1726244&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java
Fri Jan 22 15:54:05 2016
@@ -112,7 +112,9 @@ public class QueueLoggingTest extends Ab
         // Message Should be a QUE-1002
         validateMessageID("QUE-1002", log);
 
-        assertEquals("Log Message is incorrect ", "Deleted", getMessageString(fromMessage(log)));
+        final String actual = getMessageString(fromMessage(log));
+        assertTrue("Log message does not contain expected message. actual : " + actual,
+                   actual.contains("Deleted"));
 
         assertEquals("Queue Delete not for created queue:", createdQueueName,
                      AbstractTestLogSubject.getSlice("qu", fromSubject(log)));
@@ -172,7 +174,9 @@ public class QueueLoggingTest extends Ab
            // Message Should be a QUE-1002
            validateMessageID("QUE-1002", log);
 
-           assertEquals("Log Message is incorrect ", "Deleted", getMessageString(fromMessage(log)));
+           final String actual = getMessageString(fromMessage(log));
+           assertTrue("Log message does not contain expected message. actual : " + actual,
+                        actual.contains("Deleted"));
 
            assertEquals("Queue Delete not for created queue:", createdQueueName,
                         AbstractTestLogSubject.getSlice("qu", fromSubject(log)));



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


Mime
View raw message