Search in sources :

Example 1 with EnvironmentLogging

use of com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging in project cloudbreak by hortonworks.

the class TelemetryApiConverterTest method testConvertToResponse.

@Test
public void testConvertToResponse() {
    // GIVEN
    EnvironmentLogging logging = new EnvironmentLogging();
    S3CloudStorageParameters s3Params = new S3CloudStorageParameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    logging.setS3(s3Params);
    EnvironmentTelemetry telemetry = new EnvironmentTelemetry();
    telemetry.setLogging(logging);
    // WHEN
    TelemetryResponse result = underTest.convert(telemetry);
    // THEN
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
    assertNull(result.getWorkloadAnalytics());
}
Also used : EnvironmentLogging(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) Test(org.junit.jupiter.api.Test)

Example 2 with EnvironmentLogging

use of com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging in project cloudbreak by hortonworks.

the class TelemetryApiConverterTest method testConvertToRequestWithFeatures.

@Test
public void testConvertToRequestWithFeatures() {
    // GIVEN
    EnvironmentLogging logging = new EnvironmentLogging();
    S3CloudStorageParameters s3Params = new S3CloudStorageParameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    logging.setS3(s3Params);
    EnvironmentFeatures features = new EnvironmentFeatures();
    features.addClusterLogsCollection(false);
    features.addMonitoring(true);
    EnvironmentTelemetry telemetry = new EnvironmentTelemetry();
    telemetry.setLogging(logging);
    telemetry.setFeatures(features);
    // WHEN
    TelemetryRequest result = underTest.convertToRequest(telemetry);
    // THEN
    assertNotNull(result.getFeatures());
    assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
Also used : EnvironmentLogging(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) Test(org.junit.jupiter.api.Test)

Example 3 with EnvironmentLogging

use of com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging in project cloudbreak by hortonworks.

the class TelemetryApiConverter method createLoggingFromRequest.

private EnvironmentLogging createLoggingFromRequest(LoggingRequest loggingRequest) {
    EnvironmentLogging logging = null;
    if (loggingRequest != null) {
        logging = new EnvironmentLogging();
        logging.setStorageLocation(loggingRequest.getStorageLocation());
        logging.setS3(convertS3(loggingRequest.getS3()));
        logging.setAdlsGen2(convertAdlsV2(loggingRequest.getAdlsGen2()));
        logging.setGcs(convertGcs(loggingRequest.getGcs()));
        logging.setCloudwatch(CloudwatchParams.copy(loggingRequest.getCloudwatch()));
    }
    return logging;
}
Also used : EnvironmentLogging(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging)

Example 4 with EnvironmentLogging

use of com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging in project cloudbreak by hortonworks.

the class TelemetryApiConverterTest method testConvertToRequest.

@Test
public void testConvertToRequest() {
    // GIVEN
    EnvironmentLogging logging = new EnvironmentLogging();
    S3CloudStorageParameters s3Params = new S3CloudStorageParameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    logging.setS3(s3Params);
    EnvironmentTelemetry telemetry = new EnvironmentTelemetry();
    telemetry.setLogging(logging);
    // WHEN
    TelemetryRequest result = underTest.convertToRequest(telemetry);
    // THEN
    assertNull(result.getFeatures());
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
Also used : EnvironmentLogging(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) Test(org.junit.jupiter.api.Test)

Aggregations

EnvironmentLogging (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging)4 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)3 S3CloudStorageParameters (com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters)3 Test (org.junit.jupiter.api.Test)3 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)1 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)1