use of com.sequenceiq.freeipa.api.model.Backup in project cloudbreak by hortonworks.
the class BackupConverterTest method testConvertFromNullS3Request.
@Test
public void testConvertFromNullS3Request() {
// GIVEN
BackupRequest backupRequest = null;
// WHEN
Backup result = underTest.convert(backupRequest);
// THEN
assertThat(result, is(IsNull.nullValue()));
}
use of com.sequenceiq.freeipa.api.model.Backup in project cloudbreak by hortonworks.
the class BackupConverterTest method testConvertFromAzureRequest.
@Test
public void testConvertFromAzureRequest() {
// GIVEN
BackupRequest backupRequest = new BackupRequest();
AdlsGen2CloudStorageV1Parameters adlsGen2CloudStorageV1Parameters = new AdlsGen2CloudStorageV1Parameters();
adlsGen2CloudStorageV1Parameters.setAccountKey("someaccount");
backupRequest.setAdlsGen2(adlsGen2CloudStorageV1Parameters);
backupRequest.setStorageLocation("abfs://mybucket@someaccount");
// WHEN
Backup result = underTest.convert(backupRequest);
// THEN
assertThat(result.getStorageLocation(), is("abfs://mybucket@someaccount"));
}
use of com.sequenceiq.freeipa.api.model.Backup 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.freeipa.api.model.Backup 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.freeipa.api.model.Backup in project cloudbreak by hortonworks.
the class StackToCloudStackConverterTest method testBuildFileSystemViewSameAzureManagedIdentity.
@Test
public void testBuildFileSystemViewSameAzureManagedIdentity() throws Exception {
Telemetry telemetry = mock(Telemetry.class);
Backup backup = mock(Backup.class);
Logging logging = mock(Logging.class);
AdlsGen2CloudStorageV1Parameters adlsGen2Logging = new AdlsGen2CloudStorageV1Parameters();
adlsGen2Logging.setManagedIdentity("/subscriptions/id/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity");
AdlsGen2CloudStorageV1Parameters adlsGen2Backup = new AdlsGen2CloudStorageV1Parameters();
adlsGen2Backup.setManagedIdentity("/subscriptions/id/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity");
when(stack.getTelemetry()).thenReturn(telemetry);
when(telemetry.getLogging()).thenReturn(logging);
when(stack.getBackup()).thenReturn(backup);
when(backup.getAdlsGen2()).thenReturn(adlsGen2Logging);
when(logging.getAdlsGen2()).thenReturn(adlsGen2Backup);
Optional<CloudFileSystemView> fileSystemView = underTest.buildFileSystemView(stack);
assertEquals(Optional.empty(), fileSystemView);
}
Aggregations