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);
}
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;
}
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();
}
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());
}
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("");
}
Aggregations