use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class CloudStorageManifesterTest method whenCloudStorageEnabledFromInternalRequestWithLogging.
@Test
public void whenCloudStorageEnabledFromInternalRequestWithLogging() {
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);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setCloudPlatform("AWS");
TelemetryResponse telemetryResponse = new TelemetryResponse();
LoggingResponse loggingResponse = new LoggingResponse();
S3CloudStorageV1Parameters s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
s3CloudStorageV1Parameters.setInstanceProfile("logprofile");
loggingResponse.setS3(s3CloudStorageV1Parameters);
telemetryResponse.setLogging(loggingResponse);
environment.setTelemetry(telemetryResponse);
CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest());
assertEquals(CloudStorageCdpService.RANGER_AUDIT, cloudStorageConfigReq.getLocations().get(0).getType());
assertEquals(CloudIdentityType.LOG, cloudStorageConfigReq.getIdentities().get(0).getType());
}
use of com.sequenceiq.sdx.api.model.SdxClusterRequest in project cloudbreak by hortonworks.
the class SdxControllerTest method createTest.
@Test
void createTest() {
SdxCluster sdxCluster = getValidSdxCluster();
when(sdxService.createSdx(anyString(), anyString(), any(SdxClusterRequest.class), nullable(StackV4Request.class))).thenReturn(Pair.of(sdxCluster, new FlowIdentifier(FlowType.FLOW, "FLOW_ID")));
SdxClusterRequest createSdxClusterRequest = new SdxClusterRequest();
createSdxClusterRequest.setClusterShape(SdxClusterShape.MEDIUM_DUTY_HA);
createSdxClusterRequest.setEnvironment("test-env");
Map<String, String> tags = new HashMap<>();
tags.put("tag1", "value1");
createSdxClusterRequest.addTags(tags);
SdxStatusEntity sdxStatusEntity = new SdxStatusEntity();
sdxStatusEntity.setStatus(DatalakeStatusEnum.REQUESTED);
sdxStatusEntity.setStatusReason("statusreason");
sdxStatusEntity.setCreated(1L);
when(sdxStatusService.getActualStatusForSdx(sdxCluster)).thenReturn(sdxStatusEntity);
ReflectionTestUtils.setField(sdxClusterConverter, "sdxStatusService", sdxStatusService);
SdxClusterResponse sdxClusterResponse = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> sdxController.create(SDX_CLUSTER_NAME, createSdxClusterRequest));
verify(sdxService).createSdx(eq(USER_CRN), eq(SDX_CLUSTER_NAME), eq(createSdxClusterRequest), nullable(StackV4Request.class));
verify(sdxStatusService, times(1)).getActualStatusForSdx(sdxCluster);
assertEquals(SDX_CLUSTER_NAME, sdxClusterResponse.getName());
assertEquals("test-env", sdxClusterResponse.getEnvironmentName());
assertEquals("crn:sdxcluster", sdxClusterResponse.getCrn());
assertEquals(SdxClusterStatusResponse.REQUESTED, sdxClusterResponse.getStatus());
assertEquals("statusreason", sdxClusterResponse.getStatusReason());
}
Aggregations