summaryrefslogtreecommitdiff
path: root/java/common
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2012-02-13 00:44:01 +0000
committerRobert Gemmell <robbie@apache.org>2012-02-13 00:44:01 +0000
commit4411d07c9a1d4ac6722b10428e206da0b655b3ee (patch)
treec1e8ecfe2f62fc2694e95b9ac03aef7448bb604c /java/common
parent4e6049476177fca6e5d81289b7091143324bcd2f (diff)
downloadqpid-python-4411d07c9a1d4ac6722b10428e206da0b655b3ee.tar.gz
QPID-3440: add test to verify issue by ensuring that the reply-to Destination cache results in use of the same Destination objects for subsequent messages. Implement equals() and hashCode() for the generated ReplyTo class to let it function properly as an index in the hashmap to resolve the issue. Update PropertyValueTest to remember the initial reply-to destination it sets and compare it with the value returned after sending/receiving the message, rather than constituting its own test destination for comparison.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1243380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common')
-rw-r--r--java/common/Composite.tpl18
1 files changed, 18 insertions, 0 deletions
diff --git a/java/common/Composite.tpl b/java/common/Composite.tpl
index 18b5374965..2b2f8fda09 100644
--- a/java/common/Composite.tpl
+++ b/java/common/Composite.tpl
@@ -362,4 +362,22 @@ for f in fields:
return result;
}
+${
+if name == "ReplyTo":
+ out(" public boolean equals(final Object obj){\n")
+ out(" if (this == obj){\n")
+ out(" return true;\n")
+ out(" }\n\n")
+ out(" if(!(obj instanceof ReplyTo)){\n")
+ out(" return false;\n")
+ out(" }\n\n")
+ out(" final ReplyTo reply = (ReplyTo) obj;\n")
+ out(" return (routingKey == null ? reply.getRoutingKey() == null : routingKey.equals(reply.getRoutingKey()))\n")
+ out(" && (exchange == null ? reply.getExchange() == null : exchange.equals(reply.getExchange()));\n")
+ out(" }\n\n")
+ out(" public int hashCode(){\n")
+ out(" int result = routingKey == null ? 1 : routingKey.hashCode();\n")
+ out(" return 31 * result + (exchange == null ? 5 : exchange.hashCode());\n")
+ out(" }")
+}
}