Search in sources :

Example 11 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class StorageValidationServiceTest method whenGcsConfiguredWithoutRoleShouldThrowException.

@Test
public void whenGcsConfiguredWithoutRoleShouldThrowException() {
    SdxCloudStorageRequest cloudStorageRequest = new SdxCloudStorageRequest();
    cloudStorageRequest.setBaseLocation("gs://example-path");
    cloudStorageRequest.setFileSystemType(FileSystemType.GCS);
    GcsCloudStorageV1Parameters gcs = new GcsCloudStorageV1Parameters();
    gcs.setServiceAccountEmail(null);
    cloudStorageRequest.setGcs(gcs);
    Assertions.assertThrows(BadRequestException.class, () -> underTest.validateCloudStorage("GCP", cloudStorageRequest));
}
Also used : SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.jupiter.api.Test)

Example 12 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class EnvironmentBackupStorageConfigurationValidatorTest method validateBackupStorageConfigGcpWhenConfigValidationSuccess.

@Test
public void validateBackupStorageConfigGcpWhenConfigValidationSuccess() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.GCP);
    when(environment.getBackup()).thenReturn(backup);
    GcsCloudStorageV1Parameters gcp = new GcsCloudStorageV1Parameters();
    gcp.setServiceAccountEmail("admin1@dev-cdp.iam.gserviceaccount.com");
    when(backup.getGcs()).thenReturn(gcp);
    ValidationResult result = underTest.validateBackupStorageConfiguration(environment);
    assertFalse(result.hasError());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.jupiter.api.Test)

Example 13 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class EnvironmentLogStorageConfigurationValidatorTest method validateTelemetryStorageConfigGcpWhenConfigValidationFailed.

@Test
public void validateTelemetryStorageConfigGcpWhenConfigValidationFailed() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.GCP);
    when(environment.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    GcsCloudStorageV1Parameters gcp = new GcsCloudStorageV1Parameters();
    gcp.setServiceAccountEmail("admin1@dev-cdp.iam.gservice-account.com");
    when(logging.getGcs()).thenReturn(gcp);
    ValidationResult result = underTest.validateTelemetryLoggingStorageConfiguration(environment);
    assertTrue(result.hasError());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.jupiter.api.Test)

Example 14 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class EnvironmentLogStorageConfigurationValidatorTest method validateTelemetryStorageConfigGcpWhenConfigValidationSuccess.

@Test
public void validateTelemetryStorageConfigGcpWhenConfigValidationSuccess() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.GCP);
    when(environment.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    GcsCloudStorageV1Parameters gcp = new GcsCloudStorageV1Parameters();
    gcp.setServiceAccountEmail("admin1@dev-cdp.iam.gserviceaccount.com");
    when(logging.getGcs()).thenReturn(gcp);
    ValidationResult result = underTest.validateTelemetryLoggingStorageConfiguration(environment);
    assertFalse(result.hasError());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.jupiter.api.Test)

Example 15 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenGcsNotNull.

@Test
public void testIsCloudStorageConfiguredWhenGcsNotNull() {
    CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setGcs(new GcsCloudStorageV1Parameters());
    cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
    cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
    boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
    Assert.assertTrue(actual);
}
Also used : CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.Test)

Aggregations

GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)31 Test (org.junit.jupiter.api.Test)12 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)10 Logging (com.sequenceiq.common.api.telemetry.model.Logging)7 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)7 Test (org.junit.Test)7 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)6 SdxCloudStorageRequest (com.sequenceiq.sdx.api.model.SdxCloudStorageRequest)4 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)3 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)3 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)3 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)3 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)3 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)3 Backup (com.sequenceiq.freeipa.api.model.Backup)3 FileSystemV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.FileSystemV4Endpoint)2 FileSystemParameterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Response)2 FileSystemParameterV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Responses)2 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)2 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)2