use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class DistroXV1RequestToStackV4RequestConverter method convert.
public StackV4Request convert(DistroXV1Request source) {
DetailedEnvironmentResponse environment = Optional.ofNullable(environmentClientService.getByName(source.getEnvironmentName())).orElseThrow(() -> new BadRequestException("No environment name provided hence unable to obtain some important data"));
StackV4Request request = new StackV4Request();
SdxClusterResponse sdxClusterResponse = getSdxClusterResponse(environment);
request.setName(source.getName());
request.setType(StackType.WORKLOAD);
request.setCloudPlatform(getCloudPlatform(environment));
request.setEnvironmentCrn(environment.getCrn());
request.setAuthentication(getIfNotNull(environment.getAuthentication(), authenticationConverter::convert));
request.setImage(getIfNotNull(source.getImage(), imageConverter::convert));
request.setCluster(getIfNotNull(source, environment, clusterConverter::convert));
NetworkV4Request network = getNetwork(source.getNetwork(), environment, source.getInstanceGroups());
request.setNetwork(network);
request.setInstanceGroups(getIfNotNull(source.getInstanceGroups(), igs -> instanceGroupConverter.convertTo(network, igs, environment)));
request.setAws(getIfNotNull(source.getAws(), stackParameterConverter::convert));
request.setAzure(getIfNotNull(source.getAzure(), stackParameterConverter::convert));
request.setGcp(getIfNotNull(source.getGcp(), stackParameterConverter::convert));
request.setYarn(getYarnProperties(source, environment));
request.setInputs(source.getInputs());
request.setTags(getIfNotNull(source.getTags(), this::getTags));
request.setPlacement(preparePlacement(environment));
request.setSharedService(sdxConverter.getSharedService(sdxClusterResponse));
request.setCustomDomain(null);
request.setTimeToLive(source.getTimeToLive());
request.setTelemetry(getTelemetryRequest(environment, sdxClusterResponse));
request.setGatewayPort(source.getGatewayPort());
request.setExternalDatabase(getIfNotNull(source.getExternalDatabase(), databaseRequestConverter::convert));
request.setEnableLoadBalancer(source.isEnableLoadBalancer());
request.setVariant(source.getVariant());
checkMultipleGatewayNodes(source);
return request;
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class PaasSdxServiceTest method testListStatusPairsCrn.
@Test
public void testListStatusPairsCrn() {
SdxClusterResponse sdxClusterResponse = getSdxClusterResponse();
when(sdxEndpoint.list(any(), anyBoolean())).thenReturn(List.of(sdxClusterResponse));
assertTrue(underTest.listSdxCrnStatusPair(ENV_CRN, "env", Set.of(PAAS_CRN)).contains(Pair.of(PAAS_CRN, SdxClusterStatusResponse.RUNNING)));
verify(sdxEndpoint).list(any(), anyBoolean());
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class PaasSdxServiceTest method testListCrn.
@Test
public void testListCrn() {
SdxClusterResponse sdxClusterResponse = getSdxClusterResponse();
when(sdxEndpoint.list(any(), anyBoolean())).thenReturn(List.of(sdxClusterResponse));
assertTrue(underTest.listSdxCrns("envName", ENV_CRN).contains(PAAS_CRN));
verify(sdxEndpoint).list(eq("envName"), anyBoolean());
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class PaasSdxServiceTest method getSdxClusterResponse.
private SdxClusterResponse getSdxClusterResponse() {
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn(PAAS_CRN);
sdxClusterResponse.setEnvironmentCrn(ENV_CRN);
sdxClusterResponse.setStatus(SdxClusterStatusResponse.RUNNING);
return sdxClusterResponse;
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class SdxPollerProviderTest method testStopDatalakePoller.
@ParameterizedTest
@MethodSource("datalakeStopStatuses")
void testStopDatalakePoller(SdxClusterStatusResponse s1Status, SdxClusterStatusResponse s2Status, AttemptState attemptState, String message, List<String> remaining) throws Exception {
List<String> pollingCrn = new ArrayList<>();
pollingCrn.add("crn1");
pollingCrn.add("crn2");
SdxClusterResponse sdx1 = getSdxResponse(s1Status, "crn1");
SdxClusterResponse sdx2 = getSdxResponse(s2Status, "crn2");
when(sdxService.getByCrn("crn1")).thenReturn(sdx1);
when(sdxService.getByCrn("crn2")).thenReturn(sdx2);
AttemptResult<Void> result = underTest.stopSdxClustersPoller(ENV_ID, pollingCrn).process();
assertEquals(attemptState, result.getState());
}
Aggregations