use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponseWithEnabledClusterLogsCollectionFeatures.
@Test
public void testConvertToResponseWithEnabledClusterLogsCollectionFeatures() {
// GIVEN
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
Features features = new Features();
features.setWorkloadAnalytics(null);
features.addClusterLogsCollection(true);
telemetry.setFeatures(features);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertNull(result.getFeatures().getWorkloadAnalytics());
assertNull(result.getFeatures().getMetering());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertWhenClusterLogCollectionIsDisabledThenItShouldBeFalseInTheResult.
@Test
public void testConvertWhenClusterLogCollectionIsDisabledThenItShouldBeFalseInTheResult() {
ReflectionTestUtils.setField(underTest, "clusterLogsCollection", false);
TelemetryRequest input = new TelemetryRequest();
Telemetry result = underTest.convert(input, StackType.WORKLOAD);
assertNotNull(result);
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToRequestWithEmptyTelemetry.
@Test
public void testConvertToRequestWithEmptyTelemetry() {
// GIVEN
Telemetry telemetry = new Telemetry();
// WHEN
TelemetryRequest result = underTest.convertToRequest(telemetry);
// THEN
assertNotNull(result);
assertNull(result.getLogging());
assertNull(result.getMonitoring());
assertNull(result.getWorkloadAnalytics());
assertNull(result.getFeatures());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponse.
@Test
public void testConvertToResponse() {
// GIVEN
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToRequest.
@Test
public void testConvertToRequest() {
// GIVEN
Telemetry telemetry = new Telemetry();
telemetry.setDatabusEndpoint(DATABUS_ENDPOINT);
Logging logging = new Logging();
logging.setS3(new S3CloudStorageV1Parameters());
telemetry.setLogging(logging);
Monitoring monitoring = new Monitoring();
monitoring.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetry.setMonitoring(monitoring);
Features features = new Features();
features.addClusterLogsCollection(true);
features.addMonitoring(true);
telemetry.setFeatures(features);
WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
Map<String, Object> waAttributes = new HashMap<>();
waAttributes.put("myWAKey", "myWAValue");
workloadAnalytics.setAttributes(waAttributes);
telemetry.setWorkloadAnalytics(workloadAnalytics);
Map<String, Object> fluentAttributes = new HashMap<>();
fluentAttributes.put("myKey", "myValue");
telemetry.setFluentAttributes(fluentAttributes);
// WHEN
TelemetryRequest result = underTest.convertToRequest(telemetry);
// THEN
assertNotNull(result.getLogging().getS3());
assertEquals("myValue", result.getFluentAttributes().get("myKey"));
assertEquals("myWAValue", result.getWorkloadAnalytics().getAttributes().get("myWAKey"));
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
Aggregations