Search in sources :

Example 1 with TestVaadinServlet

use of com.vaadin.flow.server.MockServletServiceSessionSetup.TestVaadinServlet in project flow by vaadin.

the class BootstrapHandlerDependenciesTest method setup.

@Before
public void setup() throws Exception {
    mocks = new MockServletServiceSessionSetup();
    service = mocks.getService();
    service.setRouter(createRouter());
    TestVaadinServlet servlet = mocks.getServlet();
    for (String type : new String[] { "js", "css" }) {
        servlet.addServletContextResource("inline." + type, "inline." + type);
        servlet.addServletContextResource("1." + type, "1." + type);
        servlet.addServletContextResource("2." + type, "2." + type);
    }
    servlet.addServletContextResource("new.js");
    ResourceProvider resourceProvider = service.getContext().getAttribute(Lookup.class).lookup(ResourceProvider.class);
    InputStream stream = resourceProvider.getClientResourceAsStream("META-INF/resources/" + ApplicationConstants.CLIENT_ENGINE_PATH + "/compile.properties");
    Properties properties = new Properties();
    properties.load(stream);
    clientEngine = ApplicationConstants.CLIENT_ENGINE_PATH + "/" + properties.getProperty("jsFile");
    stream.close();
}
Also used : TestVaadinServlet(com.vaadin.flow.server.MockServletServiceSessionSetup.TestVaadinServlet) InputStream(java.io.InputStream) ResourceProvider(com.vaadin.flow.di.ResourceProvider) Lookup(com.vaadin.flow.di.Lookup) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Properties(java.util.Properties) Before(org.junit.Before)

Aggregations

Lookup (com.vaadin.flow.di.Lookup)1 ResourceProvider (com.vaadin.flow.di.ResourceProvider)1 TestVaadinServlet (com.vaadin.flow.server.MockServletServiceSessionSetup.TestVaadinServlet)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Before (org.junit.Before)1