use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxController method getDetailByCrn.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE)
public SdxClusterDetailResponse getDetailByCrn(@TenantAwareParam @ResourceCrn String clusterCrn, Set<String> entries) {
SdxCluster sdxCluster = getSdxClusterByCrn(clusterCrn);
StackV4Response stackV4Response = sdxService.getDetail(sdxCluster.getClusterName(), entries, sdxCluster.getAccountId());
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
return SdxClusterDetailResponse.create(sdxClusterResponse, stackV4Response);
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxController method getDetail.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_DETAILED_DATALAKE)
public SdxClusterDetailResponse getDetail(@ResourceName String name, Set<String> entries) {
SdxCluster sdxCluster = getSdxClusterByName(name);
StackV4Response stackV4Response = sdxService.getDetail(name, entries, sdxCluster.getAccountId());
SdxClusterResponse sdxClusterResponse = sdxClusterConverter.sdxClusterToResponse(sdxCluster);
return SdxClusterDetailResponse.create(sdxClusterResponse, stackV4Response);
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxPollerServiceTest method testGetExecuteSdxOperationsAndGetCrnsWhenShouldSkipTheConsumer.
@Test
public void testGetExecuteSdxOperationsAndGetCrnsWhenShouldSkipTheConsumer() {
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setStatus(SdxClusterStatusResponse.STOPPED);
when(sdxService.list(ENV_NAME)).thenReturn(List.of(sdxClusterResponse));
List<String> actual = underTest.getExecuteSdxOperationsAndGetCrns(ENV_NAME, consumer, Set.of(SdxClusterStatusResponse.STOPPED));
verify(consumer, never()).accept(any());
Assertions.assertEquals(1, actual.size());
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse 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());
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabled.
@Test
public void testConvertFromEnvAndSdxResponseWithWADisabled() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
sdxClusterResponse.setName("sdxName");
FeaturesResponse featuresResponse = new FeaturesResponse();
featuresResponse.addWorkloadAnalytics(false);
response.setFeatures(featuresResponse);
// WHEN
TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
// THEN
assertNull(result.getWorkloadAnalytics());
assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
Aggregations