Search in sources :

Example 61 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct 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
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) ClouderaManagerRepositoryV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request)

Example 62 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class StackRuntimeVersionValidatorTest method getCdhProduct.

private ClouderaManagerProduct getCdhProduct(String version) {
    ClouderaManagerProduct product = new ClouderaManagerProduct();
    product.setName("CDH");
    product.setVersion(version + "-something");
    return product;
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)

Example 63 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class ImageFilterParamsFactoryTest method testCreateShouldReturnsANewImageFilterParamsInstanceWhenTheStackTypeIsDataHub.

@Test
public void testCreateShouldReturnsANewImageFilterParamsInstanceWhenTheStackTypeIsDataHub() {
    Image image = mock(Image.class);
    Stack stack = createStack(StackType.WORKLOAD);
    Set<ClusterComponent> cdhClusterComponent = createCdhClusterComponent();
    String sparkName = "Spark";
    String sparkVersion = "123";
    ClouderaManagerProduct spark = createCMProduct(sparkName, sparkVersion);
    String nifiName = "Nifi";
    String nifiVersion = "456";
    ClouderaManagerProduct nifi = createCMProduct(nifiName, nifiVersion);
    when(platformStringTransformer.getPlatformStringForImageCatalog(anyString(), anyString())).thenReturn(imageCatalogPlatform(CLOUD_PLATFORM));
    when(parcelService.getParcelComponentsByBlueprint(stack)).thenReturn(cdhClusterComponent);
    when(clouderaManagerProductsProvider.getProducts(cdhClusterComponent)).thenReturn(Set.of(spark, nifi));
    ImageFilterParams actual = underTest.create(image, true, stack, new InternalUpgradeSettings(true, true, true));
    assertEquals(image, actual.getCurrentImage());
    assertTrue(actual.isLockComponents());
    assertTrue(actual.isSkipValidations());
    assertEquals(sparkVersion, actual.getStackRelatedParcels().get(sparkName));
    assertEquals(nifiVersion, actual.getStackRelatedParcels().get(nifiName));
    assertEquals(StackType.WORKLOAD, actual.getStackType());
    assertEquals(blueprint, actual.getBlueprint());
    assertEquals(STACK_ID, actual.getStackId());
    assertEquals(CLOUD_PLATFORM, actual.getCloudPlatform().nameToUpperCase());
    verify(parcelService).getParcelComponentsByBlueprint(stack);
    verify(clouderaManagerProductsProvider).getProducts(cdhClusterComponent);
}
Also used : ImageFilterParams(com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams) InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings) ClusterComponent(com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 64 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class RuntimeVersionServiceTest method getCdhProduct.

private ClouderaManagerProduct getCdhProduct(String version) {
    ClouderaManagerProduct product = new ClouderaManagerProduct();
    product.setName("CDH");
    product.setVersion(version + "-something");
    return product;
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)

Example 65 with ClouderaManagerProduct

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.

the class RuntimeVersionServiceTest method testGetCdhVersionFromClouderaManagerProductsIfNameAddedButVersionMissing.

@Test
public void testGetCdhVersionFromClouderaManagerProductsIfNameAddedButVersionMissing() {
    ClouderaManagerProduct cdhProduct = getCdhProduct();
    Optional<String> actual = RuntimeVersionService.getRuntimeVersionFromClouderaManagerProducts(List.of(cdhProduct));
    Assertions.assertTrue(actual.isEmpty());
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test)

Aggregations

ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)91 Test (org.junit.Test)34 Test (org.junit.jupiter.api.Test)23 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)23 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)20 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)14 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)10 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)9 ClusterComponent (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent)9 ParcelInfo (com.sequenceiq.cloudbreak.service.upgrade.sync.common.ParcelInfo)9 HashSet (java.util.HashSet)8 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)8 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)7 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)7 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)6 IdBroker (com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker)6 ExtendedPollingResult (com.sequenceiq.cloudbreak.polling.ExtendedPollingResult)6 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)6 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)6 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)5