Search in sources :

Example 31 with ClouderaManagerProduct

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);
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.Test)

Example 32 with ClouderaManagerProduct

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));
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 33 with ClouderaManagerProduct

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());
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 34 with ClouderaManagerProduct

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));
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 35 with ClouderaManagerProduct

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());
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

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