use of com.vaadin.flow.server.ExecutionFailedException in project flow by vaadin.
the class TaskUpdateThemeImportTest method taskExecuted_customThemeFolderExistsInBothFrontendAndStaticResources_throwsException.
@Test
public void taskExecuted_customThemeFolderExistsInBothFrontendAndStaticResources_throwsException() {
File themeDir = new File(frontendDirectory, CUSTOM_THEME_PATH);
Assert.assertTrue(themeDir.mkdirs());
String staticResources = String.join("/", APPLICATION_STATIC_RESOURCES, CUSTOM_THEME_PATH);
File themeDirInStatic = new File(projectRoot, staticResources);
Assert.assertTrue(themeDirInStatic.mkdirs());
ExecutionFailedException e = Assert.assertThrows(ExecutionFailedException.class, taskUpdateThemeImport::execute);
Assert.assertTrue(e.getMessage().contains(String.format("Discovered Theme folder for theme '%s' " + "in more than one place in the project. Please " + "make sure there is only one theme folder with name '%s' " + "exists in the your project. ", CUSTOM_THEME_NAME, CUSTOM_THEME_NAME)));
}
use of com.vaadin.flow.server.ExecutionFailedException in project flow by vaadin.
the class TaskUpdateThemeImportTest method taskExecuted_customThemeFolderExistsInBothMetaInfResourcesAndInClasspath_throwsException.
@Test
public void taskExecuted_customThemeFolderExistsInBothMetaInfResourcesAndInClasspath_throwsException() {
String metaInfResources = String.join("/", APPLICATION_META_INF_RESOURCES, CUSTOM_THEME_PATH);
File themeDir = new File(projectRoot, metaInfResources);
Assert.assertTrue(themeDir.mkdirs());
String classPathThemePath = NODE_MODULES + FLOW_NPM_PACKAGE_NAME + CUSTOM_THEME_PATH;
File classPathThemeDir = new File(projectRoot, classPathThemePath);
Assert.assertTrue(classPathThemeDir.mkdirs());
ExecutionFailedException e = Assert.assertThrows(ExecutionFailedException.class, taskUpdateThemeImport::execute);
Assert.assertTrue(e.getMessage().contains(String.format("Theme '%s' should not exist inside a " + "jar and in the project at the same time.", CUSTOM_THEME_NAME)));
}
use of com.vaadin.flow.server.ExecutionFailedException in project flow by vaadin.
the class TaskUpdateThemeImportTest method taskExecuted_customThemeFolderExistsInBothStaticAndMetaInfResources_throwsException.
@Test
public void taskExecuted_customThemeFolderExistsInBothStaticAndMetaInfResources_throwsException() {
String staticResources = String.join("/", APPLICATION_STATIC_RESOURCES, CUSTOM_THEME_PATH);
File themeDirInStatic = new File(projectRoot, staticResources);
Assert.assertTrue(themeDirInStatic.mkdirs());
String metaInfResources = String.join("/", APPLICATION_META_INF_RESOURCES, CUSTOM_THEME_PATH);
File themeDirInMetaInf = new File(projectRoot, metaInfResources);
Assert.assertTrue(themeDirInMetaInf.mkdirs());
ExecutionFailedException e = Assert.assertThrows(ExecutionFailedException.class, taskUpdateThemeImport::execute);
Assert.assertTrue(e.getMessage().contains(String.format("Discovered Theme folder for theme '%s' " + "in more than one place in the project. Please " + "make sure there is only one theme folder with name '%s' " + "exists in the your project. ", CUSTOM_THEME_NAME, CUSTOM_THEME_NAME)));
}
use of com.vaadin.flow.server.ExecutionFailedException in project flow by vaadin.
the class TaskUpdateThemeImportTest method taskExecuted_customThemeFolderExistsInBothFrontendAndMetaInfResources_throwsException.
@Test
public void taskExecuted_customThemeFolderExistsInBothFrontendAndMetaInfResources_throwsException() {
File themeDir = new File(frontendDirectory, CUSTOM_THEME_PATH);
Assert.assertTrue(themeDir.mkdirs());
String metaInfResources = String.join("/", APPLICATION_META_INF_RESOURCES, CUSTOM_THEME_PATH);
File themeDirInMetaInf = new File(projectRoot, metaInfResources);
Assert.assertTrue(themeDirInMetaInf.mkdirs());
ExecutionFailedException e = Assert.assertThrows(ExecutionFailedException.class, taskUpdateThemeImport::execute);
Assert.assertTrue(e.getMessage().contains(String.format("Discovered Theme folder for theme '%s' " + "in more than one place in the project. Please " + "make sure there is only one theme folder with name '%s' " + "exists in the your project. ", CUSTOM_THEME_NAME, CUSTOM_THEME_NAME)));
}
use of com.vaadin.flow.server.ExecutionFailedException in project flow by vaadin.
the class AbstractDevServerRunner method validateFiles.
/**
* Validates that the needed server binary and config file(s) are available.
*
* @throws ExecutionFailedException
* if there is a problem
*/
protected void validateFiles() throws ExecutionFailedException {
assert getPort() == 0;
// Skip checks if we have a dev server already running
File binary = getServerBinary();
File config = getServerConfig();
if (!getProjectRoot().exists()) {
getLogger().warn("No project folder '{}' exists", getProjectRoot());
throw new ExecutionFailedException(START_FAILURE + " the target execution folder doesn't exist.");
}
if (!binary.exists()) {
getLogger().warn("'{}' doesn't exist. Did you run `npm install`?", binary);
throw new ExecutionFailedException(String.format("%s '%s' doesn't exist. `npm install` has not run or failed.", START_FAILURE, binary));
} else if (!binary.canExecute()) {
getLogger().warn(" '{}' is not an executable. Did you run `npm install`?", binary);
throw new ExecutionFailedException(String.format("%s '%s' is not an executable." + " `npm install` has not run or failed.", START_FAILURE, binary));
}
if (!config.canRead()) {
getLogger().warn("{} configuration '{}' is not found or is not readable.", getServerName(), config);
throw new ExecutionFailedException(String.format("%s '%s' doesn't exist or is not readable.", START_FAILURE, config));
}
}
Aggregations