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);
}
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());
}
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());
}
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");
}
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);
}
}
Aggregations