activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r372952 - in /incubator/activemq/trunk/activemq-core/src: main/java/org/apache/activemq/util/IntrospectionSupport.java test/java/org/apache/activemq/command/ActiveMQMessageTest.java
Date Fri, 27 Jan 2006 19:33:30 GMT
Author: jstrachan
Date: Fri Jan 27 11:33:21 2006
New Revision: 372952

URL: http://svn.apache.org/viewcvs?rev=372952&view=rev
Log:
added better debug tracing so that destinations are explicit in whether they are a queue or
topic

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java?rev=372952&r1=372951&r2=372952&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
Fri Jan 27 11:33:21 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.util;
 
+import org.apache.activemq.command.ActiveMQDestination;
+
 import java.beans.PropertyEditor;
 import java.beans.PropertyEditorManager;
 import java.lang.reflect.Field;
@@ -28,6 +30,7 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Set;
 import java.util.Map.Entry;
 
 public class IntrospectionSupport {
@@ -149,7 +152,34 @@
     static public String toString(Object target, Class stopClass) {
         LinkedHashMap map = new LinkedHashMap();
         addFields(target, target.getClass(), stopClass, map);
-        return simpleName(target.getClass())+" "+map;
+        StringBuffer buffer = new StringBuffer(simpleName(target.getClass()));
+        buffer.append(" {");
+        Set entrySet = map.entrySet();
+        boolean first = true;
+        for (Iterator iter = entrySet.iterator(); iter.hasNext();) {
+            Map.Entry entry = (Map.Entry) iter.next();
+            if (first) {
+                first = false;
+            }
+            else {
+                buffer.append(", ");
+            }
+            buffer.append(entry.getKey());
+            buffer.append(" = ");
+            appendToString(buffer, entry.getValue());
+        }
+        buffer.append("}");
+        return buffer.toString();
+    }
+
+    protected static void appendToString(StringBuffer buffer, Object value) {
+        if (value instanceof ActiveMQDestination) {
+            ActiveMQDestination destination = (ActiveMQDestination) value;
+            buffer.append(destination.getQualifiedName());
+        }
+        else {
+            buffer.append(value);
+        }
     }
 
     static public String simpleName(Class clazz) {

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java?rev=372952&r1=372951&r2=372952&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/command/ActiveMQMessageTest.java
Fri Jan 27 11:33:21 2006
@@ -190,6 +190,8 @@
         assertTrue(msg1.getJMSExpiration() == msg2.getJMSExpiration());
         assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority());
         assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp());
+        
+        System.out.println("Message is:  " + msg1);
     }
 
     public void testGetAndSetJMSMessageID() throws Exception {



Mime
View raw message