AmbariImpl extends AbstractSoftwareManager implements SoftwareManager { @Override public List<HadoopStack> getSupportedStacks() throws SoftwareManagementPluginException { List<HadoopStack> hadoopStacks = new ArrayList<HadoopStack>(); ApiStackList stackList = apiManager.getStackList(); for (ApiStack apiStack : stackList.getApiStacks()) { for (ApiStackVersion apiStackVersionSummary : apiManager .getStackVersionList(apiStack.getApiStackName().getStackName()) .getApiStackVersions()) { ApiStackVersionInfo apiStackVersionInfoSummary = apiStackVersionSummary.getApiStackVersionInfo(); ApiStackVersion apiStackVersion = apiManager.getStackVersion( apiStackVersionInfoSummary.getStackName(), apiStackVersionInfoSummary.getStackVersion()); ApiStackVersionInfo apiStackVersionInfo = apiStackVersion.getApiStackVersionInfo(); if (apiStackVersionInfo.isActive()) { HadoopStack hadoopStack = new HadoopStack(); hadoopStack.setDistro(apiStackVersionInfo.getStackName(), apiStackVersionInfo.getStackVersion()); hadoopStack .setFullVersion(apiStackVersionInfo.getStackVersion()); hadoopStack.setVendor(apiStackVersionInfo.getStackName()); List<String> roles = new ArrayList<String>(); ApiStackServiceList apiStackServiceList = apiManager.getStackServiceListWithComponents( hadoopStack.getVendor(), hadoopStack.getFullVersion()); for (ApiStackService apiStackService : apiStackServiceList .getApiStackServices()) { for (ApiStackComponent apiComponent : apiStackService .getServiceComponents()) { roles.add(apiComponent.getApiComponent() .getComponentName()); } } hadoopStack.setHveSupported(true); hadoopStack.setRoles(roles); hadoopStacks.add(hadoopStack); } } } return hadoopStacks; } AmbariImpl(String amServerHost, int port, String username,
         String password, String privateKey);  AmbariImpl(URL url, String username, String password, String privateKey); protected  AmbariImpl(AmbariManagerClientbuilder clientbuilder, String privateKey); @Override String getName(); @Override String getDescription(); @Override String getType(); @Override boolean echo(); @Override boolean validateServerVersion(); @Override HealthStatus getStatus(); @Override List<HadoopStack> getSupportedStacks(); @SuppressWarnings("unchecked") @Override String getSupportedConfigs(HadoopStack stack); @Override boolean createCluster(ClusterBlueprint blueprint,
         ClusterReportQueue reportQueue); @Override String exportBlueprint(String clusterName); @Override List<String> validateRolesForScaleOut(NodeGroupInfo group); @Override void validateRolesForShrink(NodeGroupInfo groupInfo); @Override void updateInfrastructure(ClusterBlueprint blueprint); @Override boolean reconfigCluster(ClusterBlueprint blueprint,
         ClusterReportQueue reports); @Override boolean scaleOutCluster(ClusterBlueprint blueprint, List<String> addedNodeNames,
         ClusterReportQueue reports, boolean forceScaleOut); boolean scaleOutCluster(ClusterBlueprint blueprint, List<String> addedNodeNames,
         ClusterReportQueue reports); boolean startCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reportQueue); @Override boolean startCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reports, boolean forceStart); @Override boolean deleteCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reports); @Override boolean onStopCluster(ClusterBlueprint clusterBlueprint, ClusterReportQueue reports); @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 ClusterReport queryClusterStatus(ClusterBlueprint blueprint); @Override boolean validateBlueprint(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(); ApiManager getApiManager(); void setApiManager(ApiManager apiManager); int getRequestMaxRetryTimes(); @Override boolean hasMountPointStartwithDatax(String clusterName); @Override void restartClusterRequiredServices(ClusterBlueprint blueprint, ClusterReportQueue reports); static final String MIN_SUPPORTED_VERSION; }
@Test(groups = { "TestAmbariImpl" }) public void testGetSupportedStacks() { List<HadoopStack> supportedStacks = provider.getSupportedStacks(); for (HadoopStack supportedStack : supportedStacks) { if (supportedStack.getFullVersion().equals(blueprint.getHadoopStack().getFullVersion())) { Assert.assertEquals(supportedStack.getDistro(), blueprint.getHadoopStack().getDistro()); Assert.assertEquals(supportedStack.getVendor(), blueprint.getHadoopStack().getVendor()); } } }