use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class AccountTelemetryConverter method convertFeatures.
public Features convertFeatures(FeaturesRequest request) {
Features features = null;
if (request != null) {
features = new Features();
features.setClusterLogsCollection(request.getClusterLogsCollection());
features.setMonitoring(request.getMonitoring());
features.setWorkloadAnalytics(request.getWorkloadAnalytics());
}
return features;
}
use of com.sequenceiq.common.api.telemetry.model.Features 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.Features 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());
}
use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testValidateWithValidEngDestination.
@Test
void testValidateWithValidEngDestination() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.ENG);
Telemetry telemetry = new Telemetry();
Features features = new Features();
FeatureSetting clusterLogsCollection = new FeatureSetting();
clusterLogsCollection.setEnabled(true);
features.setClusterLogsCollection(clusterLogsCollection);
telemetry.setFeatures(features);
underTest.validate(request, createStack(), telemetry);
}
use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.
the class FluentConfigServiceTest method setClusterLogsCollection.
private void setClusterLogsCollection(Telemetry telemetry) {
Features features = new Features();
features.addClusterLogsCollection(true);
telemetry.setFeatures(features);
}
Aggregations