Search in sources :

Example 66 with ClouderaManagerProduct

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

the class ClouderaManagerProductTransformerTest method testTransformShouldCreateASetOfClouderaManagerProductFromAnImage.

@Test
public void testTransformShouldCreateASetOfClouderaManagerProductFromAnImage() {
    List<String> preWarmParcels = Collections.emptyList();
    List<String> preWarmCsdList = Collections.emptyList();
    Image image = createImage(preWarmParcels, preWarmCsdList);
    when(preWarmParcelParser.parseProductFromParcel(preWarmParcels, preWarmCsdList)).thenReturn(Optional.of(new ClouderaManagerProduct()));
    Set<ClouderaManagerProduct> foundProducts = underTest.transform(image, true, true);
    assertThat(foundProducts, hasSize(2));
    assertTrue(assertCdhProduct(foundProducts));
    verify(preWarmParcelParser).parseProductFromParcel(preWarmParcels, preWarmCsdList);
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.Test)

Example 67 with ClouderaManagerProduct

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

the class ClouderaManagerProductTransformerTest method testTransformShouldParseCDHFromAnImageWhenGetPrewarmParcelsIsFalse.

@Test
public void testTransformShouldParseCDHFromAnImageWhenGetPrewarmParcelsIsFalse() {
    List<String> preWarmParcels = Collections.emptyList();
    List<String> preWarmCsdList = Collections.emptyList();
    Image image = createImage(preWarmParcels, preWarmCsdList);
    Set<ClouderaManagerProduct> foundProducts = underTest.transform(image, true, false);
    assertThat(foundProducts, hasSize(1));
    assertTrue(assertCdhProduct(foundProducts));
    verify(preWarmParcelParser, never()).parseProductFromParcel(any(), any());
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.Test)

Example 68 with ClouderaManagerProduct

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

the class ParcelFilterServiceTest method testShouldReturnAllParcelsWhenTheServiceNamesInTheBlueprintContainsANullValue.

@Test
void testShouldReturnAllParcelsWhenTheServiceNamesInTheBlueprintContainsANullValue() {
    String parcelUrl = "http://parcel1.com/";
    String parcelName = "CUSTOM";
    ClouderaManagerProduct parcel = new ClouderaManagerProduct().withParcel(parcelUrl).withName(parcelName);
    SupportedService supportedService = new SupportedService();
    supportedService.setComponentNameInParcel(null);
    SupportedServices supportedServices = new SupportedServices();
    supportedServices.setServices(Set.of(supportedService));
    when(clusterTemplateGeneratorService.getServicesByBlueprint(BLUEPRINT_TEXT)).thenReturn(supportedServices);
    assertEquals(1, underTest.filterParcelsByBlueprint(STACK_ID, Set.of(parcel), getBlueprint()).size());
}
Also used : SupportedService(com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedService) SupportedServices(com.sequenceiq.cloudbreak.cmtemplate.generator.support.domain.SupportedServices) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 69 with ClouderaManagerProduct

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

the class ClouderaManagerModificationService method redistributeParcelsForRecovery.

private void redistributeParcelsForRecovery() throws ApiException, CloudbreakException {
    LOGGER.debug("Refreshing parcel repos");
    ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient);
    ApiCommand refreshParcelRepos = clouderaManagerResourceApi.refreshParcelRepos();
    ExtendedPollingResult activateParcelsPollingResult = clouderaManagerPollingServiceProvider.startPollingCmParcelRepositoryRefresh(stack, apiClient, refreshParcelRepos.getId());
    handlePollingResult(activateParcelsPollingResult.getPollingResult(), "Cluster was terminated while waiting for parcel repository refresh", "Timeout while Cloudera Manager was refreshing parcel repositories.");
    List<ClouderaManagerProduct> products = clusterComponentConfigProvider.getClouderaManagerProductDetails(stack.getCluster().getId());
    ExtendedPollingResult downloadPollingResult = clouderaManagerPollingServiceProvider.startPollingCmParcelActivation(stack, apiClient, refreshParcelRepos.getId(), products);
    handlePollingResult(downloadPollingResult, "Cluster was terminated while waiting for parcel download", "Timeout while Cloudera Manager was downloading parcels.");
    LOGGER.debug("Refreshed parcel repos");
}
Also used : ApiCommand(com.cloudera.api.swagger.model.ApiCommand) ClouderaManagerResourceApi(com.cloudera.api.swagger.ClouderaManagerResourceApi) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ExtendedPollingResult(com.sequenceiq.cloudbreak.polling.ExtendedPollingResult)

Example 70 with ClouderaManagerProduct

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

the class ClouderaManagerModificationService method downloadAndDistributeParcels.

@Override
public void downloadAndDistributeParcels(Set<ClusterComponent> components, boolean patchUpgrade) throws CloudbreakException {
    try {
        ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient);
        ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient);
        checkParcelApiAvailability();
        Set<ClouderaManagerProduct> products = getProducts(components);
        LOGGER.info("The following products will be downloaded and distributed: {}", products);
        setParcelRepo(products, clouderaManagerResourceApi);
        refreshParcelRepos(clouderaManagerResourceApi);
        if (patchUpgrade) {
            LOGGER.info("Downloading parcels for {} products...", products);
            downloadAndActivateParcels(products, parcelResourceApi, false);
        } else {
            ClouderaManagerProduct cdhProduct = clouderaManagerProductsProvider.getCdhProducts(products);
            upgradeNonCdhProducts(products, cdhProduct.getName(), parcelResourceApi, false);
            downloadAndActivateParcels(Collections.singleton(cdhProduct), parcelResourceApi, false);
        }
    } catch (ApiException e) {
        LOGGER.info("Error during downloading parcels!", e);
        throw new ClouderaManagerOperationFailedException(e.getMessage(), e);
    }
}
Also used : ParcelResourceApi(com.cloudera.api.swagger.ParcelResourceApi) ClouderaManagerResourceApi(com.cloudera.api.swagger.ClouderaManagerResourceApi) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ApiException(com.cloudera.api.swagger.client.ApiException)

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