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