Search in sources :

Example 1 with S3CloudStorageParameters

use of com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters 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 S3CloudStorageParameters

use of com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters 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 S3CloudStorageParameters

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

the class EnvironmentBackupStorageConfigurationValidatorTest method validateBackupStorageConfigS3WhenConfigValidationSuccess.

@Test
public void validateBackupStorageConfigS3WhenConfigValidationSuccess() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.AWS);
    when(environment.getBackup()).thenReturn(backup);
    S3CloudStorageParameters s3 = new S3CloudStorageParameters();
    s3.setInstanceProfile("arn:aws:iam::1234567:instance-profile/test");
    when(backup.getS3()).thenReturn(s3);
    ValidationResult result = underTest.validateBackupStorageConfiguration(environment);
    assertFalse(result.hasError());
}
Also used : S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Example 4 with S3CloudStorageParameters

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

the class EnvironmentBackupStorageConfigurationValidatorTest method validateBackupStorageConfigS3WhenConfigValidationFailed.

@Test
public void validateBackupStorageConfigS3WhenConfigValidationFailed() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.AWS);
    when(environment.getBackup()).thenReturn(backup);
    S3CloudStorageParameters s3 = new S3CloudStorageParameters();
    s3.setInstanceProfile("arn:aws:iam::1234567:instance1-profile/test");
    when(backup.getS3()).thenReturn(s3);
    ValidationResult result = underTest.validateBackupStorageConfiguration(environment);
    assertTrue(result.hasError());
}
Also used : S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Example 5 with S3CloudStorageParameters

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

the class EnvironmentLogStorageConfigurationValidatorTest method validateTelemetryStorageConfigS3WhenConfigValidationSuccess.

@Test
public void validateTelemetryStorageConfigS3WhenConfigValidationSuccess() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.AWS);
    when(environment.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    S3CloudStorageParameters s3 = new S3CloudStorageParameters();
    s3.setInstanceProfile("arn:aws:iam::1234567:instance-profile/test");
    when(logging.getS3()).thenReturn(s3);
    ValidationResult result = underTest.validateTelemetryLoggingStorageConfiguration(environment);
    assertFalse(result.hasError());
}
Also used : S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Aggregations

S3CloudStorageParameters (com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters)13 Test (org.junit.jupiter.api.Test)11 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)8 EnvironmentLogging (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging)3 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)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