Fix test failures

This commit is contained in:
Rossen Stoyanchev
2013-07-05 12:21:45 -04:00
parent 0c92b85c3d
commit 96cb7c0616
5 changed files with 70 additions and 24 deletions

View File

@@ -140,7 +140,7 @@ public class CachingSessionSubscriptionRegistry implements SessionSubscriptionRe
@Override
public void addSubscription(String destination, String subscriptionId) {
CachingSessionSubscriptionRegistry.this.destinationCache.mapRegistration(destination, this.delegate);
destinationCache.mapRegistration(destination, this);
this.delegate.addSubscription(destination, subscriptionId);
}
@@ -148,7 +148,7 @@ public class CachingSessionSubscriptionRegistry implements SessionSubscriptionRe
public String removeSubscription(String subscriptionId) {
String destination = this.delegate.removeSubscription(subscriptionId);
if (destination != null && this.delegate.getSubscriptionsByDestination(destination) == null) {
CachingSessionSubscriptionRegistry.this.destinationCache.unmapRegistration(destination, this);
destinationCache.unmapRegistration(destination, this);
}
return destination;
}
@@ -163,6 +163,23 @@ public class CachingSessionSubscriptionRegistry implements SessionSubscriptionRe
return this.delegate.getDestinations();
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof CachingSessionSubscriptionRegistration)) {
return false;
}
CachingSessionSubscriptionRegistration otherType = (CachingSessionSubscriptionRegistration) other;
return this.delegate.equals(otherType.delegate);
}
@Override
public int hashCode() {
return this.delegate.hashCode();
}
@Override
public String toString() {
return "CachingSessionSubscriptionRegistration [delegate=" + delegate + "]";

View File

@@ -89,6 +89,22 @@ public class DefaultSessionSubscriptionRegistration implements SessionSubscripti
return this.subscriptions.get(destination);
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof DefaultSessionSubscriptionRegistration)) {
return false;
}
DefaultSessionSubscriptionRegistration otherType = (DefaultSessionSubscriptionRegistration) other;
return this.sessionId.equals(otherType.sessionId);
}
@Override
public int hashCode() {
return 31 + this.sessionId.hashCode();
}
@Override
public String toString() {