use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabledGlobally.
@Test
public void testConvertFromEnvAndSdxResponseWithWADisabledGlobally() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
sdxClusterResponse.setName("sdxName");
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, false, true);
// WHEN
TelemetryRequest result = converter.convert(response, sdxClusterResponse);
// THEN
assertNull(result.getWorkloadAnalytics());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithMonitoring.
@Test
public void testConvertFromEnvAndSdxResponseWithMonitoring() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
FeaturesResponse featuresResponse = new FeaturesResponse();
featuresResponse.addMonitoring(true);
response.setFeatures(featuresResponse);
MonitoringResponse monitoringResponse = new MonitoringResponse();
monitoringResponse.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
response.setMonitoring(monitoringResponse);
// WHEN
TelemetryRequest result = underTest.convert(response, null);
// THEN
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenIdentityIsSetToNull.
@Test
void testConvertWhenIdentityIsSetToNull() {
CloudStorageRequest request = new CloudStorageRequest();
request.setIdentities(null);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
assertNotNull(result);
assertEquals(1, result.getIdentities().size());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenCloudStorageLocationsIsEmptyAndEnvironmentHasTelemetryWithLogging.
@Test
void testConvertWhenCloudStorageLocationsIsEmptyAndEnvironmentHasTelemetryWithLogging() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, null, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
assertTrue(result.getLocations().isEmpty());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenEnvironmentHaveTelemetryAndStorageLocationsIsNotNullOrEmpty.
@Test
void testConvertWhenEnvironmentHaveTelemetryAndStorageLocationsIsNotNullOrEmpty() {
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setTelemetry(telemetry);
CloudStorageCdpService eStorageLocationType = CloudStorageCdpService.RANGER_AUDIT;
String eStorageLocationValue = "MYBUCKET/CONTAINER";
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(eStorageLocationType);
storageLocationBase.setValue(eStorageLocationValue);
List<StorageLocationBase> storageLocations = List.of(storageLocationBase);
CloudStorageRequest request = new CloudStorageRequest();
request.setLocations(storageLocations);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
assertTrue(result.getLocations().stream().anyMatch(loc -> eStorageLocationType.equals(loc.getType()) && eStorageLocationValue.equals(loc.getValue())));
}
Aggregations