@Test public void springSessionDestroyedTranslatedToSpringSecurityDestroyed() { Session session = new MapSession(); this.publisher.publishEvent( new org.springframework.session.events.SessionDestroyedEvent(this, session)); assertThat(this.listener.getEvent().getId()).isEqualTo(session.getId()); }
@Before public void setup() { this.listener = new SessionEventHttpSessionListenerAdapter( Arrays.asList(this.listener1, this.listener2)); this.listener.setServletContext(new MockServletContext()); Session session = new MapSession(); this.destroyed = new SessionDestroyedEvent(this, session); this.created = new SessionCreatedEvent(this, session); }
protected void emitSessionDestroyedEvent(String sessionId) { logger.debugf("Emitting session destroyed %s", sessionId); springEventsPublisher.ifPresent(p -> p.publishEvent(new SessionDestroyedEvent(eventSource, sessionId))); }
/** * Constructs a new {@link SessionDestroyedEvent} initialized with the given {@link Session}, * using the {@link #getSessionRepository() SessionRepository} as the event source. * * @param session {@link Session} that is the subject of the {@link AbstractSessionEvent event}. * @return a new {@link SessionDestroyedEvent}. * @see org.springframework.session.events.SessionDestroyedEvent * @see org.springframework.session.Session * @see #getSessionRepository() */ protected SessionDestroyedEvent newSessionDestroyedEvent(Session session) { return new SessionDestroyedEvent(getSessionRepository(), session); }