Search in sources :

Example 1 with Instantiator

use of com.vaadin.flow.di.Instantiator in project flow by vaadin.

the class I18NProviderInstantiationTest method getI18NProvider_i18nProviderIsABean_i18nProviderIsAvailable.

@Test
public void getI18NProvider_i18nProviderIsABean_i18nProviderIsAvailable() throws ServletException {
    Instantiator instantiator = getInstantiator(context);
    Assert.assertNotNull(instantiator.getI18NProvider());
    Assert.assertEquals(DefaultI18NTestProvider.class, instantiator.getI18NProvider().getClass());
}
Also used : Instantiator(com.vaadin.flow.di.Instantiator) Test(org.junit.Test) SpringInstantiatorTest(com.vaadin.flow.spring.instantiator.SpringInstantiatorTest)

Example 2 with Instantiator

use of com.vaadin.flow.di.Instantiator in project flow by vaadin.

the class SpringInstantiatorTest method getI18NProvider_i18nProviderIsABean_i18nProviderIsAvailable.

@Test
public void getI18NProvider_i18nProviderIsABean_i18nProviderIsAvailable() throws ServletException {
    Instantiator instantiator = getInstantiator(context);
    Assert.assertNotNull(instantiator.getI18NProvider());
    Assert.assertEquals(I18NTestProvider.class, instantiator.getI18NProvider().getClass());
}
Also used : Instantiator(com.vaadin.flow.di.Instantiator) Test(org.junit.Test)

Example 3 with Instantiator

use of com.vaadin.flow.di.Instantiator in project flow by vaadin.

the class SpringInstantiatorTest method getServiceInitListeners_springManagedBeanAndJavaSPI_bothClassesAreInStream.

@Test
public void getServiceInitListeners_springManagedBeanAndJavaSPI_bothClassesAreInStream() throws ServletException {
    Instantiator instantiator = getInstantiator(context);
    Set<?> set = instantiator.getServiceInitListeners().map(Object::getClass).collect(Collectors.toSet());
    Assert.assertTrue(set.contains(TestVaadinServiceInitListener.class));
    Assert.assertTrue(set.contains(JavaSPIVaadinServiceInitListener.class));
}
Also used : Instantiator(com.vaadin.flow.di.Instantiator) Test(org.junit.Test)

Example 4 with Instantiator

use of com.vaadin.flow.di.Instantiator in project flow by vaadin.

the class SpringInstantiatorTest method createRouteTarget_pojo_instanceIsCreated.

@Test
public void createRouteTarget_pojo_instanceIsCreated() throws ServletException {
    Instantiator instantiator = getInstantiator(context);
    RouteTarget1 target1 = instantiator.createRouteTarget(RouteTarget1.class, null);
    Assert.assertNotNull(target1);
}
Also used : Instantiator(com.vaadin.flow.di.Instantiator) Test(org.junit.Test)

Example 5 with Instantiator

use of com.vaadin.flow.di.Instantiator in project flow by vaadin.

the class SpringVaadinServletServiceTest method getInstantiator_javaSPIClass_instantiatorPojoReturned.

@Test
public void getInstantiator_javaSPIClass_instantiatorPojoReturned() throws ServletException {
    Properties properties = new Properties();
    properties.setProperty(FOO, Boolean.FALSE.toString());
    VaadinService service = SpringInstantiatorTest.getService(context, properties);
    Instantiator instantiator = service.getInstantiator();
    Assert.assertEquals(JavaSPIInstantiator.class, instantiator.getClass());
}
Also used : VaadinService(com.vaadin.flow.server.VaadinService) Instantiator(com.vaadin.flow.di.Instantiator) Properties(java.util.Properties) Test(org.junit.Test) SpringInstantiatorTest(com.vaadin.flow.spring.instantiator.SpringInstantiatorTest)

Aggregations

Instantiator (com.vaadin.flow.di.Instantiator)9 Test (org.junit.Test)7 SpringInstantiatorTest (com.vaadin.flow.spring.instantiator.SpringInstantiatorTest)3 VaadinService (com.vaadin.flow.server.VaadinService)2 Properties (java.util.Properties)2 MapToExistingElement (com.vaadin.flow.component.Component.MapToExistingElement)1 DeploymentConfiguration (com.vaadin.flow.function.DeploymentConfiguration)1 ServiceException (com.vaadin.flow.server.ServiceException)1 SessionDestroyListener (com.vaadin.flow.server.SessionDestroyListener)1 VaadinRequest (com.vaadin.flow.server.VaadinRequest)1 VaadinServlet (com.vaadin.flow.server.VaadinServlet)1 VaadinServletService (com.vaadin.flow.server.VaadinServletService)1 VaadinSession (com.vaadin.flow.server.VaadinSession)1 Registration (com.vaadin.flow.shared.Registration)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 ApplicationContext (org.springframework.context.ApplicationContext)1