use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithValidEngDestination.
@Test
void testWithValidEngDestination() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.ENG);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
FeaturesResponse features = new FeaturesResponse();
FeatureSetting featureSetting = new FeatureSetting();
featureSetting.setEnabled(true);
features.setClusterLogsCollection(featureSetting);
telemetry.setFeatures(features);
stackV4Response.setTelemetry(telemetry);
underTest.validate(request, stackV4Response);
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithCloudStorageWithDisabledLogging.
@Test
void testWithCloudStorageWithDisabledLogging() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
stackV4Response.setTelemetry(telemetry);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("Cloud storage logging is disabled for Data Lake"));
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testWithEngDestinationAndDisabledLogCollection.
@Test
void testWithEngDestinationAndDisabledLogCollection() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.ENG);
StackV4Response stackV4Response = new StackV4Response();
stackV4Response.setCrn(DATALAKE_CRN);
TelemetryResponse telemetry = new TelemetryResponse();
stackV4Response.setTelemetry(telemetry);
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
assertTrue(thrown.getMessage().contains("Cluster log collection is not enabled for Data Lake"));
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverter method convert.
public TelemetryResponse convert(Telemetry telemetry) {
TelemetryResponse response = null;
if (freeIpaTelemetryEnabled && telemetry != null) {
response = new TelemetryResponse();
response.setFluentAttributes(telemetry.getFluentAttributes());
response.setLogging(createLoggingResponseFromSource(telemetry.getLogging()));
response.setMonitoring(createMonitoringResponseFromSource(telemetry.getMonitoring()));
response.setFeatures(createFeaturesResponseFromSource(telemetry.getFeatures()));
response.setRules(telemetry.getRules());
}
return response;
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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