use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationCheckerTest method checkStatusWithActiveCommands.
@Test
void checkStatusWithActiveCommands() throws ApiException {
ApiCommand addRepositoriesCmd = addReposCmd().success(Boolean.FALSE).resultMessage("Permission denied");
ApiCommand deployParcelsCmd = deployParcelsCmd().success(Boolean.FALSE).resultMessage("Host not found");
ApiCommand firstRunCmd = firstRunCmd().active(Boolean.TRUE).resultMessage("Actually this has not finished yet...");
ApiCommand templateInstallCmd = templateInstallCmd(addRepositoriesCmd, deployParcelsCmd, firstRunCmd).resultMessage("Failed to import cluster template");
expectReadCommandForFailedCommands(templateInstallCmd);
ClouderaManagerOperationFailedException ex = assertThrowsExact(ClouderaManagerOperationFailedException.class, () -> underTest.checkStatus(pollerObject));
String expected = expectMessageForCommands(addRepositoriesCmd, deployParcelsCmd, firstRunCmd);
assertEquals(expected, ex.getMessage());
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationCheckerTest method checkStatusWithSubCommandMessage.
@Test
void checkStatusWithSubCommandMessage() throws ApiException {
ApiCommand addRepositoriesCmd = addReposCmd();
ApiCommand deployParcelsCmd = deployParcelsCmd().success(Boolean.FALSE).resultMessage("Failed to deploy parcels");
ApiCommand templateInstallCmd = templateInstallCmd(addRepositoriesCmd, deployParcelsCmd);
expectReadCommandForFailedCommands(templateInstallCmd);
ClouderaManagerOperationFailedException ex = assertThrowsExact(ClouderaManagerOperationFailedException.class, () -> underTest.checkStatus(pollerObject));
String expected = expectMessageForCommands(deployParcelsCmd);
assertEquals(expected, ex.getMessage());
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationCheckerTest method testCloudStorageFailureWhenDatahub.
@Test
void testCloudStorageFailureWhenDatahub() throws ApiException {
ApiCommand auditDirCmd = auditDirCmd().success(Boolean.FALSE).resultMessage("Aborted");
ApiCommand deployParcelsCmd = deployParcelsCmd().success(Boolean.FALSE).resultMessage("Host not found");
ApiCommand firstRunCmd = firstRunCmd().success(Boolean.FALSE).resultMessage("Failed to perform First Run of services.");
ApiCommand templateInstallCmd = templateInstallCmd(auditDirCmd, deployParcelsCmd, firstRunCmd).resultMessage("Failed to import cluster template");
expectReadCommandForFailedCommands(templateInstallCmd);
stack.setType(StackType.WORKLOAD);
ClouderaManagerOperationFailedException ex = assertThrowsExact(ClouderaManagerOperationFailedException.class, () -> underTest.checkStatus(pollerObject));
String expected = expectMessageForCommands(auditDirCmd, deployParcelsCmd, firstRunCmd);
assertEquals(expected, ex.getMessage());
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerTemplateInstallationCheckerTest method checkStatusWithMultipleFailures.
@Test
void checkStatusWithMultipleFailures() throws ApiException {
ApiCommand addRepositoriesCmd = addReposCmd().success(Boolean.FALSE).resultMessage("Permission denied");
ApiCommand deployParcelsCmd = deployParcelsCmd().success(Boolean.FALSE).resultMessage("Host not found");
ApiCommand firstRunCmd = firstRunCmd().success(Boolean.FALSE).resultMessage("Failed to perform First Run of services.");
ApiCommand templateInstallCmd = templateInstallCmd(addRepositoriesCmd, deployParcelsCmd, firstRunCmd).resultMessage("Failed to import cluster template");
expectReadCommandForFailedCommands(templateInstallCmd);
ClouderaManagerOperationFailedException ex = assertThrowsExact(ClouderaManagerOperationFailedException.class, () -> underTest.checkStatus(pollerObject));
String expected = expectMessageForCommands(addRepositoriesCmd, deployParcelsCmd, firstRunCmd);
assertEquals(expected, ex.getMessage());
}
use of com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException in project cloudbreak by hortonworks.
the class ClouderaManagerUpgradeParcelDownloadListenerTask method handleTimeout.
@Override
public void handleTimeout(ClouderaManagerCommandPollerObject pollerObject) {
// when downloading, progress and totalProgress will show the current number of bytes downloaded
// and the total number of bytes needed to be downloaded respectively.
String baseMessage = "Operation timed out. Failed to download parcel in time.";
try {
ApiParcel apiParcel = getApiParcel(pollerObject);
ApiParcelState parcelState = apiParcel.getState();
String progress = FileUtils.byteCountToDisplaySize(parcelState.getProgress().toBigInteger());
String totalProgress = FileUtils.byteCountToDisplaySize(parcelState.getTotalProgress().toBigInteger());
String progressMessage = String.format(" %s out of total %s has been downloaded!", progress, totalProgress);
throw new ClouderaManagerOperationFailedException(baseMessage + progressMessage);
} catch (ApiException e) {
throw new ClouderaManagerOperationFailedException(baseMessage);
}
}
Aggregations