Class MockSpringVaadinSession

java.lang.Object
com.vaadin.flow.server.VaadinSession
com.vaadin.browserless.mocks.MockSpringVaadinSession
All Implemented Interfaces:
jakarta.servlet.http.HttpSessionBindingListener, Serializable, EventListener

public class MockSpringVaadinSession extends com.vaadin.flow.server.VaadinSession
A Vaadin Session with one important difference:
  • Creates a new session when this one is closed. This is used to simulate a logout which closes the session - we need to have a new fresh session to be able to continue testing. In order to do that, simply override close(), call `super.close()` then call MockVaadin.afterSessionClose(com.vaadin.flow.server.VaadinSession, com.vaadin.browserless.internal.UIFactory).

For internal use only. May be renamed or removed in a future release.

Since:
1.0
Author:
mavi
See Also:
  • Field Summary

    Fields inherited from class com.vaadin.flow.server.VaadinSession

    browser
  • Constructor Summary

    Constructors
    Constructor
    Description
    MockSpringVaadinSession(@NonNull com.vaadin.flow.server.VaadinService service, @NonNull com.vaadin.browserless.internal.UIFactory uiFactory)
    Creates the session.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     

    Methods inherited from class com.vaadin.flow.server.VaadinSession

    access, accessSynchronously, addRequestHandler, addSessionDestroyListener, addUI, applyLockStrategy, checkHasLock, checkHasLock, createStreamResourceRegistry, findElement, getAllSessions, getAttribute, getAttribute, getBrowser, getConfiguration, getCumulativeRequestDuration, getCurrent, getCurrentOrThrow, getErrorHandler, getLastLocked, getLastRequestDuration, getLastRequestTimestamp, getLastUnlocked, getLocale, getLockInstance, getNextUIid, getPendingAccessQueue, getPushId, getRequestHandlers, getResourceRegistry, getService, getSession, getState, getUIById, getUIs, hasLock, hasLock, localeSignal, lock, refreshTransients, removeRequestHandler, removeUI, setAttribute, setAttribute, setBrowser, setCurrent, setErrorHandler, setLastRequestDuration, setLastRequestTimestamp, setLocale, setState, unlock, valueBound, valueUnbound

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MockSpringVaadinSession

      public MockSpringVaadinSession(@NonNull com.vaadin.flow.server.VaadinService service, @NonNull com.vaadin.browserless.internal.UIFactory uiFactory)
      Creates the session.
      Parameters:
      service - the service the session belongs to
      uiFactory - creates the UI of the session that replaces this one once it is closed
  • Method Details

    • close

      public void close()
      Overrides:
      close in class com.vaadin.flow.server.VaadinSession