use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request 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.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class AutoTlsFlagPreparatoryTest method testAutoTlsSettingFromRequest.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
public void testAutoTlsSettingFromRequest(String value) {
ClusterV4Request request = new ClusterV4Request();
request.setCm(new ClouderaManagerV4Request());
request.getCm().setEnableAutoTls(Boolean.valueOf(value));
boolean result = underTest.provideAutoTlsFlag(request, new Stack(), Optional.empty());
verifyNoInteractions(cloudPlatformConnectors);
assertEquals(Boolean.valueOf(value), result);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class ClusterToClusterV4RequestConverterTest method testConvertWhenClouderaManagerConversionSuccessfulThenExpectedClouderaManagerV4RequestShouldPlacedIn.
@Test
public void testConvertWhenClouderaManagerConversionSuccessfulThenExpectedClouderaManagerV4RequestShouldPlacedIn() {
ClouderaManagerV4Request expected = mock(ClouderaManagerV4Request.class);
when(clouderaManagerV4RequestConverter.convert(cluster)).thenReturn(expected);
ClusterV4Request result = underTest.convert(cluster);
assertEquals(expected, result.getCm());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request 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.ClouderaManagerV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceTest method testShouldUseBaseCMImageShouldReturnTrueWithCMImageWithCmRepoAndImageIsNotPresentAndPlatformIsYarn.
@Test
public void testShouldUseBaseCMImageShouldReturnTrueWithCMImageWithCmRepoAndImageIsNotPresentAndPlatformIsYarn() {
ClusterV4Request clusterV4Request = new ClusterV4Request();
ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
ClouderaManagerRepositoryV4Request cmRepoRequest = new ClouderaManagerRepositoryV4Request();
cmRequest.setRepository(cmRepoRequest);
clusterV4Request.setCm(cmRequest);
boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, YARN_PLATFORM);
assertTrue(base);
}
Aggregations