private List<String> getFailedMemberIdsFromOutput(Map<String, Object> commandOutput) { List<String> memberIds = new ArrayList<String>(); for(Object obj : commandOutput.values()){ CommandResult result = (CommandResult)obj; if(result.getType().equals(ResultData.TYPE_TABULAR)){ TabularResultData table = (TabularResultData)result.getResultData(); List<String> statuses = table.retrieveAllValues("Status"); List<String> members = table.retrieveAllValues("Member"); for(int i=0;i<statuses.size();i++){ String status = statuses.get(i); String member = members.get(i); if(status.contains("ERROR")){ memberIds.add(member); HydraUtil.logFine("Command failed on member " + member); }else{ HydraUtil.logFine("Command Succeeded on member " + member + " for validation"); } } } } return memberIds; }
/** * Creates a {@link TabularResultData} object to start building result that * should be shown in a Tabular Format. * * @return TabularResultData instance */ public static TabularResultData createTabularResultData() { return new TabularResultData(); }
StringBuilder resultStr = new StringBuilder(); resultStr.append(newLine); table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES); table1.accumulate("Value", rstlist.get(0)); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = " + rstlist.get(0)); resultStr.append(newLine); table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM); table1.accumulate("Value", rstlist.get(1)); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = " + rstlist.get(1)); resultStr.append(newLine); table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED); table1.accumulate("Value", rstlist.get(2)); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = " + rstlist.get(2)); resultStr.append(newLine); table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES); table1.accumulate("Value", rstlist.get(3)); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = " + rstlist.get(3)); resultStr.append(newLine);
private TabularResultData getSharedConfigurationStatus(Set<DistributedMember> locators) { boolean isSharedConfigRunning = false; ResultCollector<?,?> rc = CliUtil.executeFunction(fetchSharedConfigStatusFunction, null, locators); List<CliFunctionResult> results = (List<CliFunctionResult>)rc.getResult(); TabularResultData table = ResultBuilder.createTabularResultData(); table.setHeader("Status of shared configuration on locators"); for (CliFunctionResult result : results) { table.accumulate(CliStrings.STATUS_SHARED_CONFIG_NAME_HEADER, result.getMemberIdOrName()); String status = (String) result.getSerializables()[0]; table.accumulate(CliStrings.STATUS_SHARED_CONFIG_STATUS, status); if (SharedConfigurationStatus.RUNNING.name().equals(status)) { isSharedConfigRunning = true; } } if (!isSharedConfigRunning) { table.setStatus(Status.ERROR); } return table; }
tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("Result", "ERROR: " + result.getThrowable().getClass().getName() + ": " + result.getThrowable().getMessage()); accumulatedData = true; tabularData.setStatus(Status.ERROR); } else { AsyncEventQueueDetails[] details = (AsyncEventQueueDetails[]) result.getSerializables(); for (int i = 0; i < details.length; i++) { tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("ID", details[i].getId()); tabularData.accumulate("Batch Size", details[i].getBatchSize()); tabularData.accumulate("Persistent", details[i].isPersistent()); tabularData.accumulate("Disk Store", details[i].getDiskStoreName()); tabularData.accumulate("Max Memory", details[i].getMaxQueueMemory()); tabularData.accumulate("Listener", details[i].getListener()); } else { StringBuilder propsStringBuilder = new StringBuilder(); tabularData.accumulate("Listener", details[i].getListener() + propsStringBuilder.toString());
protected void toTabularResultData(TabularResultData table, String memberId, String heapSizeBefore, String heapSizeAfter, String timeTaken) { table.accumulate(CliStrings.GC__MSG__MEMBER_NAME, memberId); table.accumulate(CliStrings.GC__MSG__HEAP_SIZE_BEFORE_GC, heapSizeBefore); table.accumulate(CliStrings.GC__MSG__HEAP_SIZE_AFTER_GC, heapSizeAfter); table.accumulate(CliStrings.GC__MSG__TOTAL_TIME_IN_GC, timeTaken); }
Object[][] rows = null; int rowCount = buildTable(table, startCount, endCount); GfJsonArray array = table.getHeaders(); headers = new String[array.size()]; rows = new Object[rowCount][array.size()]; for (int i = 0; i < array.size(); i++) { headers[i] = (String) array.get(i); List<String> list = table.retrieveAllValues(headers[i]); for (int j = 0; j < list.size(); j++) { rows[j][i] = list.get(j);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES); resultData.accumulate("Value", results.getTotalBucketCreateBytes()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = " + results.getTotalBucketCreateBytes()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM); resultData.accumulate("Value", results.getTotalBucketCreateTime()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = " + results.getTotalBucketCreateTime()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED); resultData.accumulate("Value", results.getTotalBucketCreatesCompleted()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = " + results.getTotalBucketCreatesCompleted()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES); resultData.accumulate("Value", results.getTotalBucketTransferBytes()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = " + results.getTotalBucketTransferBytes()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats",
metricsTable.setHeader("Cluster-wide Metrics");
tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("Un-Deployed JAR", ""); tabularData.accumulate("Un-Deployed JAR Location", "ERROR: " + result.getThrowable().getClass().getName() + ": " + result.getThrowable().getMessage()); accumulatedData = true; tabularData.setStatus(Status.ERROR); } else { String[] strings = (String[]) result.getSerializables(); for (int i = 0; i < strings.length; i += 2) { tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("Un-Deployed JAR", strings[i]); tabularData.accumulate("Un-Deployed From JAR Location", strings[i + 1]); accumulatedData = true; if (tabularData.getStatus().equals(Status.OK)) { result.setCommandPersisted((new SharedConfigurationWriter()).deleteJars(jars == null ? null : jars.split(","), groups));
try { TabularResultData table = section.retrieveTableByIndex(0); GfJsonArray array = table.getHeaders(); assertEquals(cols.length, array.size()); for (String col : cols) {
public TabularResultData addTable(String keyToAccess) { TabularResultData tabularResultData = ResultBuilder.createTabularResultData(); GfJsonObject tableData = tabularResultData.getGfJsonObject(); try { sectionGfJsonObject.putAsJSONObject(generateTableKey(keyToAccess), tableData); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } tablesCount++; return tabularResultData; }
tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("Result", "ERROR: " + result.getThrowable().getClass().getName() + ": " + result.getThrowable().getMessage()); accumulatedData = true; tabularData.setStatus(Status.ERROR); } else { AsyncEventQueueDetails[] details = (AsyncEventQueueDetails[]) result.getSerializables(); for (int i = 0; i < details.length; i++) { tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("ID", details[i].getId()); tabularData.accumulate("Batch Size", details[i].getBatchSize()); tabularData.accumulate("Persistent", details[i].isPersistent()); tabularData.accumulate("Disk Store", details[i].getDiskStoreName()); tabularData.accumulate("Max Memory", details[i].getMaxQueueMemory()); tabularData.accumulate("Listener", details[i].getListener()); } else { StringBuilder propsStringBuilder = new StringBuilder(); tabularData.accumulate("Listener", details[i].getListener() + propsStringBuilder.toString());
private void writeToBackupDisktoreTable(TabularResultData backedupDiskStoreTable, String memberId, String UUID, String host, String directory) { backedupDiskStoreTable.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_MEMBER, memberId); backedupDiskStoreTable.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_UUID, UUID); backedupDiskStoreTable.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_DIRECTORY, directory); backedupDiskStoreTable.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_HOST, host); }
Object[][] rows = null; int rowCount = buildTable(table, startCount, endCount); GfJsonArray array = table.getHeaders(); headers = new String[array.size()]; rows = new Object[rowCount][array.size()]; for (int i = 0; i < array.size(); i++) { headers[i] = (String) array.get(i); List<String> list = table.retrieveAllValues(headers[i]); for (int j = 0; j < list.size(); j++) { rows[j][i] = list.get(j);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES); resultData.accumulate("Value", results.getTotalBucketCreateBytes()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = " + results.getTotalBucketCreateBytes()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM); resultData.accumulate("Value", results.getTotalBucketCreateTime()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = " + results.getTotalBucketCreateTime()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED); resultData.accumulate("Value", results.getTotalBucketCreatesCompleted()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = " + results.getTotalBucketCreatesCompleted()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES); resultData.accumulate("Value", results.getTotalBucketTransferBytes()); resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = " + results.getTotalBucketTransferBytes()); resultStr.append(newLine); resultData.accumulate("Rebalanced Stats",
metricsTable.setHeader("Cluster-wide Metrics");
tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("Deployed JAR", ""); tabularData.accumulate("Deployed JAR Location", "ERROR: " + result.getThrowable().getClass().getName() + ": " + result.getThrowable().getMessage()); accumulatedData = true; tabularData.setStatus(Status.ERROR); } else { String[] strings = (String[]) result.getSerializables(); for (int i = 0; i < strings.length; i += 2) { tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("Deployed JAR", strings[i]); tabularData.accumulate("Deployed JAR Location", strings[i + 1]); accumulatedData = true; if (tabularData.getStatus().equals(Status.OK)){ result.setCommandPersisted((new SharedConfigurationWriter()).addJars(jarNames, jarBytes, groups));
public TabularResultData addTable(String keyToAccess) { TabularResultData tabularResultData = ResultBuilder.createTabularResultData(); GfJsonObject tableData = tabularResultData.getGfJsonObject(); try { sectionGfJsonObject.putAsJSONObject(generateTableKey(keyToAccess), tableData); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } tablesCount++; return tabularResultData; }
tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("JAR", ""); tabularData.accumulate("JAR Location", "ERROR: " + result.getThrowable().getClass().getName() + ": " + result.getThrowable().getMessage()); accumulatedData = true; tabularData.setStatus(Status.ERROR); } else { String[] strings = (String[]) result.getSerializables(); for (int i = 0; i < strings.length; i += 2) { tabularData.accumulate("Member", result.getMemberIdOrName()); tabularData.accumulate("JAR", strings[i]); tabularData.accumulate("JAR Location", strings[i + 1]); accumulatedData = true;