use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryConverter method createFeaturesRequestFromSource.
private FeaturesRequest createFeaturesRequestFromSource(Telemetry telemetry) {
FeaturesRequest featuresRequest = null;
Features features = telemetry.getFeatures();
if (features != null) {
featuresRequest = new FeaturesRequest();
featuresRequest.setWorkloadAnalytics(features.getWorkloadAnalytics());
featuresRequest.setClusterLogsCollection(features.getClusterLogsCollection());
featuresRequest.setMonitoring(features.getMonitoring());
setCloudStorageLoggingOnFeaturesModel(features, featuresRequest);
}
return featuresRequest;
}
use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest 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.request.FeaturesRequest 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());
}
use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithDisabledMonitoringFeatureWithCdpSaas.
@Test
public void testConvertWithDisabledMonitoringFeatureWithCdpSaas() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addMonitoring(false);
telemetryRequest.setFeatures(featuresRequest);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertFalse(result.getFeatures().getMonitoring().isEnabled());
assertNotNull(result.getMonitoring().getRemoteWriteUrl());
}
use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithWADisabled.
@Test
public void testConvertWithWADisabled() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
FeaturesRequest fr = new FeaturesRequest();
fr.addWorkloadAnalytics(false);
telemetryRequest.setFeatures(fr);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
Aggregations