Search in sources :

Example 1 with SdxRecoveryRequest

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

the class SdxUpgradeRecoveryServiceTest method setup.

@BeforeEach
public void setup() {
    request = new SdxRecoveryRequest();
    request.setType(SdxRecoveryType.RECOVER_WITHOUT_DATA);
    when(cluster.getClusterName()).thenReturn(CLUSTER_NAME);
}
Also used : SdxRecoveryRequest(com.sequenceiq.sdx.api.model.SdxRecoveryRequest) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with SdxRecoveryRequest

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

the class SdxRecoveryAction method action.

@Override
public SdxTestDto action(TestContext testContext, SdxTestDto testDto, SdxClient client) throws Exception {
    SdxRecoveryRequest recoveryRequest = testDto.getSdxRecoveryRequest();
    Log.when(LOGGER, " SDX endpoint: %s" + client.getDefaultClient().sdxEndpoint() + ", SDX's environment: " + testDto.getRequest().getEnvironment());
    Log.whenJson(LOGGER, " SDX recovery request: ", recoveryRequest);
    SdxRecoveryResponse recoveryResponse = client.getDefaultClient().sdxRecoveryEndpoint().recoverClusterByName(testDto.getName(), recoveryRequest);
    testDto.setFlow("SDX recovery", recoveryResponse.getFlowIdentifier());
    SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetail(testDto.getName(), Collections.emptySet());
    testDto.setResponse(detailedResponse);
    Log.whenJson(LOGGER, " SDX recovery response: ", detailedResponse);
    return testDto;
}
Also used : SdxRecoveryRequest(com.sequenceiq.sdx.api.model.SdxRecoveryRequest) SdxClusterDetailResponse(com.sequenceiq.sdx.api.model.SdxClusterDetailResponse) SdxRecoveryResponse(com.sequenceiq.sdx.api.model.SdxRecoveryResponse)

Example 3 with SdxRecoveryRequest

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

the class SdxRecoverySelectorServiceTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    sdxRecoverySelectorService = new SdxRecoverySelectorService(List.of(mockResizeRecoveryService, mockSdxUpgradeRecoveryService));
    request = new SdxRecoveryRequest();
}
Also used : SdxRecoveryRequest(com.sequenceiq.sdx.api.model.SdxRecoveryRequest) Before(org.junit.Before)

Example 4 with SdxRecoveryRequest

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

the class SdxRecoverySelectorServiceTest method testNoValidRecoveryTrigger.

@Test
public void testNoValidRecoveryTrigger() {
    SdxRecoverableResponse nonrecoverableResponse2 = new SdxRecoverableResponse("Some non reason2", RecoveryStatus.NON_RECOVERABLE);
    SdxRecoveryRequest request = new SdxRecoveryRequest();
    when(mockResizeRecoveryService.validateRecovery(cluster, request)).thenReturn(nonrecoverableResponse);
    when(mockSdxUpgradeRecoveryService.validateRecovery(cluster, request)).thenReturn(nonrecoverableResponse2);
    BadRequestException result = assertThrows(BadRequestException.class, () -> sdxRecoverySelectorService.triggerRecovery(cluster, request));
    Mockito.verify(mockResizeRecoveryService).validateRecovery(cluster, request);
    Mockito.verify(mockSdxUpgradeRecoveryService).validateRecovery(cluster, request);
    Mockito.verify(mockSdxUpgradeRecoveryService, never()).triggerRecovery(cluster, request);
    Mockito.verify(mockSdxUpgradeRecoveryService, never()).triggerRecovery(cluster, request);
    assertNotNull(result);
    assertEquals(33, result.getMessage().length(), result.getMessage());
}
Also used : SdxRecoverableResponse(com.sequenceiq.sdx.api.model.SdxRecoverableResponse) SdxRecoveryRequest(com.sequenceiq.sdx.api.model.SdxRecoveryRequest) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.Test)

Example 5 with SdxRecoveryRequest

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

the class ResizeRecoveryServiceTest method setup.

@BeforeEach
public void setup() {
    request = new SdxRecoveryRequest();
    request.setType(SdxRecoveryType.RECOVER_WITHOUT_DATA);
    lenient().when(sdxStatusService.getActualStatusForSdx(cluster)).thenReturn(sdxStatusEntity);
    lenient().when(entitlementService.isDatalakeResizeRecoveryEnabled(anyString())).thenReturn(true);
    lenient().when(sdxReactorFlowManager.triggerSdxStartFlow(cluster)).thenReturn(flowId);
    lenient().when(cluster.getClusterName()).thenReturn("new");
    sdxStatusEntity.setStatusReason("");
}
Also used : SdxRecoveryRequest(com.sequenceiq.sdx.api.model.SdxRecoveryRequest) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SdxRecoveryRequest (com.sequenceiq.sdx.api.model.SdxRecoveryRequest)5 BeforeEach (org.junit.jupiter.api.BeforeEach)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 SdxClusterDetailResponse (com.sequenceiq.sdx.api.model.SdxClusterDetailResponse)1 SdxRecoverableResponse (com.sequenceiq.sdx.api.model.SdxRecoverableResponse)1 SdxRecoveryResponse (com.sequenceiq.sdx.api.model.SdxRecoveryResponse)1 Before (org.junit.Before)1 Test (org.junit.Test)1