Search in sources :

Example 16 with SdxClusterResponse

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

the class SdxPollerProviderTest method getSdxResponse.

private SdxClusterResponse getSdxResponse(SdxClusterStatusResponse status, String name) {
    SdxClusterResponse stack1 = new SdxClusterResponse();
    stack1.setStatus(status);
    stack1.setName(name);
    stack1.setCrn(name);
    stack1.setStatusReason("reason");
    return stack1;
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse)

Example 17 with SdxClusterResponse

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

the class SdxPollerProviderTest method testStartDatalakePoller.

@ParameterizedTest
@MethodSource("datalakeStartStatuses")
void testStartDatalakePoller(SdxClusterStatusResponse s1Status, SdxClusterStatusResponse s2Status, AttemptState attemptState, String message, List<String> remaining) throws Exception {
    List<String> pollingCrn = new ArrayList<>();
    pollingCrn.add("crn1");
    pollingCrn.add("crn2");
    SdxClusterResponse sdx1 = getSdxResponse(s1Status, "crn1");
    SdxClusterResponse sdx2 = getSdxResponse(s2Status, "crn2");
    when(sdxService.getByCrn("crn1")).thenReturn(sdx1);
    when(sdxService.getByCrn("crn2")).thenReturn(sdx2);
    AttemptResult<Void> result = underTest.startSdxClustersPoller(ENV_ID, pollingCrn).process();
    assertEquals(attemptState, result.getState());
}
Also used : ArrayList(java.util.ArrayList) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 18 with SdxClusterResponse

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

the class DataLakeStatusCheckerServiceTest method testValidateRunningStateShouldThrowExceptionWhenTheSdxIsInUpgradeState.

@Test(expected = BadRequestException.class)
public void testValidateRunningStateShouldThrowExceptionWhenTheSdxIsInUpgradeState() {
    Stack stack = createStack();
    List<SdxClusterResponse> sdxClusterResponses = createSdxResponse(SdxClusterStatusResponse.DATALAKE_UPGRADE_IN_PROGRESS, "Upgrading");
    when(sdxClientService.getByEnvironmentCrn(ENVIRONMENT_CRN)).thenReturn(sdxClusterResponses);
    underTest.validateRunningState(stack);
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 19 with SdxClusterResponse

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

the class DataLakeStatusCheckerServiceTest method testValidateRunningStateShouldNotThrowExceptionWhenTheSdxIsInRunningState.

@Test
public void testValidateRunningStateShouldNotThrowExceptionWhenTheSdxIsInRunningState() {
    Stack stack = createStack();
    List<SdxClusterResponse> sdxClusterResponses = createSdxResponse(SdxClusterStatusResponse.RUNNING, "Running");
    when(sdxClientService.getByEnvironmentCrn(ENVIRONMENT_CRN)).thenReturn(sdxClusterResponses);
    underTest.validateRunningState(stack);
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 20 with SdxClusterResponse

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

the class SdxConverterTest method testGetSharedServiceWhenSdxIsRunning.

@Test
public void testGetSharedServiceWhenSdxIsRunning() {
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setName("some-sdx");
    sdxClusterResponse.setStatus(SdxClusterStatusResponse.RUNNING);
    SharedServiceV4Request sdxRequest = underTest.getSharedService(sdxClusterResponse);
    Assertions.assertEquals("some-sdx", sdxRequest.getDatalakeName());
}
Also used : SharedServiceV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.sharedservice.SharedServiceV4Request) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.jupiter.api.Test)

Aggregations

SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)54 Test (org.junit.jupiter.api.Test)22 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)13 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)12 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)10 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)8 Test (org.junit.Test)8 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)7 ArrayList (java.util.ArrayList)7 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)5 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 SdxClientService (com.sequenceiq.cloudbreak.service.datalake.SdxClientService)4 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)4 CompactRegionResponse (com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse)4 Set (java.util.Set)4 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)3 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)3