Search in sources :

Example 11 with DatalakeRestoreStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.

the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedHbaseRestoreDifferentFailureReasons.

@Test
public void testFailedHbaseRestoreDifferentFailureReasons() {
    datalakeDRProto.HbaseBackupRestoreState.Builder hbaseBuilder = datalakeDRProto.HbaseBackupRestoreState.newBuilder().setAtlasJanusTable(createStatus(FAILED_STATE, FAILURE_REASON)).setAtlasEntityAuditEventTable(createStatus(FAILED_STATE, FAILURE_REASON2));
    datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setHbase(hbaseBuilder);
    datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
    String expectedFailure = getFailureString(OperationEnum.HBASE_ATLAS_JANUS.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.HBASE_ATLAS_AUDIT.description(), FAILURE_REASON2);
    DatalakeRestoreStatusResponse response = underTest.convert(builder.build());
    assertEquals(DatalakeRestoreStatusResponse.State.FAILED, response.getState());
    assertEquals(expectedFailure, response.getFailureReason());
    assert response.isComplete();
}
Also used : DatalakeRestoreStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse) Test(org.junit.Test)

Example 12 with DatalakeRestoreStatusResponse

use of com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse in project cloudbreak by hortonworks.

the class GrpcStatusResponseToDatalakeBackupStatusResponseConverterTest method testFailedSolrRestoreDifferentFailureReasons.

@Test
public void testFailedSolrRestoreDifferentFailureReasons() {
    datalakeDRProto.SolrBackupRestoreState.Builder solrBuilder = datalakeDRProto.SolrBackupRestoreState.newBuilder().setEdgeIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setFulltextIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON2)).setRangerAuditsCollection(createStatus(FAILED_STATE, FAILURE_REASON)).setVertexIndexCollection(createStatus(FAILED_STATE, FAILURE_REASON2));
    datalakeDRProto.InternalBackupRestoreState.Builder stateBuilder = datalakeDRProto.InternalBackupRestoreState.newBuilder().setSolr(solrBuilder);
    datalakeDRProto.RestoreDatalakeStatusResponse.Builder builder = datalakeDRProto.RestoreDatalakeStatusResponse.newBuilder().setOverallState(FAILED_STATE).setOperationStates(stateBuilder);
    String expectedFailure = getFailureString(OperationEnum.SOLR_EDGE_INDEX.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.SOLR_FULLTEXT_INDEX.description(), FAILURE_REASON2) + ", " + getFailureString(OperationEnum.SOLR_RANGER_AUDITS.description(), FAILURE_REASON) + ", " + getFailureString(OperationEnum.SOLR_VERTEX_INDEX.description(), FAILURE_REASON2);
    DatalakeRestoreStatusResponse response = underTest.convert(builder.build());
    assertEquals(DatalakeRestoreStatusResponse.State.FAILED, response.getState());
    assertEquals(expectedFailure, response.getFailureReason());
    assert response.isComplete();
}
Also used : DatalakeRestoreStatusResponse(com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse) Test(org.junit.Test)

Aggregations

DatalakeRestoreStatusResponse (com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse)12 Test (org.junit.Test)9 SdxContext (com.sequenceiq.datalake.flow.SdxContext)3 DatalakeTriggerRestoreEvent (com.sequenceiq.datalake.flow.dr.restore.event.DatalakeTriggerRestoreEvent)3 FlowParameters (com.sequenceiq.flow.core.FlowParameters)3 DatalakeDatabaseRestoreStartEvent (com.sequenceiq.datalake.flow.dr.restore.event.DatalakeDatabaseRestoreStartEvent)2 AbstractAction (com.sequenceiq.flow.core.AbstractAction)2 AbstractActionTestSupport (com.sequenceiq.flow.core.AbstractActionTestSupport)2 HashMap (java.util.HashMap)2 Test (org.junit.jupiter.api.Test)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 AbstractSdxAction (com.sequenceiq.datalake.service.AbstractSdxAction)1 FlowChainLog (com.sequenceiq.flow.domain.FlowChainLog)1 FlowLog (com.sequenceiq.flow.domain.FlowLog)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Bean (org.springframework.context.annotation.Bean)1 StateContext (org.springframework.statemachine.StateContext)1