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).
Author:
mavi
See Also:
  • Field Summary

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

    browser
  • Constructor Summary

    Constructors
    Constructor
    Description
    MockSpringVaadinSession(com.vaadin.flow.server.VaadinService service, com.vaadin.browserless.internal.UIFactory uiFactory)
     
    MockSpringVaadinSession(com.vaadin.flow.server.VaadinService service, kotlin.jvm.functions.Function0<com.vaadin.flow.component.UI> uiFactory)
    Deprecated, for removal: This API element is subject to removal in a future version.
  • 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, 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

      @Deprecated(forRemoval=true) public MockSpringVaadinSession(@NotNull com.vaadin.flow.server.VaadinService service, @NotNull kotlin.jvm.functions.Function0<com.vaadin.flow.component.UI> uiFactory)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • MockSpringVaadinSession

      public MockSpringVaadinSession(@NotNull com.vaadin.flow.server.VaadinService service, @NotNull com.vaadin.browserless.internal.UIFactory uiFactory)
  • Method Details

    • close

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