Polish add SessionDeletedEvent & SessionExpiredEvent

* Add @author Mark Anderson for proper credit
* SessionDestroyedEvent no longer abstract to preserve passivity

Issue gh-258
This commit is contained in:
Rob Winch
2015-08-12 16:32:51 -05:00
parent 7518306975
commit 3ba07ec0a8
6 changed files with 9 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ import org.springframework.util.Assert;
* translate into a {@link SessionExpiredEvent}.
*
* @author Rob Winch
* @author Mark Anderson
* @since 1.0
*/
public class SessionMessageListener implements MessageListener {

View File

@@ -22,7 +22,7 @@ import org.springframework.session.SessionRepository;
* For {@link SessionRepository} implementations that support it, this event is
* fired when a {@link Session} is destroyed via deletion.
*
* @author Rob Winch
* @author Mark Anderson
* @since 1.1
*
*/
@@ -32,5 +32,5 @@ public class SessionDeletedEvent extends SessionDestroyedEvent {
public SessionDeletedEvent(Object source, String sessionId) {
super(source, sessionId);
}
}

View File

@@ -26,7 +26,7 @@ import org.springframework.session.Session;
*
*/
@SuppressWarnings("serial")
public abstract class SessionDestroyedEvent extends ApplicationEvent {
public class SessionDestroyedEvent extends ApplicationEvent {
private final String sessionId;
public SessionDestroyedEvent(Object source, String sessionId) {

View File

@@ -22,7 +22,7 @@ import org.springframework.session.SessionRepository;
* For {@link SessionRepository} implementations that support it, this event is
* fired when a {@link Session} is destroyed via expiration.
*
* @author Rob Winch
* @author Mark Anderson
* @since 1.1
*
*/

View File

@@ -41,6 +41,7 @@ import org.springframework.web.socket.messaging.SessionDisconnectEvent;
*
*
* @author Rob Winch
* @author Mark Anderson
* @since 1.0
*/
public final class WebSocketRegistryListener implements ApplicationListener<ApplicationEvent> {

View File

@@ -37,6 +37,7 @@ import org.springframework.session.events.SessionExpiredEvent;
/**
*
* @author Rob Winch
* @author Mark Anderson
*
*/
@RunWith(MockitoJUnitRunner.class)
@@ -49,7 +50,7 @@ public class SessionMessageListenerTests {
@Captor
ArgumentCaptor<SessionDestroyedEvent> deletedEvent;
@Captor
ArgumentCaptor<SessionExpiredEvent> expiredEvent;
@@ -93,7 +94,7 @@ public class SessionMessageListenerTests {
verify(eventPublisher).publishEvent(deletedEvent.capture());
assertThat(deletedEvent.getValue().getSource()).isEqualTo(listener);
}
@Test
public void onMessageExpiredSource() throws Exception {
mockMessage("__keyevent@0__:expired","spring:session:sessions:123");