Search in sources :

Example 11 with Backup

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()));
}
Also used : BackupRequest(com.sequenceiq.common.api.backup.request.BackupRequest) Backup(com.sequenceiq.freeipa.api.model.Backup) Test(org.junit.jupiter.api.Test)

Example 12 with Backup

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"));
}
Also used : BackupRequest(com.sequenceiq.common.api.backup.request.BackupRequest) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) Backup(com.sequenceiq.freeipa.api.model.Backup) Test(org.junit.jupiter.api.Test)

Example 13 with Backup

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);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Backup(com.sequenceiq.freeipa.api.model.Backup) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 14 with Backup

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);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Backup(com.sequenceiq.freeipa.api.model.Backup) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 15 with Backup

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);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) Backup(com.sequenceiq.freeipa.api.model.Backup) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Aggregations

Backup (com.sequenceiq.freeipa.api.model.Backup)30 Test (org.junit.Test)13 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)12 Test (org.junit.jupiter.api.Test)10 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)7 Logging (com.sequenceiq.common.api.telemetry.model.Logging)7 BackupRequest (com.sequenceiq.common.api.backup.request.BackupRequest)6 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)6 Stack (com.sequenceiq.freeipa.entity.Stack)5 CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)4 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)4 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)4 CreateFreeIpaRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.CreateFreeIpaRequest)4 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)4 StackAuthentication (com.sequenceiq.freeipa.entity.StackAuthentication)4 ImageSettingsRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest)3 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)3 Network (com.sequenceiq.freeipa.entity.Network)3 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 FreeIpaServerRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest)2