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:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user