use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedRestore.
@Test
public void testFailedRestore() {
datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState("FAILED").setFailureReason(FAILURE_REASON);
DatalakeBackupStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
assertEquals(FAILURE_REASON, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.
the class SdxBackupRestoreServiceTest method triggerDatabaseBackupInternalSuccess.
@Test
public void triggerDatabaseBackupInternalSuccess() {
String drOperationId = UUID.randomUUID().toString();
when(datalakeDrClient.triggerBackup(any(), any(), any(), any())).thenReturn(new DatalakeBackupStatusResponse(drOperationId, DatalakeBackupStatusResponse.State.IN_PROGRESS, Optional.empty()));
when(sdxClusterRepository.findById(sdxCluster.getId())).thenReturn(Optional.of(sdxCluster));
DatalakeBackupStatusResponse backupResponse = sdxBackupRestoreService.triggerDatalakeBackup(sdxCluster.getId(), BACKUP_LOCATION, BACKUP_NAME, USER_CRN);
assertNotNull(backupResponse);
assertEquals(drOperationId, backupResponse.getBackupId());
assertTrue(isUUID(backupResponse.getBackupId()));
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedSolrBackupDifferentFailureReasons.
@Test
public void testFailedSolrBackupDifferentFailureReasons() {
datalakeDRProto.SolrBackupRestoreState.Builder solrBuilder = datalakeDRProto.SolrBackupRestoreState.newBuilder().setEdgeIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setFulltextIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON2));
datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setSolr(solrBuilder);
datalakeDRProto.BackupDatalakeStatusResponse.Builder builder = datalakeDRProto.BackupDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
String expectedFailure = getFailureString(OperationEnum.SOLR_EDGE_INDEX.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.SOLR_FULLTEXT_INDEX.description(), FAILURE_REASON2);
DatalakeBackupStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
assertEquals(expectedFailure, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedDatabaseBackup.
@Test
public void testFailedDatabaseBackup() {
datalakeDRProto.DatabaseBackupRestoreState.Builder databaseBuilder = datalakeDRProto.DatabaseBackupRestoreState.newBuilder().setDatabase(createStatus(FAILED_STATE, FAILURE_REASON));
datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setDatabase(databaseBuilder);
datalakeDRProto.BackupDatalakeStatusResponse.Builder builder = datalakeDRProto.BackupDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
String expectedFailure = getFailureString(OperationEnum.DATABASE.description(), FAILURE_REASON);
DatalakeBackupStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
assertEquals(expectedFailure, response.getFailureReason());
assert response.isComplete();
}
use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse in project cloudbreak by hortonworks.
the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedSolrBackupSameFailureReason.
@Test
public void testFailedSolrBackupSameFailureReason() {
datalakeDRProto.SolrBackupRestoreState.Builder solrBuilder = datalakeDRProto.SolrBackupRestoreState.newBuilder().setEdgeIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setFulltextIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setRangerAuditsCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setVertexIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON));
datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setSolr(solrBuilder);
datalakeDRProto.BackupDatalakeStatusResponse.Builder builder = datalakeDRProto.BackupDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
String expectedFailure = getFailureString(OperationEnum.SOLR.description(), FAILURE_REASON);
DatalakeBackupStatusResponse response = underTest.convert(builder.build());
assertEquals(DatalakeBackupStatusResponse.State.FAILED, response.getState());
assertEquals(expectedFailure, response.getFailureReason());
assert response.isComplete();
}
Aggregations