use of com.google.cloud.tools.managedcloudsdk.command.CommandExecutionException in project google-cloud-intellij by GoogleCloudPlatform.
the class ManagedCloudSdkServiceTest method failed_install_appEngineException_changesSdkStatus_inProgress.
@Test
public void failed_install_appEngineException_changesSdkStatus_inProgress() throws Exception {
sdkService.addStatusUpdateListener(mockStatusUpdateListener);
emulateMockSdkInstallationProcess(MOCK_SDK_PATH);
SdkComponentInstaller mockComponentInstaller = mockManagedCloudSdk.newComponentInstaller();
doThrow(new CommandExecutionException(new UnsupportedOperationException())).when(mockComponentInstaller).installComponent(any(), any(), any());
sdkService.install();
ArgumentCaptor<SdkStatus> statusCaptor = ArgumentCaptor.forClass(SdkStatus.class);
verify(mockStatusUpdateListener, times(2)).onSdkStatusChange(any(), statusCaptor.capture());
assertThat(statusCaptor.getAllValues()).isEqualTo(Arrays.asList(SdkStatus.INSTALLING, SdkStatus.NOT_AVAILABLE));
}
use of com.google.cloud.tools.managedcloudsdk.command.CommandExecutionException in project app-maven-plugin by GoogleCloudPlatform.
the class CloudSdkDownloader method downloadCloudSdk.
/**
* Downloads/installs/updates the Cloud SDK
*
* @return The cloud SDK installation directory
*/
public Path downloadCloudSdk(Log log) {
try {
ProgressListener progressListener = new NoOpProgressListener();
ConsoleListener consoleListener = new CloudSdkDownloaderConsoleListener(log);
if (!managedCloudSdk.isInstalled()) {
managedCloudSdk.newInstaller().install(progressListener, consoleListener);
}
if (!managedCloudSdk.hasComponent(SdkComponent.APP_ENGINE_JAVA)) {
managedCloudSdk.newComponentInstaller().installComponent(SdkComponent.APP_ENGINE_JAVA, progressListener, consoleListener);
}
if (!managedCloudSdk.isUpToDate()) {
managedCloudSdk.newUpdater().update(progressListener, consoleListener);
}
return managedCloudSdk.getSdkHome();
} catch (IOException | SdkInstallerException | ManagedSdkVersionMismatchException | InterruptedException | CommandExecutionException | CommandExitException | ManagedSdkVerificationException ex) {
throw new RuntimeException(ex);
}
}
Aggregations