Class MockService

  • All Implemented Interfaces:
    java.io.Serializable

    
    public class MockService
    extends VaadinServletService
                        

    A mocking service that performs three very important tasks:

    • Overrides isAtmosphereAvailable to tell Vaadin that we don't have Atmosphere (otherwise Vaadin will crash)

    • Provides some dummy value as a root ID via getMainDivId (otherwise the mocked servlet env will crash).

    • Provides a MockVaadinSession. The class is intentionally opened, to be extensible in user's library.

    To register your custom MockService instance, override MockVaadinServlet.createServletService.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      MockService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, Function0<UI> uiFactory)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Function0<UI> getUiFactory()
      String getMainDivId(VaadinSession session, VaadinRequest request)
      Instantiator getInstantiator()
      • Methods inherited from class com.vaadin.flow.server.VaadinServletService

        getContextRootRelativePath, getMimeType, getResource, getResourceAsStream, getResourceInServletContext, getServiceName, getServlet, getStaticResource, resolveResource
      • Methods inherited from class com.vaadin.flow.server.VaadinService

        accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, addUIInitListener, closeSession, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, fireUIInitListeners, getBootstrapInitialPredicate, getBootstrapUrlPredicate, getClassLoader, getContext, getDependencyFilters, getDeploymentConfiguration, getRequestHandlers, getRouter, getSystemMessages, getSystemMessagesProvider, getVaadinRequestInterceptors, handleRequest, init, isResourceAvailable, isUIActive, modifyIndexHtmlResponse, removeSession, requestEnd, requestStart, runPendingAccessTasks, setBootstrapInitialPredicate, setBootstrapUrlPredicate, setClassLoader, setCurrentInstances, setSystemMessagesProvider, writeStringResponse, writeUncachedStringResponse
      • Methods inherited from class java.lang.Object

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

      • MockService

        MockService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, Function0<UI> uiFactory)