use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.
the class TelemetryApiConverter method convertGcs.
private GcsCloudStorageV1Parameters convertGcs(GcsCloudStorageV1Parameters gcs) {
GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = null;
if (gcs != null) {
gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
gcsCloudStorageV1Parameters.setServiceAccountEmail(gcs.getServiceAccountEmail());
}
return gcsCloudStorageV1Parameters;
}
use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.
the class CloudBackupFolderResolverServiceTest method testUpdateStorageLocationGcs.
@Test
public void testUpdateStorageLocationGcs() {
// GIVEN
Backup backup = createBackup();
backup.setS3(null);
backup.setGcs(new GcsCloudStorageV1Parameters());
backup.setStorageLocation("gs://mybucket");
// WHEN
underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345");
// THEN
assertEquals("gs://mybucket/cluster-backups/freeipa/mycluster_12345", backup.getStorageLocation());
}
use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.
the class StackToCloudStackConverterTest method testBuildFileSystemViewDifferentGCPEmail.
@Test
public void testBuildFileSystemViewDifferentGCPEmail() throws Exception {
Telemetry telemetry = mock(Telemetry.class);
Backup backup = mock(Backup.class);
Logging logging = mock(Logging.class);
GcsCloudStorageV1Parameters gcsLogging = new GcsCloudStorageV1Parameters();
gcsLogging.setServiceAccountEmail("myaccount1@myprojectid.iam.gserviceaccount.com");
GcsCloudStorageV1Parameters gcsBackup = new GcsCloudStorageV1Parameters();
gcsBackup.setServiceAccountEmail("myaccount2@myprojectid.iam.gserviceaccount.com");
when(stack.getTelemetry()).thenReturn(telemetry);
when(telemetry.getLogging()).thenReturn(logging);
when(stack.getBackup()).thenReturn(backup);
when(backup.getGcs()).thenReturn(gcsBackup);
when(logging.getGcs()).thenReturn(gcsLogging);
expectedException.expect(BadRequestException.class);
underTest.buildFileSystemView(stack);
}
use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.
the class StackToCloudStackConverterTest method testBuildFileSystemViewSameGCPEmail.
@Test
public void testBuildFileSystemViewSameGCPEmail() throws Exception {
Telemetry telemetry = mock(Telemetry.class);
Backup backup = mock(Backup.class);
Logging logging = mock(Logging.class);
GcsCloudStorageV1Parameters gcsLogging = new GcsCloudStorageV1Parameters();
gcsLogging.setServiceAccountEmail("myaccount@myprojectid.iam.gserviceaccount.com");
GcsCloudStorageV1Parameters gcsBackup = new GcsCloudStorageV1Parameters();
gcsBackup.setServiceAccountEmail("myaccount@myprojectid.iam.gserviceaccount.com");
when(stack.getTelemetry()).thenReturn(telemetry);
when(telemetry.getLogging()).thenReturn(logging);
when(stack.getBackup()).thenReturn(backup);
when(backup.getGcs()).thenReturn(gcsBackup);
when(logging.getGcs()).thenReturn(gcsLogging);
Optional<CloudFileSystemView> fileSystemView = underTest.buildFileSystemView(stack);
assertEquals(Optional.empty(), fileSystemView);
}
use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequestForGCS.
@Test
public void testConvertFromRequestForGCS() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
LoggingRequest logging = new LoggingRequest();
GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
gcsCloudStorageV1Parameters.setServiceAccountEmail(EMAIL);
logging.setGcs(gcsCloudStorageV1Parameters);
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addClusterLogsCollection(false);
telemetryRequest.setLogging(logging);
telemetryRequest.setFeatures(featuresRequest);
// WHEN
Telemetry result = underTest.convert(telemetryRequest);
// THEN
assertThat(result.getFeatures().getWorkloadAnalytics(), nullValue());
assertThat(result.getFeatures().getClusterLogsCollection().isEnabled(), is(false));
assertThat(result.getDatabusEndpoint(), is(DATABUS_ENDPOINT));
assertThat(result.getLogging().getGcs(), notNullValue());
assertThat(result.getLogging().getGcs().getServiceAccountEmail(), is(EMAIL));
}
Aggregations