Search in sources :

Example 26 with ClouderaManagerProduct

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

the class CmSyncOperationResultEvaluatorServiceTest method testEvaluateParcelSyncWhenVersionsPresentButNoMatchingProductsFoundThenFailure.

@Test
void testEvaluateParcelSyncWhenVersionsPresentButNoMatchingProductsFoundThenFailure() {
    Set<ParcelInfo> activeParcels = Set.of(new ParcelInfo(PARCEL_1_NAME, PARCEL_1_VERSION), new ParcelInfo(PARCEL_2_NAME, PARCEL_2_VERSION));
    Set<ClouderaManagerProduct> foundCmProducts = Set.of();
    CmParcelSyncOperationResult cmParcelSyncOperationResult = new CmParcelSyncOperationResult(activeParcels, foundCmProducts);
    CmSyncOperationStatus.Builder cmSyncOperationStatusBuilder = underTest.evaluateParcelSync(cmParcelSyncOperationResult);
    CmSyncOperationStatus cmSyncOperationStatus = cmSyncOperationStatusBuilder.build();
    assertFalse(cmSyncOperationStatus.hasSucceeded());
    assertThat(cmSyncOperationStatus.getMessage(), containsString("Reading versions of active parcels failed, the version of active parcels that could not be retrieved from CM server:"));
    assertThat(cmSyncOperationStatus.getMessage(), containsString(PARCEL_1_NAME));
    assertThat(cmSyncOperationStatus.getMessage(), containsString(PARCEL_2_NAME));
}
Also used : ParcelInfo(com.sequenceiq.cloudbreak.service.upgrade.sync.common.ParcelInfo) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) Test(org.junit.jupiter.api.Test)

Example 27 with ClouderaManagerProduct

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

the class RuntimeVersionServiceTest method getCdhProduct.

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

Example 28 with ClouderaManagerProduct

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

the class RuntimeVersionServiceTest method testGetCdhVersionFromClouderaManagerProductsIfNameAndVersionAdded.

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

Example 29 with ClouderaManagerProduct

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

the class ClouderaManagerProductTransformerTest method testTransformShouldNotParseFromAnImageWhenCDHAndPreWarmBothFalse.

@Test
public void testTransformShouldNotParseFromAnImageWhenCDHAndPreWarmBothFalse() {
    List<String> preWarmParcels = Collections.emptyList();
    List<String> preWarmCsdList = Collections.emptyList();
    Image image = createImage(preWarmParcels, preWarmCsdList);
    Set<ClouderaManagerProduct> foundProducts = underTest.transform(image, false, false);
    assertThat(foundProducts, empty());
    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 30 with ClouderaManagerProduct

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

the class ClouderaManagerProductTransformerTest method testTransformShouldCreateASetOfClouderaManagerProductFromAnImageWhenPreWarmParcelsAreNotAvailable.

@Test
public void testTransformShouldCreateASetOfClouderaManagerProductFromAnImageWhenPreWarmParcelsAreNotAvailable() {
    List<String> preWarmParcels = Collections.emptyList();
    List<String> preWarmCsdList = Collections.emptyList();
    Image image = createImage(preWarmParcels, preWarmCsdList);
    when(preWarmParcelParser.parseProductFromParcel(preWarmParcels, preWarmCsdList)).thenReturn(Optional.empty());
    Set<ClouderaManagerProduct> foundProducts = underTest.transform(image, true, true);
    assertThat(foundProducts, hasSize(1));
    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)

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