use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequest.
@Test
public void testConvertFromRequest() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest logging = new LoggingRequest();
logging.setS3(new S3CloudStorageV1Parameters());
WorkloadAnalyticsRequest workloadAnalyticsRequest = new WorkloadAnalyticsRequest();
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addClusterLogsCollection(false);
featuresRequest.addMonitoring(true);
featuresRequest.addCloudStorageLogging(false);
telemetryRequest.setLogging(logging);
telemetryRequest.setFeatures(featuresRequest);
telemetryRequest.setWorkloadAnalytics(workloadAnalyticsRequest);
// WHEN
Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
// THEN
assertNotNull(result.getFeatures().getWorkloadAnalytics());
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
assertFalse(result.getFeatures().getCloudStorageLogging().isEnabled());
assertTrue(result.getFeatures().getMetering().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
assertEquals(DATABUS_ENDPOINT, result.getDatabusEndpoint());
assertEquals(DATABUS_ENDPOINT, result.getWorkloadAnalytics().getDatabusEndpoint());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequestWithDefaultFeatures.
@Test
public void testConvertFromRequestWithDefaultFeatures() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
// WHEN
Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
// THEN
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getMetering().isEnabled());
assertTrue(result.getFeatures().getCloudStorageLogging().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertWhenWorkloadAnalyticsIsNotNullThenItsAttributesShouldBePassed.
@Test
public void testConvertWhenWorkloadAnalyticsIsNotNullThenItsAttributesShouldBePassed() {
WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
workloadAnalytics.setDatabusEndpoint(DATABUS_ENDPOINT);
workloadAnalytics.setAttributes(Map.of("someAttributeKey", "someOtherStuffForValue"));
Telemetry input = new Telemetry();
input.setWorkloadAnalytics(workloadAnalytics);
TelemetryResponse response = underTest.convert(input);
assertNotNull(response);
assertNotNull(response.getWorkloadAnalytics());
assertEquals(input.getWorkloadAnalytics().getAttributes(), response.getWorkloadAnalytics().getAttributes());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequestWithAttributes.
@Test
public void testConvertFromRequestWithAttributes() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
Map<String, Object> fluentAttributes = new HashMap<>();
fluentAttributes.put("myAttrKey", "myAttrValue");
telemetryRequest.setFluentAttributes(fluentAttributes);
// WHEN
Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
// THEN
assertEquals(1, result.getFluentAttributes().size());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequestWithFeatures.
@Test
public void testConvertFromRequestWithFeatures() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
FeaturesRequest features = new FeaturesRequest();
features.addClusterLogsCollection(true);
telemetryRequest.setFeatures(features);
// WHEN
Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
// THEN
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getMetering().isEnabled());
}
Aggregations