use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-community by JetBrains.
the class TestDirectory method checkConfiguration.
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
JavaParametersUtil.checkAlternativeJRE(getConfiguration());
ProgramParametersUtil.checkWorkingDirectoryExist(getConfiguration(), getConfiguration().getProject(), getConfiguration().getConfigurationModule().getModule());
final String dirName = getConfiguration().getPersistentData().getDirName();
if (dirName == null || dirName.isEmpty()) {
throw new RuntimeConfigurationError("Directory is not specified");
}
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
if (file == null) {
throw new RuntimeConfigurationWarning("Directory \'" + dirName + "\' is not found");
}
final Module module = getConfiguration().getConfigurationModule().getModule();
if (module == null) {
throw new RuntimeConfigurationError("Module to choose classpath from is not specified");
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfiguration method checkFlexConfig.
/**
* Checks that this configuration is valid for a flex deployment, otherwise throws a {@link
* RuntimeConfigurationError}.
*
* @param deployable the {@link AppEngineDeployable deployment source} that was selected by the
* user to deploy
* @param project the {@link Project} that this configuration belongs to
* @throws RuntimeConfigurationError if this configuration is not valid for a flex deployment
*/
private void checkFlexConfig(AppEngineDeployable deployable, Project project) throws RuntimeConfigurationError {
check(!(deployable instanceof UserSpecifiedPathDeploymentSource) || (!StringUtil.isEmpty(userSpecifiedArtifactPath) && isJarOrWar(userSpecifiedArtifactPath)), "appengine.flex.config.user.specified.artifact.error");
check(StringUtils.isNotBlank(moduleName), "appengine.flex.config.select.module");
AppEngineFlexibleFacet facet = AppEngineFlexibleFacet.getFacetByModuleName(moduleName, project);
check(facet != null, "appengine.flex.config.select.module");
String appYamlPath = facet.getConfiguration().getAppYamlPath();
check(StringUtils.isNotBlank(appYamlPath), "appengine.flex.config.browse.app.yaml");
check(Files.exists(Paths.get(appYamlPath)), "appengine.deployment.config.appyaml.error");
try {
Optional<FlexibleRuntime> runtime = AppEngineProjectService.getInstance().getFlexibleRuntimeFromAppYaml(appYamlPath);
if (runtime.isPresent() && runtime.get().isCustom()) {
String dockerDirectory = facet.getConfiguration().getDockerDirectory();
check(StringUtils.isNotBlank(dockerDirectory), "appengine.flex.config.browse.docker.directory");
check(Files.exists(Paths.get(dockerDirectory, DOCKERFILE_NAME)), "appengine.deployment.config.dockerfile.error");
}
} catch (MalformedYamlFileException e) {
throw new RuntimeConfigurationError(GctBundle.message("appengine.appyaml.malformed"));
}
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfiguration method checkCommonConfig.
private void checkCommonConfig(AppEngineDeployable deployable) throws RuntimeConfigurationError {
// do not check SDK if it supports dynamic install - the deployment runner will block itself
// until installation is done.
CloudSdkService cloudSdkService = CloudSdkService.getInstance();
SdkStatus sdkStatus = cloudSdkService.getStatus();
if (sdkStatus != SdkStatus.READY && !cloudSdkService.isInstallSupported()) {
Set<CloudSdkValidationResult> sdkValidationResult = CloudSdkValidator.getInstance().validateCloudSdk();
if (!sdkValidationResult.isEmpty()) {
CloudSdkValidationResult result = Iterables.getFirst(sdkValidationResult, null);
throw new RuntimeConfigurationError(GctBundle.message("appengine.flex.config.server.error", result.getMessage()));
}
}
check(deployable instanceof UserSpecifiedPathDeploymentSource || deployable.isValid(), "appengine.config.deployment.source.error");
check(StringUtils.isNotBlank(cloudProjectName), "appengine.flex.config.project.missing.message");
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfigurationTest method checkConfiguration_withInvalidModuleName_throwsException.
@Test
public void checkConfiguration_withInvalidModuleName_throwsException() throws Exception {
setUpValidFlexConfiguration();
configuration.setModuleName("some invalid module");
RuntimeConfigurationError error = expectThrows(RuntimeConfigurationError.class, () -> configuration.checkConfiguration(mockRemoteServer, mockAppEngineDeployable, project));
assertThat(error).hasMessage("Select a module with the App Engine flexible facet.");
}
use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfigurationTest method checkConfiguration_withUserSpecifiedSource_andDirectory_throwsException.
@Test
public void checkConfiguration_withUserSpecifiedSource_andDirectory_throwsException() {
setUpValidFlexConfigurationWithUserSpecifiedSource();
configuration.setUserSpecifiedArtifactPath(someWar.getParent());
RuntimeConfigurationError error = expectThrows(RuntimeConfigurationError.class, () -> configuration.checkConfiguration(mockRemoteServer, mockUserSpecifiedPathDeploymentSource, project));
assertThat(error).hasMessage("Browse to a JAR or WAR file.");
}
Aggregations