Search in sources :

Example 46 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineDeploymentConfigurationTest method checkConfiguration_withOtherDeploymentSource_throwsException.

@Test
public void checkConfiguration_withOtherDeploymentSource_throwsException() {
    RuntimeConfigurationError error = expectThrows(RuntimeConfigurationError.class, () -> configuration.checkConfiguration(mockRemoteServer, mockOtherDeploymentSource, project));
    assertThat(error).hasMessage("Invalid deployment source.");
}
Also used : RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) Test(org.junit.Test)

Example 47 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineDeploymentConfigurationTest method checkConfiguration_withCloudSdkNotFound_throwsException.

@Test
public void checkConfiguration_withCloudSdkNotFound_throwsException() {
    setUpValidFlexConfiguration();
    when(mockSdkValidator.validateCloudSdk()).thenReturn(ImmutableSet.of(CLOUD_SDK_NOT_FOUND));
    RuntimeConfigurationError error = expectThrows(RuntimeConfigurationError.class, () -> configuration.checkConfiguration(mockRemoteServer, mockAppEngineDeployable, project));
    assertThat(error).hasMessage("Server is misconfigured: No Cloud SDK was found in the specified directory.");
}
Also used : RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) Test(org.junit.Test)

Example 48 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineDeploymentConfigurationTest method checkConfiguration_withNoDockerfile_throwsException.

@Test
public void checkConfiguration_withNoDockerfile_throwsException() throws Exception {
    setUpValidCustomFlexConfiguration();
    FacetManager.getInstance(module).getFacetByType(AppEngineFlexibleFacet.getFacetType().getId()).getConfiguration().setDockerDirectory(emptyDirectory.getPath());
    RuntimeConfigurationError error = expectThrows(RuntimeConfigurationError.class, () -> configuration.checkConfiguration(mockRemoteServer, mockAppEngineDeployable, project));
    assertThat(error).hasMessage("There is no Dockerfile in specified directory.");
}
Also used : RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) Test(org.junit.Test)

Example 49 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project ballerina by ballerina-lang.

the class BallerinaRunConfigurationWithMain method checkFileConfiguration.

protected void checkFileConfiguration() throws RuntimeConfigurationError {
    VirtualFile file = findFile(getFilePath());
    if (file == null) {
        throw new RuntimeConfigurationError("Cannot find the specified main file.");
    }
    PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
    if (!(psiFile instanceof BallerinaFile)) {
        throw new RuntimeConfigurationError("Main file is not a valid Ballerina file.");
    }
    if (myRunKind == RunConfigurationKind.MAIN && !BallerinaRunUtil.hasMainFunction(psiFile)) {
        throw new RuntimeConfigurationError("Main run kind is selected, but the file does not contain a main " + "function.");
    }
    if (myRunKind == RunConfigurationKind.SERVICE && !BallerinaRunUtil.hasServices(psiFile)) {
        throw new RuntimeConfigurationError("Service run kind is selected, but the file does not contain any " + "services.");
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) BallerinaFile(org.ballerinalang.plugins.idea.psi.BallerinaFile) PsiFile(com.intellij.psi.PsiFile) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 50 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project ballerina by ballerina-lang.

the class BallerinaTestConfiguration method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    super.checkBaseConfiguration();
    VirtualFile file = findFile(getFilePath());
    if (file == null) {
        throw new RuntimeConfigurationError("Cannot find the specified main file.");
    }
    PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
    if (!(psiFile instanceof BallerinaFile)) {
        throw new RuntimeConfigurationError("Selected file is not a valid Ballerina file.");
    }
    if (!file.getName().endsWith(BallerinaConstants.BALLERINA_TEST_FILE_SUFFIX)) {
        throw new RuntimeConfigurationError("Selected file is not a Ballerina test file. File should end with " + "'" + BallerinaConstants.BALLERINA_TEST_FILE_SUFFIX + "' suffix.");
    }
    if (getPackage().isEmpty()) {
        throw new RuntimeConfigurationError("Test files must be in a package.");
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) BallerinaFile(org.ballerinalang.plugins.idea.psi.BallerinaFile) PsiFile(com.intellij.psi.PsiFile) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Aggregations

RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)53 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 Test (org.junit.Test)16 Module (com.intellij.openapi.module.Module)9 File (java.io.File)7 ExecutionException (com.intellij.execution.ExecutionException)6 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 PsiFile (com.intellij.psi.PsiFile)5 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)4 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Sdk (com.intellij.openapi.projectRoots.Sdk)4 NotNull (org.jetbrains.annotations.NotNull)4 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 JSFile (com.intellij.lang.javascript.psi.JSFile)3 Project (com.intellij.openapi.project.Project)3 PsiElement (com.intellij.psi.PsiElement)3 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)3 UserSpecifiedPathDeploymentSource (com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource)2 MalformedYamlFileException (com.google.cloud.tools.intellij.appengine.project.MalformedYamlFileException)2