Search in sources :

Example 16 with S3CloudStorageV1Parameters

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

Example 17 with S3CloudStorageV1Parameters

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

Example 18 with S3CloudStorageV1Parameters

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);
}
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 19 with S3CloudStorageV1Parameters

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);
}
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 20 with S3CloudStorageV1Parameters

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);
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) Test(org.junit.jupiter.api.Test)

Aggregations

S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)59 Test (org.junit.jupiter.api.Test)27 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)16 Logging (com.sequenceiq.common.api.telemetry.model.Logging)15 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)12 Test (org.junit.Test)12 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)10 SdxCloudStorageRequest (com.sequenceiq.sdx.api.model.SdxCloudStorageRequest)10 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)8 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)8 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)7 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)7 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)7 Backup (com.sequenceiq.freeipa.api.model.Backup)7 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)5 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)5 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)5 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)4 Features (com.sequenceiq.common.api.telemetry.model.Features)4 SdxClusterRequest (com.sequenceiq.sdx.api.model.SdxClusterRequest)4