Search in sources :

Example 6 with SdxClusterResponse

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithDefaultDisabled.

@Test
public void testConvertFromEnvAndSdxResponseWithDefaultDisabled() {
    // GIVEN
    SdxClusterResponse sdxClusterResponse = null;
    AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, false, "", null);
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, null, null);
    ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
    MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
    monitoringConfig.setEnabled(true);
    TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
    TelemetryConverter converter = new TelemetryConverter(telemetryConfiguration, true, false);
    // WHEN
    TelemetryRequest result = converter.convert(null, sdxClusterResponse);
    // THEN
    assertNull(result.getWorkloadAnalytics());
    assertNull(result.getFeatures().getMonitoring());
    assertNotNull(result.getFeatures());
    assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
Also used : MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) TelemetryConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) AltusDatabusConfiguration(com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration) MonitoringConfiguration(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfiguration) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) ClusterLogsCollectionConfiguration(com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration) Test(org.junit.Test)

Example 7 with SdxClusterResponse

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWAEnabled.

@Test
public void testConvertFromEnvAndSdxResponseWithWAEnabled() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    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("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) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.Test)

Example 8 with SdxClusterResponse

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

the class SdxPollerServiceTest method testGetExecuteSdxOperationsAndGetCrnsWhenOneSkipedAndOneNot.

@Test
public void testGetExecuteSdxOperationsAndGetCrnsWhenOneSkipedAndOneNot() {
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setStatus(SdxClusterStatusResponse.RUNNING);
    sdxClusterResponse.setCrn("crn");
    SdxClusterResponse sdxClusterResponse1 = new SdxClusterResponse();
    sdxClusterResponse1.setStatus(SdxClusterStatusResponse.STOPPED);
    sdxClusterResponse1.setCrn("crn1");
    when(sdxService.list(ENV_NAME)).thenReturn(List.of(sdxClusterResponse, sdxClusterResponse1));
    List<String> actual = underTest.getExecuteSdxOperationsAndGetCrns(ENV_NAME, consumer, Set.of(SdxClusterStatusResponse.STOPPED));
    verify(consumer).accept("crn");
    verify(consumer, never()).accept("crn1");
    Assertions.assertEquals(2, actual.size());
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.jupiter.api.Test)

Example 9 with SdxClusterResponse

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

the class SdxPollerServiceTest method testGetExecuteSdxOperationsAndGetCrnsWhenShouldNotSkipTheConsumer.

@Test
public void testGetExecuteSdxOperationsAndGetCrnsWhenShouldNotSkipTheConsumer() {
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setStatus(SdxClusterStatusResponse.RUNNING);
    sdxClusterResponse.setCrn("crn");
    when(sdxService.list(ENV_NAME)).thenReturn(List.of(sdxClusterResponse));
    List<String> actual = underTest.getExecuteSdxOperationsAndGetCrns(ENV_NAME, consumer, Set.of(SdxClusterStatusResponse.STOPPED));
    verify(consumer).accept(any());
    Assertions.assertEquals(1, actual.size());
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.jupiter.api.Test)

Example 10 with SdxClusterResponse

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

the class LoadBalancerPollerServiceTest method setupDatalakeResponse.

private void setupDatalakeResponse() {
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setName(DL_NAME);
    when(sdxService.list(ENV_NAME)).thenReturn(List.of(sdxClusterResponse));
}
Also used : SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse)

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