use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponse.
@Test
public void testConvertToResponse() {
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
Monitoring monitoring = new Monitoring();
monitoring.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
telemetry.setMonitoring(monitoring);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertThat(result.getLogging().getS3().getInstanceProfile(), is(INSTANCE_PROFILE_VALUE));
assertThat(result.getMonitoring().getRemoteWriteUrl(), is(MONITORING_REMOTE_WRITE_URL));
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class BackupConverterTest method testConvertFromS3Request.
@Test
public void testConvertFromS3Request() {
// GIVEN
BackupRequest backupRequest = new BackupRequest();
backupRequest.setS3(new S3CloudStorageV1Parameters());
backupRequest.setStorageLocation("s3://mybucket");
// WHEN
Backup result = underTest.convert(backupRequest);
// THEN
assertThat(result.getStorageLocation(), is("s3://mybucket"));
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class StackToCloudStackConverterTest method testBuildFileSystemViewSameAWSInstanceProfile.
@Test
public void testBuildFileSystemViewSameAWSInstanceProfile() throws Exception {
Telemetry telemetry = mock(Telemetry.class);
Backup backup = mock(Backup.class);
Logging logging = mock(Logging.class);
S3CloudStorageV1Parameters s3Logging = new S3CloudStorageV1Parameters();
s3Logging.setInstanceProfile("arn:aws:iam::id:instance-profile/role");
S3CloudStorageV1Parameters s3Backup = new S3CloudStorageV1Parameters();
s3Backup.setInstanceProfile("arn:aws:iam::id:instance-profile/role");
when(stack.getTelemetry()).thenReturn(telemetry);
when(telemetry.getLogging()).thenReturn(logging);
when(stack.getBackup()).thenReturn(backup);
when(backup.getS3()).thenReturn(s3Backup);
when(logging.getS3()).thenReturn(s3Logging);
Optional<CloudFileSystemView> fileSystemView = underTest.buildFileSystemView(stack);
assertEquals(Optional.empty(), fileSystemView);
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class StackToCloudStackConverterTest method testBuildFileSystemViewDifferentAWSInstanceProfile.
@Test
public void testBuildFileSystemViewDifferentAWSInstanceProfile() throws Exception {
Telemetry telemetry = mock(Telemetry.class);
Backup backup = mock(Backup.class);
Logging logging = mock(Logging.class);
S3CloudStorageV1Parameters s3Logging = new S3CloudStorageV1Parameters();
s3Logging.setInstanceProfile("arn:aws:iam::id:instance-profile/role1");
S3CloudStorageV1Parameters s3Backup = new S3CloudStorageV1Parameters();
s3Backup.setInstanceProfile("arn:aws:iam::id:instance-profile/role2");
when(stack.getTelemetry()).thenReturn(telemetry);
when(telemetry.getLogging()).thenReturn(logging);
when(stack.getBackup()).thenReturn(backup);
when(backup.getS3()).thenReturn(s3Backup);
when(logging.getS3()).thenReturn(s3Logging);
expectedException.expect(BadRequestException.class);
underTest.buildFileSystemView(stack);
}
use of com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters in project cloudbreak by hortonworks.
the class LoggingRequestValidatorTest method testValidateValidBasePathUri.
@Test
public void testValidateValidBasePathUri() {
// GIVEN
LoggingRequest loggingRequest = new LoggingRequest();
loggingRequest.setS3(new S3CloudStorageV1Parameters());
loggingRequest.setStorageLocation("s3://basePath/custom");
// WHEN
boolean result = underTest.isValid(loggingRequest, context);
// THEN
assertTrue(result);
}
Aggregations