use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request 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.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestAction method action.
@Override
public StackTestDto action(TestContext testContext, StackTestDto testDto, CloudbreakClient client) throws Exception {
Log.when(LOGGER, " Stack get cli skeleton:" + testDto.getName());
StackV4Request request = client.getDefaultClient().stackV4Endpoint().getRequestfromName(client.getWorkspaceId(), testDto.getName(), testContext.getActingUserCrn().getAccountId());
testDto.setRequest(request);
Log.whenJson(LOGGER, " get cli skeleton was successfully:\n", testDto.getRequest());
return testDto;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToGatewayConverterTest method generateStackV4Request.
private StackV4Request generateStackV4Request(GatewayV4Request gateWayJson) {
ClusterV4Request clusterRequest = new ClusterV4Request();
clusterRequest.setGateway(gateWayJson);
StackV4Request source = new StackV4Request();
source.setName("funnyCluster");
source.setCluster(clusterRequest);
return source;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToGatewayConverterTest method shouldCreateCorrectSsoUrlWhenClusterNameisProvided.
@Test
public void shouldCreateCorrectSsoUrlWhenClusterNameisProvided() {
GatewayV4Request gatewayJson = new GatewayV4Request();
gatewayJson.setPath("funnyPath");
gatewayJson.setTopologies(Arrays.asList(getGatewayTopologyV4Request()));
StackV4Request source = generateStackV4Request(gatewayJson);
when(gatewayJsonValidator.validate(gatewayJson)).thenReturn(ValidationResult.builder().build());
doAnswer(i -> {
Gateway gw = i.getArgument(1);
gw.setSsoProvider("SSOPROVIDER");
gw.setPath(gatewayJson.getPath());
gw.setTopologies(GATEWAY_TOPOLOGY);
gw.setGatewayType(GatewayType.CENTRAL);
return null;
}).when(convertUtil).setBasicProperties(eq(gatewayJson), any(Gateway.class));
Gateway result = underTest.convert(source);
assertEquals("SSOPROVIDER", result.getSsoProvider());
assertEquals("funnyPath", result.getPath());
assertTrue(EqualsBuilder.reflectionEquals(GATEWAY_TOPOLOGY, result.getTopologies()));
assertEquals(GatewayType.CENTRAL, result.getGatewayType());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class DatalakeServiceTest method testPrepareDatalakeRequestWhenDatalakeCrnIsNull.
@Test
public void testPrepareDatalakeRequestWhenDatalakeCrnIsNull() {
Stack source = new Stack();
source.setDatalakeCrn(null);
StackV4Request x = new StackV4Request();
underTest.prepareDatalakeRequest(source, x);
verify(stackService, never()).getByCrn("crn");
}
Aggregations