use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ClouderaManagerProductTransformerTest method testTransformShouldParsePreWarmParcelsFromAnImageWhenGetCDHParcelsIsFalse.
@Test
public void testTransformShouldParsePreWarmParcelsFromAnImageWhenGetCDHParcelsIsFalse() {
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, false, true);
assertThat(foundProducts, hasSize(1));
assertFalse(assertCdhProduct(foundProducts));
verify(preWarmParcelParser).parseProductFromParcel(preWarmParcels, preWarmCsdList);
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ParcelFilterServiceTest method testShouldAddOnlyCdhParcelWhenTheRequiredServicesAreAvailableInTheCdhParcelAndOtherParcelsAreNotAccessible.
@Test
void testShouldAddOnlyCdhParcelWhenTheRequiredServicesAreAvailableInTheCdhParcelAndOtherParcelsAreNotAccessible() {
when(clusterTemplateGeneratorService.getServicesByBlueprint(BLUEPRINT_TEXT)).thenReturn(getSupportedServices(Set.of("hdfs", "hive")));
ClouderaManagerProduct cdhParcel = new ClouderaManagerProduct().withParcel("cdh-parcel-url").withName("CDH");
ClouderaManagerProduct nifiParcel = new ClouderaManagerProduct().withParcel("nifi-parcel-url").withName("NIFI");
when(manifestRetrieverService.readRepoManifest(cdhParcel.getParcel())).thenReturn(ImmutablePair.of(ManifestStatus.SUCCESS, getManifest("hdfs", "hive")));
Set<ClouderaManagerProduct> actual = underTest.filterParcelsByBlueprint(STACK_ID, createParcelSet(cdhParcel, nifiParcel), getBlueprint());
assertEquals(1, actual.size());
assertTrue(actual.contains(cdhParcel));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ParcelFilterServiceTest method testShouldNotAddParcelWhenManifestDoesNotContainsTheComponentAndNotACustomParcel.
@Test
void testShouldNotAddParcelWhenManifestDoesNotContainsTheComponentAndNotACustomParcel() {
String parcelUrl = "http://parcel1.com/";
String parcelName = "NIFI";
ClouderaManagerProduct parcel = new ClouderaManagerProduct().withParcel(parcelUrl).withName(parcelName);
when(clusterTemplateGeneratorService.getServicesByBlueprint(BLUEPRINT_TEXT)).thenReturn(getSupportedServices(Set.of(parcelName)));
when(imageReaderService.getParcelNames(STACK_ID)).thenReturn(Set.of(parcelName));
when(manifestRetrieverService.readRepoManifest(parcelUrl)).thenReturn(ImmutablePair.of(ManifestStatus.SUCCESS, getManifest("otherService1")));
assertEquals(0, underTest.filterParcelsByBlueprint(STACK_ID, Set.of(parcel), getBlueprint()).size());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ParcelFilterServiceTest method testShouldAddCdhAndNifiParcelWhenTheRequiredServicesAreNotAvailableInTheCdhParcelAndOtherParcelsAreNotAccessible.
@Test
void testShouldAddCdhAndNifiParcelWhenTheRequiredServicesAreNotAvailableInTheCdhParcelAndOtherParcelsAreNotAccessible() {
when(clusterTemplateGeneratorService.getServicesByBlueprint(BLUEPRINT_TEXT)).thenReturn(getSupportedServices(Set.of("hdfs", "hive", "spark")));
ClouderaManagerProduct cdhParcel = new ClouderaManagerProduct().withParcel("cdh-parcel-url").withName("CDH");
ClouderaManagerProduct nifiParcel = new ClouderaManagerProduct().withParcel("nifi-parcel-url").withName("NIFI");
when(manifestRetrieverService.readRepoManifest(cdhParcel.getParcel())).thenReturn(ImmutablePair.of(ManifestStatus.SUCCESS, getManifest("hdfs", "hive")));
when(manifestRetrieverService.readRepoManifest(nifiParcel.getParcel())).thenReturn(ImmutablePair.of(ManifestStatus.FAILED, null));
Set<ClouderaManagerProduct> actual = underTest.filterParcelsByBlueprint(STACK_ID, createParcelSet(cdhParcel, nifiParcel), getBlueprint());
assertEquals(2, actual.size());
assertTrue(actual.contains(cdhParcel));
assertTrue(actual.contains(nifiParcel));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class ParcelFilterServiceTest method testShouldAddParcelWhenManifestDoesNotContainsTheComponentAndItIsACustomParcel.
@Test
void testShouldAddParcelWhenManifestDoesNotContainsTheComponentAndItIsACustomParcel() {
String parcelUrl = "http://parcel1.com/";
String parcelName = "CUSTOM";
ClouderaManagerProduct parcel = new ClouderaManagerProduct().withParcel(parcelUrl).withName(parcelName);
when(clusterTemplateGeneratorService.getServicesByBlueprint(BLUEPRINT_TEXT)).thenReturn(getSupportedServices(Set.of("NIFI")));
when(imageReaderService.getParcelNames(STACK_ID)).thenReturn(Set.of("NIFI"));
when(manifestRetrieverService.readRepoManifest(parcelUrl)).thenReturn(ImmutablePair.of(ManifestStatus.SUCCESS, getManifest(parcelName)));
assertEquals(1, underTest.filterParcelsByBlueprint(STACK_ID, Set.of(parcel), getBlueprint()).size());
}
Aggregations