Search in sources :

Example 6 with SdxRecoveryResponse

use of com.sequenceiq.sdx.api.model.SdxRecoveryResponse in project cloudbreak by hortonworks.

the class SdxRecoverySelectorServiceTest method testRecoveryServiceCanSwitchToResizeRecovery.

@Test
public void testRecoveryServiceCanSwitchToResizeRecovery() {
    setResizeTest();
    SdxRecoveryResponse response = new SdxRecoveryResponse();
    when(mockResizeRecoveryService.triggerRecovery(cluster, request)).thenReturn(response);
    SdxRecoveryResponse result = sdxRecoverySelectorService.triggerRecovery(cluster, request);
    // Basically, just check that we pass through to the Resize Recovery Service
    Mockito.verifyNoInteractions(mockSdxUpgradeRecoveryService);
    Mockito.verify(mockResizeRecoveryService).triggerRecovery(cluster, request);
    Mockito.verify(mockSdxUpgradeRecoveryService, never()).triggerRecovery(cluster, request);
    assertNotNull(result);
    assertEquals(response, result);
}
Also used : SdxRecoveryResponse(com.sequenceiq.sdx.api.model.SdxRecoveryResponse) Test(org.junit.Test)

Example 7 with SdxRecoveryResponse

use of com.sequenceiq.sdx.api.model.SdxRecoveryResponse in project cloudbreak by hortonworks.

the class ResizeRecoveryServiceTest method testTriggerRecoveryShouldStartFlow.

@Test
public void testTriggerRecoveryShouldStartFlow() {
    sdxStatusEntity.setStatus(STOP_FAILED);
    SdxRecoveryResponse sdxRecoveryResponse = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.triggerRecovery(cluster, request));
    verify(sdxReactorFlowManager).triggerSdxStartFlow(cluster);
    assertEquals(flowId, sdxRecoveryResponse.getFlowIdentifier());
}
Also used : SdxRecoveryResponse(com.sequenceiq.sdx.api.model.SdxRecoveryResponse) Test(org.junit.jupiter.api.Test)

Example 8 with SdxRecoveryResponse

use of com.sequenceiq.sdx.api.model.SdxRecoveryResponse in project cloudbreak by hortonworks.

the class SdxUpgradeRecoveryService method triggerRecovery.

@Override
public SdxRecoveryResponse triggerRecovery(SdxCluster sdxCluster, SdxRecoveryRequest recoverRequest) {
    MDCBuilder.buildMdcContext(sdxCluster);
    FlowIdentifier flowIdentifier = sdxReactorFlowManager.triggerDatalakeRuntimeRecoveryFlow(sdxCluster, recoverRequest.getType());
    return new SdxRecoveryResponse(flowIdentifier);
}
Also used : FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) SdxRecoveryResponse(com.sequenceiq.sdx.api.model.SdxRecoveryResponse)

Example 9 with SdxRecoveryResponse

use of com.sequenceiq.sdx.api.model.SdxRecoveryResponse in project cloudbreak by hortonworks.

the class ResizeRecoveryServiceTest method testTriggerRecovertShouldStartFlow.

@Test
public void testTriggerRecovertShouldStartFlow() {
    sdxStatusEntity.setStatus(DatalakeStatusEnum.STOP_FAILED);
    SdxRecoveryResponse sdxRecoveryResponse = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.triggerRecovery(cluster, request));
    verify(sdxReactorFlowManager).triggerSdxStartFlow(cluster);
    assertEquals(flowId, sdxRecoveryResponse.getFlowIdentifier());
}
Also used : SdxRecoveryResponse(com.sequenceiq.sdx.api.model.SdxRecoveryResponse) Test(org.junit.jupiter.api.Test)

Aggregations

SdxRecoveryResponse (com.sequenceiq.sdx.api.model.SdxRecoveryResponse)9 Test (org.junit.jupiter.api.Test)4 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)3 Test (org.junit.Test)3 RecoveryValidationV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.recovery.RecoveryValidationV4Response)2 SdxRecoverableResponse (com.sequenceiq.sdx.api.model.SdxRecoverableResponse)2 com.cloudera.thunderhead.service.datalakedr.datalakeDRProto (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 SdxClusterDetailResponse (com.sequenceiq.sdx.api.model.SdxClusterDetailResponse)1 SdxRecoveryRequest (com.sequenceiq.sdx.api.model.SdxRecoveryRequest)1