use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverterTest method testConvertClouderaManagerRequestWithNullRepo.
@Test
public void testConvertClouderaManagerRequestWithNullRepo() {
ClusterV4Request request = new ClusterV4Request();
request.setBlueprintName(BLUEPRINT);
blueprint.setStackType(StackType.CDH.name());
when(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq(BLUEPRINT), any())).thenReturn(blueprint);
ClouderaManagerV4Request cm = new ClouderaManagerV4Request();
ClouderaManagerProductV4Request cdp = new ClouderaManagerProductV4Request();
cdp.setName("cdp");
cdp.setParcel("cdp.parcel");
cdp.setVersion("cdp.version");
cdp.setCsd(List.of("cdp.csd"));
ClouderaManagerProductV4Request cdf = new ClouderaManagerProductV4Request();
cdf.setName("cdf");
cdf.setParcel("cdf.parcel");
cdf.setVersion("cdf.version");
cdf.setCsd(List.of("cdf.csd"));
List<ClouderaManagerProductV4Request> products = List.of(cdp, cdf);
cm.setProducts(products);
request.setCm(cm);
Cluster cluster = underTest.convert(request);
assertFalse(cluster.getComponents().isEmpty());
assertEquals(2, cluster.getComponents().size());
assertAll(cluster.getComponents().stream().map(component -> () -> assertEquals(ComponentType.CDH_PRODUCT_DETAILS, component.getComponentType())));
List<Json> cdps = cluster.getComponents().stream().map(ClusterComponent::getAttributes).filter(attr -> attr.getValue().contains("cdp")).collect(Collectors.toList());
Json cdpJson = new Json(cdp);
assertAll(() -> assertEquals(1, cdps.size()), () -> assertEquals(cdpJson, cdps.iterator().next()));
List<Json> cdfs = cluster.getComponents().stream().map(ClusterComponent::getAttributes).filter(attr -> attr.getValue().contains("cdf")).collect(Collectors.toList());
Json cdfJson = new Json(cdf);
assertAll(() -> assertEquals(1, cdfs.size()), () -> assertEquals(cdfJson, cdfs.iterator().next()));
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsNotYarn.
@Test
public void testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsNotYarn() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
ClouderaManagerProductV4Request cdpRequest = new ClouderaManagerProductV4Request();
cdpRequest.setName("CDP");
cdpRequest.setParcel("parcel");
cdpRequest.setVersion("version");
cdpRequest.setCsd(List.of("csd"));
cmRequest.setProducts(List.of(cdpRequest));
ClouderaManagerRepositoryV4Request cmRepoRequest = new ClouderaManagerRepositoryV4Request();
cmRequest.setRepository(cmRepoRequest);
clusterV4Request.setCm(cmRequest);
boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, AWS_PLATFORM);
assertTrue(base);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndPlatformIsYarn.
@Test
public void testShouldUseBaseCMImageWithProductsAndPlatformIsYarn() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
ClouderaManagerProductV4Request cdpRequest = new ClouderaManagerProductV4Request();
cdpRequest.setName("CDP");
cdpRequest.setParcel("parcel");
cdpRequest.setVersion("version");
cdpRequest.setCsd(List.of("csd"));
cmRequest.setProducts(List.of(cdpRequest));
clusterV4Request.setCm(cmRequest);
boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, YARN_PLATFORM);
assertTrue(base);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request in project cloudbreak by hortonworks.
the class ClouderaManagerV1ToClouderaManagerV4Converter method convertProduct.
public ClouderaManagerProductV4Request convertProduct(ClouderaManagerProductV1Request source) {
ClouderaManagerProductV4Request response = new ClouderaManagerProductV4Request();
response.setName(source.getName());
response.setParcel(source.getParcel());
response.setVersion(source.getVersion());
response.setCsd(source.getCsd());
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request 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());
}
Aggregations