From 946f459455ca90c8a0d737b6a31094767f43fd03 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Mon, 13 Feb 2012 00:44:01 +0000 Subject: 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 --- java/common/Composite.tpl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'java/common') 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(" }") +} } -- cgit v1.2.1