Search in sources :

Example 56 with ClouderaManagerProduct

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

the class ClouderaManagerParcelActivationListenerTaskTest method createClouderaManagerProduct.

private ClouderaManagerProduct createClouderaManagerProduct(String name, String version) {
    ClouderaManagerProduct clouderaManagerProduct = new ClouderaManagerProduct();
    clouderaManagerProduct.setName(name);
    clouderaManagerProduct.setVersion(version);
    return clouderaManagerProduct;
}
Also used : ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)

Example 57 with ClouderaManagerProduct

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

the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenCmAndProductDetailsPresent.

@Test
public void testConvertWhenCmAndProductDetailsPresent() {
    final String cmBaseUrl = "http://cloudera-build-us-west-1.vpc.cloudera.com/s3/build/1677091/cm7/7.0.2/redhat7/yum/";
    final String cmGpgUrl = "http://cloudera-build-us-west-1.vpc.cloudera.com/s3/build/1677091/cm7/7.0.2/redhat7/yum/RPM-GPG-KEY-cloudera";
    final String cmVersion = "7.0.2";
    ClouderaManagerRepositoryV4Request cmRepo = new ClouderaManagerRepositoryV4Request().withBaseUrl(cmBaseUrl).withGpgKeyUrl(cmGpgUrl).withVersion(cmVersion);
    final String smmName = "STREAMS_MESSAGING_MANAGER";
    final String smmVersion = "2.1.0.3.0.0.0-97";
    final String smmParcel = "http://s3.amazonaws.com/dev.hortonworks.com/CSP/centos7/3.x/BUILDS/3.0.0.0-97/tars/parcel/";
    final String smmCsd = "http://s3.amazonaws.com/dev.hortonworks.com/CSP/centos7/3.x/BUILDS/3.0.0.0-97/tars/parcel/STREAMS_MESSAGING_MANAGER-2.1.0.jar";
    ClouderaManagerProductV4Request smm = new ClouderaManagerProductV4Request().withName(smmName).withVersion(smmVersion).withParcel(smmParcel).withCsd(List.of(smmCsd));
    ClouderaManagerV4Request cm = new ClouderaManagerV4Request().withEnableAutoTls(true).withRepository(cmRepo).withProducts(List.of(smm));
    when(cluster.getCm()).thenReturn(cm);
    TemplatePreparationObject result = underTest.convert(source);
    ProductDetailsView products = result.getProductDetailsView();
    assertNotNull(products);
    assertEquals(cmBaseUrl, products.getCm().getBaseUrl());
    assertEquals(cmVersion, products.getCm().getVersion());
    assertEquals(cmGpgUrl, products.getCm().getGpgKeyUrl());
    assertEquals(1, products.getProducts().size());
    ClouderaManagerProduct smmResult = products.getProducts().get(0);
    assertEquals(smmName, smmResult.getName());
    assertEquals(smmVersion, smmResult.getVersion());
    assertEquals(smmParcel, smmResult.getParcel());
    assertEquals(List.of(smmCsd), smmResult.getCsd());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerProductV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request) ProductDetailsView(com.sequenceiq.cloudbreak.template.views.ProductDetailsView) ClouderaManagerRepositoryV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) Test(org.junit.Test)

Example 58 with ClouderaManagerProduct

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

the class CmProductChooserServiceTest method testChooseParcelProductWhenMultipleMatchingNameAndVersionThenReturnsOne.

@Test
void testChooseParcelProductWhenMultipleMatchingNameAndVersionThenReturnsOne() {
    Set<ParcelInfo> activeParcels = Set.of(new ParcelInfo(PARCEL_NAME_1, PARCEL_VERSION_1));
    Set<ClouderaManagerProduct> candidateProducts = Set.of(new ClouderaManagerProduct().withName(PARCEL_NAME_1).withVersion(PARCEL_VERSION_1), new ClouderaManagerProduct().withName(PARCEL_NAME_1).withVersion(PARCEL_VERSION_1));
    Set<ClouderaManagerProduct> foundProducts = underTest.chooseParcelProduct(activeParcels, candidateProducts);
    assertThat(foundProducts, hasSize(1));
    ClouderaManagerProduct foundProduct = foundProducts.iterator().next();
    assertEquals(PARCEL_NAME_1, foundProduct.getName());
    assertEquals(PARCEL_VERSION_1, foundProduct.getVersion());
}
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 59 with ClouderaManagerProduct

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

the class CmSyncResultMergerServiceTest method testMerge.

@Test
void testMerge() {
    Stack stack = new Stack();
    ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
    CmRepoSyncOperationResult cmRepoSyncOperationResult = new CmRepoSyncOperationResult("", clouderaManagerRepo);
    when(componentConverter.fromClouderaManagerRepo(clouderaManagerRepo, stack)).thenReturn(componentWithName(CM_REPO_COMPONENT_NAME));
    Set<ClouderaManagerProduct> clouderaManagerProducts = Set.of(new ClouderaManagerProduct());
    CmParcelSyncOperationResult cmParcelSyncOperationResult = new CmParcelSyncOperationResult(Set.of(), clouderaManagerProducts);
    when(componentConverter.fromClouderaManagerProductList(clouderaManagerProducts, stack)).thenReturn(Set.of(componentWithName(CM_PARCEL_COMPONENT_NAME)));
    CmSyncOperationResult cmSyncOperationResult = new CmSyncOperationResult(cmRepoSyncOperationResult, cmParcelSyncOperationResult);
    Set<Component> mergedComponents = underTest.merge(stack, cmSyncOperationResult);
    assertThat(mergedComponents, hasSize(2));
    assertThat(mergedComponents, containsInAnyOrder(hasProperty("name", is(CM_REPO_COMPONENT_NAME)), hasProperty("name", is(CM_PARCEL_COMPONENT_NAME))));
    verify(componentConverter).fromClouderaManagerRepo(clouderaManagerRepo, stack);
    verify(componentConverter).fromClouderaManagerProductList(clouderaManagerProducts, stack);
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) CmParcelSyncOperationResult(com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmParcelSyncOperationResult) CmSyncOperationResult(com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmSyncOperationResult) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) CmRepoSyncOperationResult(com.sequenceiq.cloudbreak.service.upgrade.sync.operationresult.CmRepoSyncOperationResult) Component(com.sequenceiq.cloudbreak.domain.stack.Component) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 60 with ClouderaManagerProduct

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

the class CmSyncOperationResultEvaluatorServiceTest method testEvaluateParcelSyncWhenVersionsPresentAndMatchingProductsFoundThenSuccess.

@Test
void testEvaluateParcelSyncWhenVersionsPresentAndMatchingProductsFoundThenSuccess() {
    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(new ClouderaManagerProduct().withName(PARCEL_1_NAME), new ClouderaManagerProduct().withName(PARCEL_2_NAME));
    CmParcelSyncOperationResult cmParcelSyncOperationResult = new CmParcelSyncOperationResult(activeParcels, foundCmProducts);
    CmSyncOperationStatus.Builder cmSyncOperationStatusBuilder = underTest.evaluateParcelSync(cmParcelSyncOperationResult);
    CmSyncOperationStatus cmSyncOperationStatus = cmSyncOperationStatusBuilder.build();
    assertTrue(cmSyncOperationStatus.hasSucceeded());
    assertThat(cmSyncOperationStatus.getMessage(), containsString("Reading versions of active parcels succeeded, the following active parcels were found on the 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)

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