use of com.vaadin.flow.function.DeploymentConfiguration in project flow by vaadin.
the class PolymerServerEventHandlersTest 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.function.DeploymentConfiguration in project flow by vaadin.
the class ApplicationRunnerServlet method createServletService.
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
VaadinServletService service = super.createServletService(deploymentConfiguration);
final SystemMessagesProvider provider = service.getSystemMessagesProvider();
service.setSystemMessagesProvider((SystemMessagesProvider) systemMessagesInfo -> {
if (systemMessagesInfo.getRequest() == null) {
return provider.getSystemMessages(systemMessagesInfo);
}
Object messages = systemMessagesInfo.getRequest().getAttribute(CUSTOM_SYSTEM_MESSAGES_PROPERTY);
if (messages instanceof SystemMessages) {
return (SystemMessages) messages;
}
return provider.getSystemMessages(systemMessagesInfo);
});
return service;
}
use of com.vaadin.flow.function.DeploymentConfiguration in project flow by vaadin.
the class AbstractDeploymentConfigurationTest method getClassLoader_returnsClassloaderPropertyValue.
@Test
public void getClassLoader_returnsClassloaderPropertyValue() {
String classLoader = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig("ClassLoader", classLoader);
Assert.assertEquals("Unexpected classLoader configuration option value", classLoader, config.getClassLoaderName());
}
use of com.vaadin.flow.function.DeploymentConfiguration in project flow by vaadin.
the class AbstractDeploymentConfigurationTest method getUIClass_returnsUIParameterPropertyValue.
@Test
public void getUIClass_returnsUIParameterPropertyValue() {
String ui = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig(VaadinSession.UI_PARAMETER, ui);
Assert.assertEquals("Unexpected UI class configuration option value", ui, config.getUIClassName());
}
use of com.vaadin.flow.function.DeploymentConfiguration in project flow by vaadin.
the class WebJarServerTest method init.
@Before
public void init() throws Exception {
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(configuration.getDevelopmentFrontendPrefix()).thenReturn(Constants.FRONTEND_URL_DEV_DEFAULT);
VaadinServletService servletService = Mockito.mock(VaadinServletService.class);
ServletContext servletContext = Mockito.mock(ServletContext.class);
servlet = new VaadinServlet() {
@Override
protected VaadinServletService createServletService() throws ServletException, ServiceException {
return servletService;
}
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
Mockito.when(servletService.getDeploymentConfiguration()).thenReturn(configuration);
Mockito.when(configuration.areWebJarsEnabled()).thenReturn(true);
servlet.init(Mockito.mock(ServletConfig.class));
Field webJarServerField = VaadinServlet.class.getDeclaredField("webJarServer");
webJarServerField.setAccessible(true);
webJarServer = (WebJarServer) webJarServerField.get(servlet);
// webJarServer = new WebJarServer(configuration);
// context = Mockito.mock(ServletContext.class);
Mockito.when(servletContext.getResource(GRID_WEBJAR)).thenReturn(new URL("http://localhost:8080" + GRID_DEPENDENCY));
}
Aggregations