use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverter method decorateBuilderWithProductDetails.
private void decorateBuilderWithProductDetails(StackV4Request source, TemplatePreparationObject.Builder builder) {
// base image
if (source.getCluster() != null && source.getCluster().getCm() != null && source.getCluster().getCm().getRepository() != null) {
ClouderaManagerV4Request cm = source.getCluster().getCm();
ClouderaManagerRepositoryV4Request repository = cm.getRepository();
ClouderaManagerRepo cmRepo = new ClouderaManagerRepo().withBaseUrl(repository.getBaseUrl()).withGpgKeyUrl(repository.getGpgKeyUrl()).withVersion(repository.getVersion());
List<ClouderaManagerProduct> products = null != cm.getProducts() ? cm.getProducts().stream().map(StackV4RequestToTemplatePreparationObjectConverter::convertProduct).collect(toList()) : new ArrayList<>();
builder.withProductDetails(cmRepo, products);
// prewarm image
}
// TODO: implement else {} branch for prewarm images
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class ClusterToClouderaManagerV4RequestConverter method convert.
public ClouderaManagerV4Request convert(Cluster cluster) {
Predicate<ClusterComponent> cmRepoFilter = component -> ComponentType.CM_REPO_DETAILS.equals(component.getComponentType());
Set<ClusterComponent> components = cluster.getComponents();
if (components.stream().noneMatch(cmRepoFilter)) {
return null;
}
return new ClouderaManagerV4Request().withRepository(components.stream().filter(cmRepoFilter).map(ClusterComponent::getAttributes).map(toAttributeClass(ClouderaManagerRepo.class)).map(ClouderaManagerRepoToClouderaManagerRepositoryV4Request::convert).findFirst().orElse(null)).withProducts(components.stream().filter(component -> ComponentType.CDH_PRODUCT_DETAILS.equals(component.getComponentType())).map(ClusterComponent::getAttributes).map(toAttributeClass(ClouderaManagerProduct.class)).map(ClouderaManagerProductToClouderaManagerProductV4Request::convert).collect(Collectors.toList())).withEnableAutoTls(cluster.getAutoTlsEnabled());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndPlatformIsNotYarn.
@Test
public void testShouldUseBaseCMImageWithProductsAndPlatformIsNotYarn() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
ClouderaManagerProductV4Request cdpRequest = new ClouderaManagerProductV4Request();
cdpRequest.setName("CDP");
cdpRequest.setParcel("parcel");
cdpRequest.setVersion("version");
cdpRequest.setCsd(List.of("csd"));
cmRequest.setProducts(List.of(cdpRequest));
clusterV4Request.setCm(cmRequest);
boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, AWS_PLATFORM);
assertTrue(base);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsYarn.
@Test
public void testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsYarn() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
ClouderaManagerProductV4Request cdpRequest = new ClouderaManagerProductV4Request();
cdpRequest.setName("CDP");
cdpRequest.setParcel("parcel");
cdpRequest.setVersion("version");
cdpRequest.setCsd(List.of("csd"));
cmRequest.setProducts(List.of(cdpRequest));
ClouderaManagerRepositoryV4Request cmRepoRequest = new ClouderaManagerRepositoryV4Request();
cmRequest.setRepository(cmRepoRequest);
clusterV4Request.setCm(cmRequest);
boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, YARN_PLATFORM);
assertTrue(base);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method testAutoTlsConfigurations.
// CHECKSTYLE:ON
// @formatter:on
@ParameterizedTest(name = "{0}")
@MethodSource("autoTlsConfigurations")
@MockitoSettings(strictness = Strictness.LENIENT)
void testAutoTlsConfigurations(String testName, boolean cmAutoTls, boolean providerAutoTls, boolean expectedHasErrors) {
// GIVEN
Stack stack = getStack();
ClusterV4Request clusterRequest = new ClusterV4Request();
ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
cmRequest.setEnableAutoTls(cmAutoTls);
clusterRequest.setCm(cmRequest);
DetailedEnvironmentResponse environment = getEnvironmentResponse();
when(platformParameters.isAutoTlsSupported()).thenReturn(providerAutoTls);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
// WHEN
underTest.validateAutoTls(clusterRequest, stack, validationBuilder, environment.getParentEnvironmentCloudPlatform());
// THEN
ValidationResult actualResult = validationBuilder.build();
assertEquals(expectedHasErrors, actualResult.hasError());
if (expectedHasErrors) {
assertEquals(1, actualResult.getErrors().size());
assertTrue(actualResult.getErrors().contains("AutoTLS is not supported by 'aws' platform!"));
}
}
Aggregations