AmbariImpl extends AbstractSoftwareManager implements SoftwareManager { @Override public boolean scaleOutCluster(ClusterBlueprint blueprint, List<String> addedNodeNames, ClusterReportQueue reports, boolean forceScaleOut) throws SoftwareManagementPluginException { boolean success = false; AmClusterDef clusterDef = null; try { logger.info("Blueprint:"); logger.info(ApiUtils.objectToJson(blueprint)); logger.info("Start cluster " + blueprint.getName() + " scale out."); setHaseRegionConfig(blueprint); logger.info("After config hbase for Blueprint:"); logger.info(ApiUtils.objectToJson(blueprint)); clusterDef = new AmClusterDef(blueprint, privateKey, getVersion()); ReflectionUtils.getPreStartServicesHook().preStartServices(clusterDef.getName(), addedNodeNames, forceScaleOut); bootstrap(clusterDef, addedNodeNames, reports, forceScaleOut); provisionComponents(clusterDef, addedNodeNames, reports); setClusterHostsRackInfo(clusterDef, addedNodeNames); restartRequiredServices(clusterDef, reports); success = true; clusterDef.getCurrentReport().setNodesAction("", addedNodeNames); clusterDef.getCurrentReport().setNodesStatus(ServiceStatus.STARTED, addedNodeNames); clusterDef.getCurrentReport().setProgress( ProgressSplit.PROVISION_SUCCESS.getProgress()); clusterDef.getCurrentReport().setSuccess(true); } catch (Exception e) { clusterDef.getCurrentReport().clearAllNodesErrorMsg(); clusterDef.getCurrentReport().setAction(""); clusterDef.getCurrentReport().setNodesError( "Failed to bootstrap nodes for " + e.getMessage(), addedNodeNames); clusterDef.getCurrentReport().setSuccess(false); String errorMessage = errorMessage("Failed to scale out cluster " + blueprint.getName(), e); logger.error(errorMessage, e); throw SoftwareManagementPluginException.SCALE_OUT_CLUSTER_FAILED(e, Constants.AMBARI_PLUGIN_NAME, blueprint.getName()); } finally { clusterDef.getCurrentReport().setFinished(true); reportStatus(clusterDef.getCurrentReport(), reports); } return success; } 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" }, dependsOnMethods = { "testStatusQuery" }) public void testClusterScaleOut() { ClusterReportQueue queue = new ClusterReportQueue(); List<String> addedNodeNames = new ArrayList<String>(); addedNodeNames.add("cluster01-backup-0"); addedNodeNames.add("cluster01-worker-0"); Assert.assertTrue(provider.scaleOutCluster(blueprint, addedNodeNames, queue)); }