ClouderaManagerImpl extends AbstractSoftwareManager implements SoftwareManager { @Override public List<HadoopStack> getSupportedStacks() throws SoftwareManagementPluginException { String randomClusterName = UUID.randomUUID().toString(); final ApiClusterList clusterList = new ApiClusterList(); ApiCluster apiCluster = new ApiCluster(); apiCluster.setName(randomClusterName); apiCluster.setVersion(ApiClusterVersion.CDH5); clusterList.add(apiCluster); try { List<HadoopStack> hadoopStacks = new ArrayList<HadoopStack>(); apiResourceRootV6.getClustersResource().createClusters(clusterList); for (ApiParcel apiParcel : apiResourceRootV6.getClustersResource().getParcelsResource(randomClusterName) .readParcels(DataView.SUMMARY).getParcels()) { if (apiParcel.getProduct().equals(Constants.CDH_REPO_PREFIX)) { DefaultArtifactVersion parcelVersion = new DefaultArtifactVersion(apiParcel.getVersion()); HadoopStack stack = new HadoopStack(); stack.setDistro(apiParcel.getProduct(), parcelVersion.getMajorVersion() + "." + parcelVersion.getMinorVersion() + "." + parcelVersion.getIncrementalVersion()); stack.setFullVersion(apiParcel.getVersion()); stack.setVendor(Constants.CDH_DISTRO_VENDOR); List<String> roles = new ArrayList<String>(); for (String role : AvailableServiceRoleContainer.allRoles(apiParcel.getVersion())) { roles.add(role); } stack.setHveSupported(true); stack.setRoles(roles); hadoopStacks.add(stack); } } apiResourceRootV6.getClustersResource().deleteCluster(randomClusterName); return hadoopStacks; } catch (Exception e) { throw SoftwareManagementPluginException.RETRIEVE_SUPPORTED_STACKS_FAIL(e, Constants.CDH_PLUGIN_NAME); } } ClouderaManagerImpl();  ClouderaManagerImpl(String cmServerHost, int port, String user,
         String password, String privateKey);  ClouderaManagerImpl(URL url, String user, String password,
         String privateKey); RootResourceV6 getApiResourceRootV6(); @Override boolean validateServerVersion(); @Override String getName(); @Override String getDescription(); @Override String getType(); @Override List<HadoopStack> getSupportedStacks(); @Override String getSupportedConfigs(HadoopStack hadoopStack); @Override boolean validateBlueprint(ClusterBlueprint blueprint); @Override boolean createCluster(ClusterBlueprint blueprint,
         ClusterReportQueue reportQueue); @Override /** * @TODO better use a event-listener mode to decouple the reportQueue. lixl */ boolean reconfigCluster(ClusterBlueprint blueprint,
         ClusterReportQueue reportQueue); @Override boolean scaleOutCluster(ClusterBlueprint blueprint, List<String> addedNodeNames,
         ClusterReportQueue reportQueue, boolean forceScaleOut); @Override boolean deleteCluster(ClusterBlueprint clusterBlueprint,
         ClusterReportQueue reports); @Override boolean onStopCluster(ClusterBlueprint clusterBlueprint,
         ClusterReportQueue reportQueue); @Override boolean onDeleteCluster(ClusterBlueprint clusterBlueprint,
         ClusterReportQueue reports); @Override boolean onDeleteNodes(ClusterBlueprint blueprint, List<String> nodeNames); @Override boolean decomissionNodes(String clusterName, List<NodeInfo> nodes,
         ClusterReportQueue reports); @Override void decommissionNode(ClusterBlueprint blueprint, String nodeGroupName, String nodeName, ClusterReportQueue reportQueue); @Override boolean recomissionNode(String clusterName, NodeInfo node, ClusterReportQueue reportQueue); @Override boolean comissionNodes(String clusterName, List<NodeInfo> nodes,
         ClusterReportQueue reports); @Override boolean startNodes(String clusterName, List<NodeInfo> nodes,
         ClusterReportQueue reports); @Override boolean stopNodes(String clusterName, List<NodeInfo> nodes,
         ClusterReportQueue reports); @Override String exportBlueprint(String clusterName); @Override ClusterReport queryClusterStatus(ClusterBlueprint blueprint); @Override boolean echo(); @Override HealthStatus getStatus(); boolean startCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reportQueue); @Override boolean startCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reportQueue, boolean forceStart); String getCmServerHostId(); @Override List<String> validateRolesForScaleOut(NodeGroupInfo group); void validateRolesForShrink(NodeGroupInfo groupInfo); @Override void updateInfrastructure(ClusterBlueprint blueprint); @Override boolean hasHbase(ClusterBlueprint blueprint); @Override boolean hasMgmtRole(List<String> roles); @Override boolean isComputeOnlyRoles(List<String> roles); @Override boolean twoDataDisksRequired(NodeGroupInfo group); @Override boolean hasComputeMasterGroup(ClusterBlueprint blueprint); @Override String getVersion(); @Override HadoopStack getDefaultStack(); @Override boolean hasMountPointStartwithDatax(String clusterName); @Override void restartClusterRequiredServices(ClusterBlueprint blueprint,
         ClusterReportQueue reports); final String MIN_SUPPORTED_VERSION; }
@Test( groups = { "TestClouderaManagerImpl" }) public void testGetSupportedStacks() { List<HadoopStack> stacks = provider.getSupportedStacks(); Assert.assertTrue(stacks.get(0).getDistro().equals("CDH-5.0.2")); Assert.assertTrue(stacks.get(0).getRoles().contains("YARN_NODE_MANAGER")); Assert.assertTrue(stacks.get(1).getDistro().equals("CDH-4.7.0")); Assert.assertFalse(stacks.get(1).getRoles().contains("YARN_NODE_MANAGER")); }