use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.
the class RepositoryInfoToClouderaManagerInfoV4ResponseConverter method convert.
public ClouderaManagerInfoV4Response convert(RepositoryInfo source) {
ClouderaManagerInfoV4Response cmInfoJson = new ClouderaManagerInfoV4Response();
cmInfoJson.setVersion(source.getVersion());
cmInfoJson.setRepository(stringCMRepoDetailsMapToStringCMRepoDetailsJsonMap(source.getRepo()));
return cmInfoJson;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.
the class DefaultClouderaManagerRepoService method getDefault.
public ClouderaManagerRepo getDefault(String osType, String clusterType, String clusterVersion, ImageCatalogPlatform platform) throws CloudbreakImageCatalogException {
if (StackType.CDH.name().equals(clusterType)) {
StackMatrixV4Response stackMatrixV4Response = stackMatrixService.getStackMatrix(platform);
Map<String, ClouderaManagerStackDescriptorV4Response> stackDescriptorMap = stackMatrixV4Response.getCdh();
if (stackDescriptorMap != null) {
Optional<Entry<String, ClouderaManagerStackDescriptorV4Response>> descriptorEntry = stackDescriptorMap.entrySet().stream().filter(stackDescriptorEntry -> clusterVersion == null || clusterVersion.equals(stackDescriptorEntry.getKey())).max(Comparator.comparing(Entry::getKey));
if (descriptorEntry.isPresent()) {
Entry<String, ClouderaManagerStackDescriptorV4Response> stackDescriptorEntry = descriptorEntry.get();
ClouderaManagerInfoV4Response clouderaManagerInfoJson = stackDescriptorEntry.getValue().getClouderaManager();
if (clouderaManagerInfoJson.getRepository().get(osType) != null) {
ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
clouderaManagerRepo.setPredefined(false);
clouderaManagerRepo.setVersion(clouderaManagerInfoJson.getVersion());
clouderaManagerRepo.setBaseUrl(clouderaManagerInfoJson.getRepository().get(osType).getBaseUrl());
clouderaManagerRepo.setGpgKeyUrl(clouderaManagerInfoJson.getRepository().get(osType).getGpgKeyUrl());
return clouderaManagerRepo;
}
}
}
}
LOGGER.info("Missing Cloudera Manager Repo information for os: {} clusterType: {} clusterVersion: {}", osType, clusterType, clusterVersion);
return null;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.
the class StackMatrixService method getImageBasedCMStackDescriptor.
private ClouderaManagerStackDescriptorV4Response getImageBasedCMStackDescriptor(DefaultCDHInfo stackInfo, Image image) {
ClouderaManagerStackDescriptorV4Response stackDescriptorV4 = stackInfoToClouderaManagerStackDescriptorV4ResponseConverter.convert(stackInfo);
RepositoryInfo cmInfo = new RepositoryInfo();
cmInfo.setVersion(image.getPackageVersion(ImagePackageVersion.CM));
cmInfo.setRepo(image.getRepo().entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> {
RepositoryDetails repo = new RepositoryDetails();
repo.setBaseurl(e.getValue());
return repo;
})));
ClouderaManagerInfoV4Response cmInfoJson = repositoryInfoToClouderaManagerInfoV4ResponseConverter.convert(cmInfo);
stackDescriptorV4.setClouderaManager(cmInfoJson);
for (ClouderaManagerProduct parcel : stackInfo.getParcels()) {
stackDescriptorV4.getProducts().add(ClouderaManagerProductToClouderaManagerProductV4Response.convert(parcel));
}
stackDescriptorV4.setProductDefinitions(stackInfo.getCsd());
return stackDescriptorV4;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.
the class DefaultClouderaManagerRepoServiceTest method init.
@Before
public void init() throws Exception {
StackMatrixV4Response stackMatrixV4Response = new StackMatrixV4Response();
Map<String, ClouderaManagerStackDescriptorV4Response> cdhMap = new HashMap<>();
ClouderaManagerInfoV4Response clouderaManagerInfoJson610 = new ClouderaManagerInfoV4Response();
clouderaManagerInfoJson610.setVersion("6.1.0");
clouderaManagerInfoJson610.setRepository(RepoTestUtil.getClouderaManagerRepositoryResponse("6.1.0"));
ClouderaManagerInfoV4Response clouderaManagerInfoJson620 = new ClouderaManagerInfoV4Response();
clouderaManagerInfoJson620.setVersion("6.2.0");
clouderaManagerInfoJson620.setRepository(RepoTestUtil.getClouderaManagerRepositoryResponse("6.2.0"));
ClouderaManagerStackDescriptorV4Response cdhDescriptor610 = new ClouderaManagerStackDescriptorV4Response();
cdhDescriptor610.setClouderaManager(clouderaManagerInfoJson610);
cdhMap.put("6.1.0", cdhDescriptor610);
ClouderaManagerStackDescriptorV4Response cdhDescriptor620 = new ClouderaManagerStackDescriptorV4Response();
cdhDescriptor620.setClouderaManager(clouderaManagerInfoJson620);
cdhMap.put("6.2.0", cdhDescriptor620);
stackMatrixV4Response.setCdh(cdhMap);
when(stackMatrixService.getStackMatrix(null)).thenReturn(stackMatrixV4Response);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.
the class StackMatrixServiceTest method getStackMatrixWithoutAmbari.
@Test
public void getStackMatrixWithoutAmbari() throws Exception {
setupStackEntries();
when(repositoryInfoToClouderaManagerInfoV4ResponseConverter.convert(any(RepositoryInfo.class))).thenReturn(new ClouderaManagerInfoV4Response());
StackMatrixV4Response stackMatrixV4Response = stackMatrixService.getStackMatrix(WORKSPACE_ID, IMAGECATALOGPLATFORM, IMAGE_CATALOG_NAME);
assertEquals(1L, stackMatrixV4Response.getCdh().size());
assertEquals("6.1.0-1.cdh6.1.0.p0.770702", stackMatrixV4Response.getCdh().get("6.1.0").getVersion());
assertNull(stackMatrixV4Response.getCdh().get("6.1.0").getClouderaManager().getRepository());
assertNull(stackMatrixV4Response.getCdh().get("6.1.0").getClouderaManager().getVersion());
}
Aggregations