Search in sources :

Example 1 with SdxClusterResponse

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

the class StackRuntimeVersionValidatorTest method createSdxClusterResponse.

private List<SdxClusterResponse> createSdxClusterResponse(String version, SdxClusterStatusResponse status) {
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setRuntime(version);
    sdxClusterResponse.setStatus(status);
    sdxClusterResponse.setName("myDatalake");
    return Collections.singletonList(sdxClusterResponse);
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse)

Example 2 with SdxClusterResponse

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

the class SdxServiceDecorator method prepareMultipleSdxAttributes.

public void prepareMultipleSdxAttributes(Set<StackViewV4Response> stackViewResponses) {
    List<SdxClusterResponse> responses = sdxClientService.list();
    for (StackViewV4Response stackViewResponse : stackViewResponses) {
        Optional<SdxClusterResponse> first = responses.stream().filter(x -> x.getEnvironmentCrn().equals(stackViewResponse.getEnvironmentCrn())).findFirst();
        if (first.isPresent()) {
            SdxClusterResponse sdxCluster = first.get();
            SharedServiceV4Response sharedServiceResponse = stackViewResponse.getCluster().getSharedServiceResponse();
            sharedServiceResponse.setSdxCrn(sdxCluster.getCrn());
            sharedServiceResponse.setSdxName(sdxCluster.getName());
        } else {
            LOGGER.info("No SDX cluster found for stack {}.", stackViewResponse.getCrn());
        }
    }
}
Also used : StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) Inject(javax.inject.Inject) List(java.util.List) SharedServiceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) SdxClientService(com.sequenceiq.cloudbreak.service.datalake.SdxClientService) Service(org.springframework.stereotype.Service) Optional(java.util.Optional) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) SharedServiceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response)

Example 3 with SdxClusterResponse

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

the class SdxCreateAction method action.

@Override
public SdxTestDto action(TestContext testContext, SdxTestDto testDto, SdxClient client) throws Exception {
    Log.when(LOGGER, " SDX endpoint: %s" + client.getDefaultClient().sdxEndpoint() + ", SDX's environment: " + testDto.getRequest().getEnvironment());
    Log.whenJson(LOGGER, " SDX create request: ", testDto.getRequest());
    SdxClusterResponse sdxClusterResponse = client.getDefaultClient().sdxEndpoint().create(testDto.getName(), testDto.getRequest());
    testDto.setFlow("SDX create", sdxClusterResponse.getFlowIdentifier());
    SdxClusterDetailResponse detailedResponse = client.getDefaultClient().sdxEndpoint().getDetailByCrn(sdxClusterResponse.getCrn(), Collections.emptySet());
    testDto.setResponse(detailedResponse);
    Log.whenJson(LOGGER, " SDX create response: ", client.getDefaultClient().sdxEndpoint().get(testDto.getName()));
    return testDto;
}
Also used : SdxClusterDetailResponse(com.sequenceiq.sdx.api.model.SdxClusterDetailResponse) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse)

Example 4 with SdxClusterResponse

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithoutInputs.

@Test
public void testConvertFromEnvAndSdxResponseWithoutInputs() {
    // GIVEN
    SdxClusterResponse sdxClusterResponse = null;
    // WHEN
    TelemetryRequest result = underTest.convert(null, sdxClusterResponse);
    // THEN
    assertNotNull(result.getWorkloadAnalytics());
    assertNotNull(result.getFeatures());
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
    assertNull(result.getLogging());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.Test)

Example 5 with SdxClusterResponse

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithoutWAInput.

@Test
public void testConvertFromEnvAndSdxResponseWithoutWAInput() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    LoggingResponse loggingResponse = new LoggingResponse();
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    loggingResponse.setS3(s3Params);
    response.setLogging(loggingResponse);
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
    sdxClusterResponse.setName("sdxName");
    // WHEN
    TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
    // THEN
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
    assertEquals("sdxId", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.id").toString());
    assertEquals("sdxName", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.name").toString());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.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