use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenWasbNotNull.
@Test
public void testIsCloudStorageConfiguredWhenWasbNotNull() {
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
storageIdentityBase.setWasb(new WasbCloudStorageV1Parameters());
cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
Assert.assertTrue(actual);
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenCloudStorageNotNull.
@Test
public void testIsCloudStorageConfiguredWhenCloudStorageNotNull() {
boolean actual = underTest.isCloudStorageConfigured(new CloudStorageRequest());
Assert.assertFalse(actual);
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenAdlsNotNull.
@Test
public void testIsCloudStorageConfiguredWhenAdlsNotNull() {
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
storageIdentityBase.setAdls(new AdlsCloudStorageV1Parameters());
cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
Assert.assertTrue(actual);
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverterTest method testConvertWhenCloudStorageConfiguredAndRdsAndLdapAndProxyExistsAnd.
@Test
public void testConvertWhenCloudStorageConfiguredAndRdsAndLdapAndProxyExistsAnd() {
CloudStorageRequest cloudStorageRequest = mock(CloudStorageRequest.class);
when(entitlementService.dataLakeEfsEnabled(anyString())).thenReturn(true);
String rdsConfigName = "rds-name";
String proxyConfigCrn = "proxy-config-resource-crn";
String ldapName = "ldap-name";
FileSystem fileSystem = new FileSystem();
RDSConfig rdsConfig = new RDSConfig();
rdsConfig.setName(rdsConfigName);
ClusterV4Request source = new ClusterV4Request();
source.setCloudStorage(cloudStorageRequest);
source.setDatabases(singleton(rdsConfigName));
source.setProxyConfigCrn(proxyConfigCrn);
source.setBlueprintName(BLUEPRINT);
when(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq(BLUEPRINT), any())).thenReturn(blueprint);
when(cloudStorageValidationUtil.isCloudStorageConfigured(cloudStorageRequest)).thenReturn(true);
when(cloudStorageConverter.requestToFileSystem(cloudStorageRequest)).thenReturn(fileSystem);
when(rdsConfigService.findByNamesInWorkspace(singleton(rdsConfigName), workspace.getId())).thenReturn(singleton(rdsConfig));
Cluster actual = ThreadBasedUserCrnProvider.doAs("crn:cdp:iam:us-west-1:1234:user:1", () -> underTest.convert(source));
assertThat(actual.getFileSystem(), is(fileSystem));
assertThat(actual.getName(), is(source.getName()));
assertThat(actual.getRdsConfigs().size(), is(1));
assertThat(actual.getRdsConfigs().stream().findFirst().get().getName(), is(rdsConfigName));
assertThat(actual.getProxyConfigCrn(), is(proxyConfigCrn));
verify(cloudStorageValidationUtil, times(1)).isCloudStorageConfigured(cloudStorageRequest);
verify(cloudStorageConverter, times(1)).requestToFileSystem(cloudStorageRequest);
verify(rdsConfigService, times(1)).findByNamesInWorkspace(singleton(rdsConfigName), workspace.getId());
}
use of com.sequenceiq.common.api.cloudstorage.CloudStorageRequest in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenIdentityIsSetToNull.
@Test
void testConvertWhenIdentityIsSetToNull() {
CloudStorageRequest request = new CloudStorageRequest();
request.setIdentities(null);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
assertNotNull(result);
assertEquals(1, result.getIdentities().size());
}
Aggregations