Polishing

This commit is contained in:
Juergen Hoeller
2017-01-12 23:43:27 +01:00
parent 1521094c5b
commit 7f127300f9
3 changed files with 27 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,20 +19,23 @@ package org.springframework.messaging.simp.user;
import java.util.HashSet;
import java.util.Set;
/**
* @author Rossen Stoyanchev
*/
public class TestSimpSession implements SimpSession {
private String id;
private final String id;
private TestSimpUser user;
private Set<SimpSubscription> subscriptions = new HashSet<>();
private final Set<SimpSubscription> subscriptions = new HashSet<>();
public TestSimpSession(String id) {
this.id = id;
}
@Override
public String getId() {
return id;
@@ -59,6 +62,7 @@ public class TestSimpSession implements SimpSession {
}
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof SimpSession && this.id.equals(((SimpSession) other).getId())));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,25 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.simp.user;
package org.springframework.messaging.simp.user;
import org.springframework.util.ObjectUtils;
/**
* @author Rossen Stoyanchev
*/
public class TestSimpSubscription implements SimpSubscription {
private String id;
private final String destination;
private final String id;
private TestSimpSession session;
private String destination;
public TestSimpSubscription(String id, String destination) {
this.destination = destination;
this.id = id;
}
@Override
public String getId() {
return id;
@@ -51,6 +55,7 @@ public class TestSimpSubscription implements SimpSubscription {
return destination;
}
@Override
public boolean equals(Object other) {
if (this == other) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.simp.user;
import java.util.HashMap;
@@ -20,18 +21,21 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* @author Rossen Stoyanchev
*/
public class TestSimpUser implements SimpUser {
private String name;
private final String name;
private Map<String, SimpSession> sessions = new HashMap<>();
private final Map<String, SimpSession> sessions = new HashMap<>();
public TestSimpUser(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
@@ -59,6 +63,7 @@ public class TestSimpUser implements SimpUser {
}
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof SimpUser && this.name.equals(((SimpUser) other).getName())));