use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithEnvTheUsernameShouldBeSet.
@Test
void testConvertWithEnvTheUsernameShouldBeSet() {
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1RequestWithEnvironment();
assertNotNull(result);
assertEquals(distroXV1RequestInput.getCluster().getUserName(), result.getUserName());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithEnvTheDatabasesShouldBeSet.
@Test
void testConvertWithEnvTheDatabasesShouldBeSet() {
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1RequestWithEnvironment();
assertNotNull(result);
assertEquals(distroXV1RequestInput.getCluster().getDatabases(), result.getDatabases());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class DistroXClusterToClusterConverterTest method testConvertWithoutEnvTheBlueprintNameShouldBeSet.
@Test
void testConvertWithoutEnvTheBlueprintNameShouldBeSet() {
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
ClusterV4Request result = testConvertDistroXV1Request();
assertNotNull(result);
assertEquals(distroXV1RequestInput.getCluster().getBlueprintName(), result.getBlueprintName());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverter method convertGateway.
private void convertGateway(ClusterV4Request source, Cluster cluster) {
GatewayV4Request gatewayRequest = source.getGateway();
if (gatewayRequest != null) {
if (StringUtils.isEmpty(gatewayRequest.getPath())) {
gatewayRequest.setPath(source.getName());
}
Gateway gateway = gatewayV4RequestToGatewayConverter.convert(gatewayRequest);
if (gateway != null) {
cluster.setGateway(gateway);
gateway.setCluster(cluster);
}
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverter method extractClusterManagerAndHdpRepoConfig.
private void extractClusterManagerAndHdpRepoConfig(Cluster cluster, ClusterV4Request clusterRequest) {
Set<ClusterComponent> components = new HashSet<>();
ClouderaManagerV4Request clouderaManagerRequest = clusterRequest.getCm();
if (Objects.nonNull(clouderaManagerRequest) && cluster.getBlueprint() != null && !StackType.CDH.name().equals(cluster.getBlueprint().getStackType())) {
throw new BadRequestException("Cannot process the provided Ambari blueprint with Cloudera Manager");
}
Optional.ofNullable(clouderaManagerRequest).map(ClouderaManagerV4Request::getRepository).map(ClouderaManagerRepositoryV4RequestToClouderaManagerRepoConverter::convert).map(toJsonWrapException()).map(cmRepoJson -> new ClusterComponent(ComponentType.CM_REPO_DETAILS, cmRepoJson, cluster)).ifPresent(components::add);
Optional.ofNullable(clouderaManagerRequest).map(ClouderaManagerV4Request::getProducts).orElseGet(List::of).stream().map(this::convertCMProductRequestToCMProduct).map(product -> {
Json json = toJsonWrapException().apply(product);
return new ClusterComponent(ComponentType.CDH_PRODUCT_DETAILS, product.getName(), json, cluster);
}).forEach(components::add);
cluster.setComponents(components);
}
Aggregations