use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class TemplateModelTest method createService.
@Override
protected VaadinService createService() {
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(configuration.isProductionMode()).thenReturn(true);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
return service;
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class KnownUnsupportedTypesTest method createService.
@Override
protected VaadinService createService() {
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(configuration.isProductionMode()).thenReturn(true);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
return service;
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class TemplateModelProxyHandlerTest method createService.
@Override
protected VaadinService createService() {
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(configuration.isProductionMode()).thenReturn(true);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
return service;
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class HeartbeatHandlerTest method synchronizedHandleRequest_uiPresent_setLastHeartbeatTimestampIsCalledOnce.
@Test
public void synchronizedHandleRequest_uiPresent_setLastHeartbeatTimestampIsCalledOnce() throws IOException {
VaadinService service = mock(VaadinService.class);
VaadinSession session = mock(VaadinSession.class);
VaadinRequest request = mock(VaadinRequest.class);
VaadinResponse response = mock(VaadinResponse.class);
UI ui = mock(UI.class);
UIInternals uiInternals = mock(UIInternals.class);
when(ui.getInternals()).thenReturn(uiInternals);
when(session.getService()).thenReturn(service);
when(service.findUI(request)).thenReturn(ui);
HeartbeatHandler handler = new HeartbeatHandler();
handler.synchronizedHandleRequest(session, request, response);
Mockito.verify(ui.getInternals(), times(1)).setLastHeartbeatTimestamp(anyLong());
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class SerializationTest method testSerializeVaadinSession_notProductionMode_canSerializeWithoutTransients.
@Test
public void testSerializeVaadinSession_notProductionMode_canSerializeWithoutTransients() throws Exception {
VaadinService vaadinService = new MockVaadinService(false, true);
VaadinSession session = Mockito.spy(new VaadinSession(vaadinService));
Assert.assertEquals(vaadinService, session.getService());
VaadinSession serializedAndDeserializedSession = serializeAndDeserialize(session);
Assert.assertNull(serializedAndDeserializedSession.getService());
VaadinSession againSerializedAndDeserializedSession = serializeAndDeserialize(serializedAndDeserializedSession);
Assert.assertNull(againSerializedAndDeserializedSession.getService());
}
Aggregations