use of com.sequenceiq.common.api.telemetry.request.LoggingRequest 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.LoggingRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverter method createLoggingRequestFromEnvSource.
private LoggingRequest createLoggingRequestFromEnvSource(EnvironmentLogging logging) {
LoggingRequest loggingRequest = null;
if (logging != null) {
loggingRequest = new LoggingRequest();
loggingRequest.setStorageLocation(logging.getStorageLocation());
loggingRequest.setS3(convertS3(logging.getS3()));
loggingRequest.setAdlsGen2(convertAdlsV2(logging.getAdlsGen2()));
loggingRequest.setGcs(convertGcs(logging.getGcs()));
loggingRequest.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
}
return loggingRequest;
}
use of com.sequenceiq.common.api.telemetry.request.LoggingRequest in project cloudbreak by hortonworks.
the class GcpCloudProvider method loggingRequest.
@Override
public LoggingRequest loggingRequest(TelemetryTestDto dto) {
GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
gcsCloudStorageV1Parameters.setServiceAccountEmail(getServiceAccountEmail());
LoggingRequest loggingRequest = new LoggingRequest();
loggingRequest.setGcs(gcsCloudStorageV1Parameters);
loggingRequest.setStorageLocation(getBaseLocation());
return loggingRequest;
}
use of com.sequenceiq.common.api.telemetry.request.LoggingRequest 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.LoggingRequest in project cloudbreak by hortonworks.
the class LoggingRequestValidatorTest method testValidateValidBasePathUri.
@Test
public void testValidateValidBasePathUri() {
// GIVEN
LoggingRequest loggingRequest = new LoggingRequest();
loggingRequest.setS3(new S3CloudStorageV1Parameters());
loggingRequest.setStorageLocation("s3://basePath/custom");
// WHEN
boolean result = underTest.isValid(loggingRequest, context);
// THEN
assertTrue(result);
}
Aggregations