Search in sources :

Example 1 with FLOW_NPM_PACKAGE_NAME

use of com.vaadin.flow.server.frontend.FrontendUtils.FLOW_NPM_PACKAGE_NAME in project flow by vaadin.

the class AbstractNodeUpdateImportsTest method setup.

@Before
public void setup() throws Exception {
    File tmpRoot = temporaryFolder.getRoot();
    logger = new MockLogger();
    frontendDirectory = new File(tmpRoot, DEFAULT_FRONTEND_DIR);
    nodeModulesPath = new File(tmpRoot, NODE_MODULES);
    generatedPath = new File(tmpRoot, Paths.get(TARGET, DEFAULT_GENERATED_DIR).toString());
    importsFile = new File(generatedPath, IMPORTS_NAME);
    ClassFinder classFinder = getClassFinder();
    updater = new TaskUpdateImports(classFinder, getScanner(classFinder), finder -> null, tmpRoot, generatedPath, frontendDirectory, null, null, false, TARGET, true, false, Mockito.mock(FeatureFlags.class)) {

        @Override
        Logger log() {
            return logger;
        }
    };
    assertTrue(nodeModulesPath.mkdirs());
    createExpectedImports(frontendDirectory, nodeModulesPath);
    assertTrue(new File(nodeModulesPath, FLOW_NPM_PACKAGE_NAME + "ExampleConnector.js").exists());
}
Also used : DEFAULT_FRONTEND_DIR(com.vaadin.flow.server.frontend.FrontendUtils.DEFAULT_FRONTEND_DIR) Arrays(java.util.Arrays) DEFAULT_GENERATED_DIR(com.vaadin.flow.server.frontend.FrontendUtils.DEFAULT_GENERATED_DIR) ArrayList(java.util.ArrayList) Charset(java.nio.charset.Charset) ExpectedException(org.junit.rules.ExpectedException) Before(org.junit.Before) FrontendDependenciesScanner(com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner) Logger(org.slf4j.Logger) ClassFinder(com.vaadin.flow.server.frontend.scanner.ClassFinder) Files(java.nio.file.Files) NODE_MODULES(com.vaadin.flow.server.frontend.FrontendUtils.NODE_MODULES) OpenOption(java.nio.file.OpenOption) StandardOpenOption(java.nio.file.StandardOpenOption) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) Test(org.junit.Test) TARGET(com.vaadin.flow.server.Constants.TARGET) Collectors(java.util.stream.Collectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) IMPORTS_NAME(com.vaadin.flow.server.frontend.FrontendUtils.IMPORTS_NAME) Mockito(org.mockito.Mockito) List(java.util.List) Rule(org.junit.Rule) Paths(java.nio.file.Paths) Assert.assertFalse(org.junit.Assert.assertFalse) FeatureFlags(com.vaadin.experimental.FeatureFlags) FLOW_NPM_PACKAGE_NAME(com.vaadin.flow.server.frontend.FrontendUtils.FLOW_NPM_PACKAGE_NAME) Assert(org.junit.Assert) TemporaryFolder(org.junit.rules.TemporaryFolder) ClassFinder(com.vaadin.flow.server.frontend.scanner.ClassFinder) Logger(org.slf4j.Logger) File(java.io.File) Before(org.junit.Before)

Aggregations

FeatureFlags (com.vaadin.experimental.FeatureFlags)1 TARGET (com.vaadin.flow.server.Constants.TARGET)1 DEFAULT_FRONTEND_DIR (com.vaadin.flow.server.frontend.FrontendUtils.DEFAULT_FRONTEND_DIR)1 DEFAULT_GENERATED_DIR (com.vaadin.flow.server.frontend.FrontendUtils.DEFAULT_GENERATED_DIR)1 FLOW_NPM_PACKAGE_NAME (com.vaadin.flow.server.frontend.FrontendUtils.FLOW_NPM_PACKAGE_NAME)1 IMPORTS_NAME (com.vaadin.flow.server.frontend.FrontendUtils.IMPORTS_NAME)1 NODE_MODULES (com.vaadin.flow.server.frontend.FrontendUtils.NODE_MODULES)1 ClassFinder (com.vaadin.flow.server.frontend.scanner.ClassFinder)1 FrontendDependenciesScanner (com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner)1 File (java.io.File)1 IOException (java.io.IOException)1 Charset (java.nio.charset.Charset)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Files (java.nio.file.Files)1 OpenOption (java.nio.file.OpenOption)1 Paths (java.nio.file.Paths)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1