use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class SpringServletTest method pushURL_rootMappingAndCustomURLWithoutPrecedingSlash_isPrefixedWithContextVaadinMapping.
@Test
public void pushURL_rootMappingAndCustomURLWithoutPrecedingSlash_isPrefixedWithContextVaadinMapping() throws ServletException {
final Properties configProperties = new Properties();
configProperties.setProperty("pushURL", "customUrl");
VaadinService service = SpringInstantiatorTest.getService(context, configProperties, true);
Assert.assertEquals("context://vaadinServlet/customUrl", service.getDeploymentConfiguration().getPushURL());
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class SpringVaadinServletServiceTest method getInstantiator_springManagedBean_instantiatorBeanReturned.
@Test
public void getInstantiator_springManagedBean_instantiatorBeanReturned() throws ServletException {
Properties properties = new Properties(BASE_PROPERTIES);
properties.setProperty(FOO, Boolean.TRUE.toString());
VaadinService service = SpringInstantiatorTest.getService(context, properties);
Instantiator instantiator = service.getInstantiator();
Assert.assertEquals(TestInstantiator.class, instantiator.getClass());
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class SpringVaadinServletServiceTest method uiInitListenerAsSpringBean_listenerIsAutoregisteredAsUIInitiLietnerInSpringService.
@Test
public void uiInitListenerAsSpringBean_listenerIsAutoregisteredAsUIInitiLietnerInSpringService() throws ServletException, ServiceException {
VaadinService service = SpringInstantiatorTest.getService(context, new Properties());
UI ui = new UI();
TestUIInitListener listener = context.getBean(TestUIInitListener.class);
service.fireUIInitListeners(ui);
Assert.assertEquals(1, listener.events.size());
Assert.assertSame(ui, listener.events.get(0).getUI());
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class DefaultInstantiatorTest method getOrCreate_lookupHasNoObject_createNewObject.
@Test
public void getOrCreate_lookupHasNoObject_createNewObject() {
VaadinService service = Mockito.mock(VaadinService.class);
mockLookup(service);
DefaultInstantiator instantiator = new DefaultInstantiator(service);
TestComponent component = instantiator.getOrCreate(TestComponent.class);
Assert.assertNotNull(component);
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class DefaultInstantiatorTest method getOrCreate_lookupHasObject_returnObjectFromLookup.
@Test
public void getOrCreate_lookupHasObject_returnObjectFromLookup() {
VaadinService service = Mockito.mock(VaadinService.class);
Lookup lookup = mockLookup(service);
DefaultInstantiator instantiator = new DefaultInstantiator(service);
Mockito.when(lookup.lookup(List.class)).thenReturn(new ArrayList<>());
List<?> list = instantiator.getOrCreate(List.class);
Assert.assertTrue(list instanceof ArrayList);
}
Aggregations