Search in sources :

Example 1 with ClouderaManagerOperationFailedException

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());
}
Also used : ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ClouderaManagerOperationFailedException(com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException) Test(org.junit.jupiter.api.Test)

Example 2 with ClouderaManagerOperationFailedException

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());
}
Also used : ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ClouderaManagerOperationFailedException(com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException) Test(org.junit.jupiter.api.Test)

Example 3 with ClouderaManagerOperationFailedException

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());
}
Also used : ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ClouderaManagerOperationFailedException(com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException) Test(org.junit.jupiter.api.Test)

Example 4 with ClouderaManagerOperationFailedException

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());
}
Also used : ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ClouderaManagerOperationFailedException(com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException) Test(org.junit.jupiter.api.Test)

Example 5 with ClouderaManagerOperationFailedException

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);
    }
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ClouderaManagerOperationFailedException(com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException) ApiParcelState(com.cloudera.api.swagger.model.ApiParcelState) ApiException(com.cloudera.api.swagger.client.ApiException)

Aggregations

ClouderaManagerOperationFailedException (com.sequenceiq.cloudbreak.cm.ClouderaManagerOperationFailedException)10 ApiCommand (com.cloudera.api.swagger.model.ApiCommand)8 Test (org.junit.jupiter.api.Test)6 CommandsResourceApi (com.cloudera.api.swagger.CommandsResourceApi)2 ApiException (com.cloudera.api.swagger.client.ApiException)2 ApiParcel (com.cloudera.api.swagger.model.ApiParcel)1 ApiParcelState (com.cloudera.api.swagger.model.ApiParcelState)1 CloudStorageConfigurationFailedException (com.sequenceiq.cloudbreak.cm.exception.CloudStorageConfigurationFailedException)1 CommandDetails (com.sequenceiq.cloudbreak.cm.exception.CommandDetails)1 List (java.util.List)1