use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class GatewayManifesterTest method prepareGatewayWhenRequestedHasNullValueForGatewayShouldReturnWithFullGateConfig.
@Test
void prepareGatewayWhenRequestedHasNullValueForGatewayShouldReturnWithFullGateConfig() {
StackV4Request stackV4Request = new StackV4Request();
stackV4Request.setCluster(new ClusterV4Request());
StackV4Request result = underTest.configureGatewayForSdxCluster(stackV4Request);
isTrue(result.getCluster() != null);
isTrue(result.getCluster().getGateway() != null);
isTrue(result.getCluster().getGateway().getSsoType().equals(SSOType.SSO_PROVIDER_FROM_UMS));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenCloudStorageAndLoggingDisabled.
@Test
public void whenCloudStorageAndLoggingDisabled() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
clusterV4Request.setBlueprintName(exampleBlueprintName);
CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(new DetailedEnvironmentResponse(), clusterV4Request, null, new SdxClusterRequest());
assertNull(cloudStorageConfigReq);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenCloudStorageEnabledFromInternalRequest.
@Test
public void whenCloudStorageEnabledFromInternalRequest() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
clusterV4Request.setBlueprintName(exampleBlueprintName);
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(CloudStorageCdpService.RANGER_AUDIT);
storageLocationBase.setValue("s3a://ranger-audit");
cloudStorageRequest.setLocations(List.of(storageLocationBase));
clusterV4Request.setCloudStorage(cloudStorageRequest);
CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(new DetailedEnvironmentResponse(), clusterV4Request, null, new SdxClusterRequest());
assertEquals(CloudStorageCdpService.RANGER_AUDIT, cloudStorageConfigReq.getLocations().get(0).getType());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentityForGCS.
@Test
public void whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentityForGCS() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setCloudPlatform("GCP");
TelemetryResponse telemetryResponse = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
gcsCloudStorageV1Parameters.setServiceAccountEmail(EMAIL);
loggingResponse.setGcs(gcsCloudStorageV1Parameters);
telemetryResponse.setLogging(loggingResponse);
environment.setTelemetry(telemetryResponse);
ClusterV4Request clusterV4Request = new ClusterV4Request();
clusterV4Request.setBlueprintName(exampleBlueprintName);
CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest());
assertEquals(1, cloudStorageConfigReq.getIdentities().size());
assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.LOG)).collect(Collectors.toSet()).size());
assertEquals(EMAIL, cloudStorageConfigReq.getIdentities().get(0).getGcs().getServiceAccountEmail());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenConfigIsProvidedReturnFileSystemParameters.
@Test
public void whenConfigIsProvidedReturnFileSystemParameters() {
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
mockFileSystemResponseForCloudbreakClient();
SdxCluster sdxCluster = new SdxCluster();
SdxClusterRequest sdxClusterRequest = new SdxClusterRequest();
sdxCluster.setInitiatorUserCrn(USER_CRN);
sdxCluster.setClusterName("sdx-cluster");
SdxCloudStorageRequest cloudStorageRequest = new SdxCloudStorageRequest();
cloudStorageRequest.setBaseLocation("s3a://example-path");
cloudStorageRequest.setFileSystemType(FileSystemType.S3);
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile("instance:profile");
cloudStorageRequest.setS3(s3Params);
sdxClusterRequest.setCloudStorage(cloudStorageRequest);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setCloudPlatform("AWS");
ClusterV4Request clusterV4Request = new ClusterV4Request();
clusterV4Request.setBlueprintName(exampleBlueprintName);
CloudStorageRequest cloudStorageConfigReq = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.initCloudStorageRequest(environment, clusterV4Request, sdxCluster, sdxClusterRequest));
StorageLocationBase singleRequest = cloudStorageConfigReq.getLocations().iterator().next();
assertEquals(1, cloudStorageConfigReq.getIdentities().size());
assertEquals(CloudIdentityType.ID_BROKER, cloudStorageConfigReq.getIdentities().iterator().next().getType());
assertEquals(1, cloudStorageConfigReq.getLocations().size());
assertEquals(CloudStorageCdpService.RANGER_AUDIT, singleRequest.getType());
assertEquals("ranger/example-path", singleRequest.getValue());
verify(storageValidationService).validateCloudStorage("AWS", cloudStorageRequest);
}
Aggregations