use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class StackToStackV4RequestConverter method prepareTelemetryRequest.
private void prepareTelemetryRequest(Stack source, StackV4Request stackV4Request) {
Telemetry telemetry = componentConfigProviderService.getTelemetry(source.getId());
if (telemetry != null) {
TelemetryRequest telemetryRequest = telemetryConverter.convertToRequest(telemetry);
stackV4Request.setTelemetry(telemetryRequest);
}
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest 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.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithoutInputs.
@Test
public void testConvertFromEnvAndSdxResponseWithoutInputs() {
// GIVEN
SdxClusterResponse sdxClusterResponse = null;
// WHEN
TelemetryRequest result = underTest.convert(null, sdxClusterResponse);
// THEN
assertNotNull(result.getWorkloadAnalytics());
assertNotNull(result.getFeatures());
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertNull(result.getLogging());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest 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.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithoutWAInput.
@Test
public void testConvertFromEnvAndSdxResponseWithoutWAInput() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
loggingResponse.setS3(s3Params);
response.setLogging(loggingResponse);
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
sdxClusterResponse.setName("sdxName");
// WHEN
TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
// THEN
assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertEquals("sdxId", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.id").toString());
assertEquals("sdxName", result.getWorkloadAnalytics().getAttributes().get("databus.header.sdx.name").toString());
}
Aggregations