use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryTestDto method withOnlyCloudStorageLogging.
public TelemetryTestDto withOnlyCloudStorageLogging() {
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addClusterLogsCollection(false);
featuresRequest.addWorkloadAnalytics(false);
featuresRequest.addCloudStorageLogging(true);
getRequest().setFeatures(featuresRequest);
return this;
}
use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverter method createFeaturesRequestEnvSource.
private FeaturesRequest createFeaturesRequestEnvSource(EnvironmentFeatures features) {
FeaturesRequest featuresRequest = null;
if (features != null) {
featuresRequest = new FeaturesRequest();
featuresRequest.setClusterLogsCollection(features.getClusterLogsCollection());
featuresRequest.setMonitoring(features.getMonitoring());
setCloudStorageLoggingOnFeaturesModel(features, featuresRequest);
setMonitoringOnFeaturesModel(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());
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addClusterLogsCollection(false);
telemetryRequest.setLogging(logging);
MonitoringRequest monitoringRequest = new MonitoringRequest();
monitoringRequest.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetryRequest.setMonitoring(monitoringRequest);
telemetryRequest.setFeatures(featuresRequest);
// WHEN
Telemetry result = underTest.convert(telemetryRequest);
// THEN
assertThat(result.getFeatures().getWorkloadAnalytics(), nullValue());
assertThat(result.getFeatures().getClusterLogsCollection().isEnabled(), is(false));
assertThat(result.getFeatures().getCloudStorageLogging().isEnabled(), is(true));
assertThat(result.getFeatures().getMonitoring().isEnabled(), is(true));
assertThat(result.getDatabusEndpoint(), is(DATABUS_ENDPOINT));
assertThat(result.getMonitoring().getRemoteWriteUrl(), is(MONITORING_REMOTE_WRITE_URL));
}
use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithDefaultFeatures.
@Test
public void testConvertWithDefaultFeatures() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
FeaturesRequest fr = new FeaturesRequest();
telemetryRequest.setFeatures(fr);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertNull(result.getFeatures().getWorkloadAnalytics());
}
use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvert.
@Test
public void testConvert() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest loggingRequest = new LoggingRequest();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
loggingRequest.setS3(s3Params);
telemetryRequest.setLogging(loggingRequest);
telemetryRequest.setWorkloadAnalytics(new WorkloadAnalyticsRequest());
FeaturesRequest fr = new FeaturesRequest();
fr.addClusterLogsCollection(true);
fr.addWorkloadAnalytics(true);
fr.addMonitoring(true);
telemetryRequest.setFeatures(fr);
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertEquals("http://myaddress/api/v1/receive", result.getMonitoring().getRemoteWriteUrl());
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertTrue(result.getFeatures().getCloudStorageLogging().isEnabled());
}
Aggregations