Search in sources :

Example 1 with FeaturesResponse

use of com.sequenceiq.common.api.telemetry.response.FeaturesResponse in project cloudbreak by hortonworks.

the class TelemetryConverter method createFeaturesResponseFromSource.

private void createFeaturesResponseFromSource(TelemetryResponse response, Features features) {
    if (features != null) {
        LOGGER.debug("Setting feature telemetry response.");
        FeaturesResponse featuresResponse = new FeaturesResponse();
        featuresResponse.setWorkloadAnalytics(features.getWorkloadAnalytics());
        featuresResponse.setClusterLogsCollection(features.getClusterLogsCollection());
        featuresResponse.setMonitoring(features.getMonitoring());
        featuresResponse.setMetering(features.getMetering());
        featuresResponse.setUseSharedAltusCredential(features.getUseSharedAltusCredential());
        setCloudStorageLoggingOnFeaturesModel(features, featuresResponse);
        response.setFeatures(featuresResponse);
    }
}
Also used : FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse)

Example 2 with FeaturesResponse

use of com.sequenceiq.common.api.telemetry.response.FeaturesResponse 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);
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) Test(org.junit.jupiter.api.Test)

Example 3 with FeaturesResponse

use of com.sequenceiq.common.api.telemetry.response.FeaturesResponse in project cloudbreak by hortonworks.

the class TelemetryConverter method createFeaturesResponseFromSource.

private FeaturesResponse createFeaturesResponseFromSource(Features features) {
    FeaturesResponse featuresResponse = null;
    if (features != null) {
        featuresResponse = new FeaturesResponse();
        featuresResponse.setClusterLogsCollection(features.getClusterLogsCollection());
        featuresResponse.setUseSharedAltusCredential(features.getUseSharedAltusCredential());
        if (features.getCloudStorageLogging() != null) {
            featuresResponse.setCloudStorageLogging(features.getCloudStorageLogging());
        } else {
            featuresResponse.addCloudStorageLogging(true);
        }
        if (features.getMonitoring() != null) {
            featuresResponse.setMonitoring(features.getMonitoring());
        } else {
            featuresResponse.addMonitoring(true);
        }
    }
    return featuresResponse;
}
Also used : FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse)

Example 4 with FeaturesResponse

use of com.sequenceiq.common.api.telemetry.response.FeaturesResponse in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithClusterLogsCollectionEnabled.

@Test
public void testConvertFromEnvAndSdxResponseWithClusterLogsCollectionEnabled() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    FeaturesResponse featuresResponse = new FeaturesResponse();
    featuresResponse.addClusterLogsCollection(true);
    response.setFeatures(featuresResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, null);
    // THEN
    assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) Test(org.junit.Test)

Example 5 with FeaturesResponse

use of com.sequenceiq.common.api.telemetry.response.FeaturesResponse in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithClusterLogsCollectionDisabled.

@Test
public void testConvertFromEnvAndSdxResponseWithClusterLogsCollectionDisabled() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    FeaturesResponse featuresResponse = new FeaturesResponse();
    featuresResponse.addClusterLogsCollection(false);
    response.setFeatures(featuresResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, null);
    // THEN
    assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) Test(org.junit.Test)

Aggregations

FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)12 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)7 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)6 Test (org.junit.Test)5 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)4 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)1 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)1 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)1 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)1 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)1 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)1 MonitoringResponse (com.sequenceiq.common.api.telemetry.response.MonitoringResponse)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)1 Test (org.junit.jupiter.api.Test)1