Search in sources :

Example 1 with AppEngineJavaComponentsNotInstalledException

use of com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudSdkValidator method validateCloudSdk.

protected Set<CloudSdkValidationResult> validateCloudSdk(Path path) {
    Set<CloudSdkValidationResult> validationResults = new HashSet<>();
    if (path == null) {
        validationResults.add(CloudSdkValidationResult.CLOUD_SDK_NOT_FOUND);
        // If the Cloud SDK is not found, don't bother checking anything else
        return validationResults;
    }
    CloudSdk sdk = buildCloudSdkWithPath(path);
    try {
        sdk.validateCloudSdk();
    } catch (CloudSdkNotFoundException exception) {
        validationResults.add(CloudSdkValidationResult.CLOUD_SDK_NOT_FOUND);
        // If the Cloud SDK is not found, don't bother checking anything else
        return validationResults;
    } catch (CloudSdkOutOfDateException exception) {
        validationResults.add(com.google.cloud.tools.intellij.appengine.sdk.CloudSdkValidationResult.CLOUD_SDK_VERSION_NOT_SUPPORTED);
    }
    try {
        sdk.validateAppEngineJavaComponents();
    } catch (AppEngineJavaComponentsNotInstalledException ex) {
        validationResults.add(CloudSdkValidationResult.NO_APP_ENGINE_COMPONENT);
    }
    return validationResults;
}
Also used : AppEngineJavaComponentsNotInstalledException(com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException) CloudSdkOutOfDateException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkOutOfDateException) CloudSdk(com.google.cloud.tools.appengine.cloudsdk.CloudSdk) CloudSdkNotFoundException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkNotFoundException) HashSet(java.util.HashSet)

Example 2 with AppEngineJavaComponentsNotInstalledException

use of com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException in project app-maven-plugin by GoogleCloudPlatform.

the class CloudSdkAppEngineFactory method defaultCloudSdkBuilder.

protected CloudSdk.Builder defaultCloudSdkBuilder() {
    mojo.handleCloudSdkPathDeprecation();
    Path sdkPath = mojo.getCloudSdkHome();
    if (mojo.getCloudSdkHome() == null) {
        sdkPath = cloudSdkOperationsFactory.newDownloader(mojo.getCloudSdkVersion()).downloadCloudSdk(mojo.getLog());
    }
    CloudSdk.Builder cloudSdkBuilder = cloudSdkFactory.cloudSdkBuilder().sdkPath(sdkPath);
    if (mojo.getCloudSdkHome() != null && mojo.getCloudSdkVersion() != null) {
        try {
            cloudSdkOperationsFactory.newChecker(mojo.getCloudSdkVersion()).checkCloudSdk(cloudSdkBuilder.build());
        } catch (CloudSdkNotFoundException | CloudSdkVersionFileException | InvalidJavaSdkException | AppEngineJavaComponentsNotInstalledException | CloudSdkOutOfDateException ex) {
            throw new RuntimeException(ex);
        }
    }
    ProcessOutputLineListener lineListener = new DefaultProcessOutputLineListener(mojo.getLog());
    return cloudSdkBuilder.addStdOutLineListener(lineListener).addStdErrLineListener(lineListener).exitListener(new NonZeroExceptionExitListener()).appCommandMetricsEnvironment(mojo.getArtifactId()).appCommandMetricsEnvironmentVersion(mojo.getArtifactVersion()).appCommandCredentialFile(mojo.getServiceAccountKeyFile());
}
Also used : Path(java.nio.file.Path) CloudSdkOutOfDateException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkOutOfDateException) CloudSdkNotFoundException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkNotFoundException) AppEngineJavaComponentsNotInstalledException(com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException) NonZeroExceptionExitListener(com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitListener) CloudSdkVersionFileException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkVersionFileException) ProcessOutputLineListener(com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener) CloudSdk(com.google.cloud.tools.appengine.cloudsdk.CloudSdk) InvalidJavaSdkException(com.google.cloud.tools.appengine.cloudsdk.InvalidJavaSdkException)

Example 3 with AppEngineJavaComponentsNotInstalledException

use of com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardDeployTask method execute.

@Override
public void execute(ProcessStartListener startListener) {
    UsageTrackerProvider.getInstance().trackEvent(GctTracking.APP_ENGINE_DEPLOY).addMetadata(GctTracking.METADATA_LABEL_KEY, isFlexCompat ? "flex-compat" : "standard").ping();
    Path stagingDirectory;
    AppEngineHelper helper = deploy.getHelper();
    try {
        stagingDirectory = helper.createStagingDirectory(deploy.getLoggingHandler(), deploy.getDeploymentConfiguration().getCloudProjectName());
    } catch (IOException ioe) {
        deploy.getCallback().errorOccurred(GctBundle.message("appengine.deployment.error.creating.staging.directory"));
        logger.error(ioe);
        return;
    }
    try {
        if (helper.stageCredentials(deploy.getDeploymentConfiguration().getGoogleUsername()) == null) {
            deploy.getCallback().errorOccurred(GctBundle.message("appengine.staging.credentials.error.message"));
            return;
        }
        stageStandard.stage(stagingDirectory, startListener, deploy(stagingDirectory, startListener));
    } catch (AppEngineJavaComponentsNotInstalledException ex) {
        deploy.getCallback().errorOccurred(GctBundle.message("appengine.cloudsdk.java.components.missing") + "\n" + GctBundle.message("appengine.cloudsdk.java.components.howtoinstall"));
        logger.warn(ex);
    } catch (RuntimeException re) {
        deploy.getCallback().errorOccurred(GctBundle.message("appengine.deployment.exception.during.staging") + "\n" + GctBundle.message("appengine.action.error.update.message"));
        logger.error(re);
    }
}
Also used : Path(java.nio.file.Path) AppEngineJavaComponentsNotInstalledException(com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException) AppEngineHelper(com.google.cloud.tools.intellij.appengine.cloud.AppEngineHelper) IOException(java.io.IOException)

Example 4 with AppEngineJavaComponentsNotInstalledException

use of com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardDeployTaskTest method stage_missingJavaComponents_error.

@Test
public void stage_missingJavaComponents_error() {
    doThrow(new AppEngineJavaComponentsNotInstalledException("")).when(stage).stage(any(), any(), any());
    task.execute(startListener);
    verify(callback, times(1)).errorOccurred(JAVA_COMPONENTS_MISSING_FAIL_MSG);
}
Also used : AppEngineJavaComponentsNotInstalledException(com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException) Test(org.junit.Test)

Aggregations

AppEngineJavaComponentsNotInstalledException (com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException)4 CloudSdk (com.google.cloud.tools.appengine.cloudsdk.CloudSdk)2 CloudSdkNotFoundException (com.google.cloud.tools.appengine.cloudsdk.CloudSdkNotFoundException)2 CloudSdkOutOfDateException (com.google.cloud.tools.appengine.cloudsdk.CloudSdkOutOfDateException)2 Path (java.nio.file.Path)2 CloudSdkVersionFileException (com.google.cloud.tools.appengine.cloudsdk.CloudSdkVersionFileException)1 InvalidJavaSdkException (com.google.cloud.tools.appengine.cloudsdk.InvalidJavaSdkException)1 NonZeroExceptionExitListener (com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitListener)1 ProcessOutputLineListener (com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener)1 AppEngineHelper (com.google.cloud.tools.intellij.appengine.cloud.AppEngineHelper)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1