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