use of com.vaadin.flow.server.VaadinContext in project flow by vaadin.
the class BrowserLiveReloadAccessorImplTest method getLiveReload_liveReloadDisabled_instanceIsCreated.
@Test
public void getLiveReload_liveReloadDisabled_instanceIsCreated() {
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration config = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(config);
Mockito.when(config.isProductionMode()).thenReturn(false);
Mockito.when(config.isDevModeLiveReloadEnabled()).thenReturn(false);
VaadinContext context = Mockito.mock(VaadinContext.class);
Mockito.when(context.getAttribute(Mockito.eq(BrowserLiveReload.class), Mockito.any())).thenReturn(Mockito.mock(BrowserLiveReload.class));
Mockito.when(service.getContext()).thenReturn(context);
Assert.assertNotNull(access.getLiveReload(service));
}
use of com.vaadin.flow.server.VaadinContext in project flow by vaadin.
the class SpringApplicationConfigurationFactory method doCreate.
@Override
protected ApplicationConfigurationImpl doCreate(VaadinContext context, FallbackChunk chunk, Map<String, String> properties) {
ApplicationContext appContext = SpringLookupInitializer.getApplicationContext(context);
Environment env = appContext.getBean(Environment.class);
// Collect any vaadin.XZY properties from application.properties
SpringServlet.PROPERTY_NAMES.stream().filter(name -> env.getProperty("vaadin." + name) != null).forEach(name -> properties.put(name, env.getProperty("vaadin." + name)));
return super.doCreate(context, chunk, properties);
}
use of com.vaadin.flow.server.VaadinContext in project flow by vaadin.
the class DevModeBrowserLauncher method isProductionMode.
private static boolean isProductionMode(GenericWebApplicationContext app) {
ServletContext servletContext = app.getServletContext();
VaadinContext context = new VaadinServletContext(servletContext);
ApplicationConfiguration applicationConfiguration = ApplicationConfiguration.get(context);
return applicationConfiguration.isProductionMode();
}
use of com.vaadin.flow.server.VaadinContext in project flow by vaadin.
the class DebugWindowConnectionTest method getMockContext.
private VaadinContext getMockContext() {
VaadinContext context = new MockVaadinContext();
context.setAttribute(Lookup.class, Lookup.of(Mockito.mock(ApplicationConfiguration.class), ApplicationConfiguration.class));
return context;
}
use of com.vaadin.flow.server.VaadinContext in project flow by vaadin.
the class PushHandler method isProductionMode.
private boolean isProductionMode() {
VaadinContext context = service.getContext();
ApplicationConfiguration conf = ApplicationConfiguration.get(context);
return conf.isProductionMode();
}
Aggregations