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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations