Package com.vaadin.testbench.unit.mocks
Class MockService
-
- All Implemented Interfaces:
-
java.io.Serializable
public class MockService extends VaadinServletServiceA 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
MockServiceinstance, override MockVaadinServlet.createServletService.
-
-
Field Summary
Fields Modifier and Type Field Description private final Function0<UI>uiFactoryprivate final VaadinServletservletprivate final DeploymentConfigurationdeploymentConfigurationprivate SystemMessagesProvidersystemMessagesProviderprivate ClassLoaderclassLoaderprivate final Iterable<RequestHandler>requestHandlersprivate final Iterable<DependencyFilter>dependencyFiltersprivate BootstrapInitialPredicatebootstrapInitialPredicateprivate BootstrapUrlPredicatebootstrapUrlPredicateprivate final Routerrouterprivate final Iterable<VaadinRequestInterceptor>vaadinRequestInterceptors
-
Constructor Summary
Constructors Constructor Description MockService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, Function0<UI> uiFactory)
-
Method Summary
Modifier and Type Method Description final Function0<UI>getUiFactory()StringgetMainDivId(VaadinSession session, VaadinRequest request)InstantiatorgetInstantiator()-
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
-
-
Method Detail
-
getUiFactory
final Function0<UI> getUiFactory()
-
getMainDivId
String getMainDivId(VaadinSession session, VaadinRequest request)
-
getInstantiator
Instantiator getInstantiator()
-
-
-
-