Java Code Examples for com.vaadin.flow.shared.ApplicationConstants#CLIENT_ENGINE_PATH

The following examples show how to use com.vaadin.flow.shared.ApplicationConstants#CLIENT_ENGINE_PATH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BootstrapHandler.java    From flow with Apache License 2.0 6 votes vote down vote up
private static String readClientEngine() {
    // read client engine file name
    try (InputStream prop = ClientResourcesUtils
            .getResource("/META-INF/resources/"
                    + ApplicationConstants.CLIENT_ENGINE_PATH
                    + "/compile.properties")) {
        // null when running SDM or tests
        if (prop != null) {
            Properties properties = new Properties();
            properties.load(prop);
            return ApplicationConstants.CLIENT_ENGINE_PATH + "/"
                    + properties.getProperty("jsFile");
        } else {
            getLogger().warn(
                    "No compile.properties available on initialization, "
                            + "could not read client engine file name.");
        }
    } catch (IOException e) {
        throw new ExceptionInInitializerError(e);
    }
    return null;
}
 
Example 2
Source File: ClientEngineSizeIT.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientEngineSize() throws Exception {
    File compiledModuleFolder = new File(
            "target/classes/META-INF/resources/"
                    + ApplicationConstants.CLIENT_ENGINE_PATH);
    if (!compiledModuleFolder.exists()) {
        throw new IOException(
                "Folder with compiled client engine does not exist: "
                        + compiledModuleFolder.getAbsolutePath());
    }

    boolean cacheJsReported = false;
    boolean cacheJsGzReported = false;

    for (File f : compiledModuleFolder.listFiles()) {
        if (f.getName().endsWith(".cache.js")) {
            if (cacheJsReported) {
                throw new IOException(
                        "Multiple uncompressed cache.js files found!");
            }
            printTeamcityStats("clientEngine", f.length());
            cacheJsReported = true;
        } else if (f.getName().endsWith(".cache.js.gz")) {
            if (cacheJsGzReported) {
                throw new IOException(
                        "Multiple compressed cache.js.gz files found!");
            }
            printTeamcityStats("clientEngineGzipped", f.length());
            cacheJsGzReported = true;
        }
    }
    if (!cacheJsReported) {
        throw new IOException("Uncompressed cache.js file not found!");
    }
    if (!cacheJsGzReported) {
        throw new IOException("Compressed cache.js.gz file not found!");
    }
}