public SectionResultData addSection() { return addSection(String.valueOf(subsectionCount)); }
TabularResultData table1 = rebalanceResultData.addSection().addTable("Table" + index); String newLine = System.getProperty("line.separator"); StringBuilder resultStr = new StringBuilder();
Result getResult() { CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData(); compositeResultData.setHeader( "************************* Execution Summary ***********************\nScript file: " + filePath); for (int i = 0; i < this.commandAndStatusList.size(); i++) { int commandSrNo = i + 1; CompositeResultData.SectionResultData section = compositeResultData.addSection("" + (i + 1)); CommandAndStatus commandAndStatus = commandAndStatusList.get(i); section.addData("Command-" + String.valueOf(commandSrNo), commandAndStatus.command); section.addData("Status", commandAndStatus.status); if (commandAndStatus.status.equals("FAILED")) { compositeResultData.setStatus(Result.Status.ERROR); } if (i != this.commandAndStatusList.size()) { section.setFooter(Gfsh.LINE_SEPARATOR); } } return ResultBuilder.buildResult(compositeResultData); }
Map<String, GatewayReceiverMXBean> gatewayReceiverBeans) { if (!gatewaySenderBeans.isEmpty()) { TabularResultData gatewaySenderData = crd.addSection(CliStrings.SECTION_GATEWAY_SENDER) .addTable(CliStrings.TABLE_GATEWAY_SENDER).setHeader(CliStrings.HEADER_GATEWAY_SENDER); for (Map.Entry<String, Map<String, GatewaySenderMXBean>> entry : gatewaySenderBeans TabularResultData gatewayReceiverData = crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER) .addTable(CliStrings.TABLE_GATEWAY_RECEIVER) .setHeader(CliStrings.HEADER_GATEWAY_RECEIVER);
&& StringUtils.isNotEmpty(((PartitionRebalanceInfo) iterator.next()).getRegionPath())) { final TabularResultData resultData = rebalanceResultData.addSection().addTable("Table" + index); String newLine = System.getProperty("line.separator"); StringBuilder resultStr = new StringBuilder();
Result result; CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData(); CompositeResultData.SectionResultData section = compositeResultData.addSection("section1");
} else { if (i == memberPR.dsMemberList.size() - 1) { rebalanceResultData.addSection().addData( CliStrings.format( CliStrings.REBALANCE__MSG__NO_EXECUTION_FOR_REGION_0_ON_MEMBERS_1, rebalanceResultData.addSection().addData( CliStrings.format( CliStrings.REBALANCE__MSG__NO_EXECUTION_FOR_REGION_0_ON_MEMBERS_1,
for (Object object : resultList) { if (object instanceof Exception) { rebalanceResultData.addSection().addData( CliStrings.format(CliStrings.REBALANCE__MSG__NO_EXECUTION, member.getId()), ((Exception) object).getMessage()); break; } else if (object instanceof Throwable) { rebalanceResultData.addSection().addData( CliStrings.format(CliStrings.REBALANCE__MSG__NO_EXECUTION, member.getId()), ((Throwable) object).getMessage()); LogWrapper.getInstance(getCache()).info( "Rebalancing for member=" + member.getId() + ", resultList is either null or empty"); rebalanceResultData.addSection().addData("Rebalancing for member=" + member.getId(), ", resultList is either null or empty"); toContinueForOtherMembers = true;
@Test public void emptySection() { CompositeResultData result = new CompositeResultData(); result.addSection(); GfJsonObject json = result.getGfJsonObject(); assertThat(json.getJSONObject("content").getString("__sections__-0")).isEqualTo("{}"); }
@Test public void compositeResultDataStructure() { CompositeResultData result = ResultBuilder.createCompositeResultData(); result.setHeader("Heads"); result.setFooter("Tails"); // build up an example result.addSection().addData("section 0 key", "section 0 value"); result.addSection().addTable().accumulate("table 1 column", "table 1 value"); CommandResult cmdResult = ResultBuilder.buildResult(result); assertThat(cmdResult.getHeader()).isEqualTo("Heads"); assertThat(cmdResult.getFooter()).isEqualTo("Tails"); assertThat(cmdResult.getMapFromSection("0").get("section 0 key")).isEqualTo("section 0 value"); Map<String, List<String>> table = cmdResult.getMapFromTableContent("1", "0"); assertThat(table.get("table 1 column")).contains("table 1 value"); }
@Test public void withSection_andHeader_andFooter() { CompositeResultData result = new CompositeResultData(); String header = "this header left blank"; String footer = "this footer left blank"; result.addSection(); result.setHeader(header); result.setFooter(footer); GfJsonObject json = result.getGfJsonObject(); assertThat(json.getJSONObject("content").getString("__sections__-0")).isEqualTo("{}"); assertThat(json.getString("footer")).isEqualTo(footer); assertThat(json.getString("header")).isEqualTo(header); }
Result result; CompositeResultData gcResultTable = ResultBuilder.createCompositeResultData(); TabularResultData resultTable = gcResultTable.addSection().addTable("Table1"); String headerText = "GC Summary"; resultTable.setHeader(headerText);
@Test public void withSectionContainingRawData() { CompositeResultData result = new CompositeResultData(); CompositeResultData.SectionResultData section = result.addSection(); section.addData("my-data", "some random string"); assertThat(result.getGfJsonObject().getJSONObject("content").getJSONObject("__sections__-0") .getString("my-data")).isEqualTo("some random string"); } }
CompositeResultData.SectionResultData section = compositeResultData.addSection("section"); TabularResultData resultTable = section.addTable("ChangeLogLevel"); resultTable = resultTable.setHeader("Summary");
CompositeResultData.SectionResultData regionSection = crd.addSection(); regionSection.addSeparator('-'); regionSection.addData("Name", regionDescription.getName());
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception_1, member.getId(), ex.getMessage()), ex); rebalanceResultData.addSection() .addData(CliStrings.format( CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception, CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception_1, member.getId(), ex.getMessage()), ex); rebalanceResultData.addSection() .addData(CliStrings.format( CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception,
@Test public void withNestedSectionContainingASingleTable() { CompositeResultData result = new CompositeResultData(); String outerHeader = "this outerHeader left blank"; String outerFooter = "this outerFooter left blank"; result.setHeader(outerHeader); result.setFooter(outerFooter); CompositeResultData.SectionResultData section = result.addSection(); String tableSurround = "this surround left blank"; section.addTable(); section.setHeader(tableSurround); section.setFooter(tableSurround); GfJsonObject json = result.getGfJsonObject(); assertThat(json.getJSONObject("content").getJSONObject("__sections__-0") .getJSONObject("__tables__-0").getString("content")).isEqualTo("{}"); assertThat(json.getString("footer")).isEqualTo(outerFooter); assertThat(json.getString("header")).isEqualTo(outerHeader); assertThat(json.getJSONObject("content").getJSONObject("__sections__-0").getString("header")) .isEqualTo(tableSurround); assertThat(json.getJSONObject("content").getJSONObject("__sections__-0").getString("footer")) .isEqualTo(tableSurround); CompositeResultData.SectionResultData resultSection = result.retrieveSectionByIndex(0); assertThat(resultSection.getSectionGfJsonObject().getString("header")).isEqualTo(tableSurround); assertThat(resultSection.getSectionGfJsonObject().getString("footer")).isEqualTo(tableSurround); assertThat(resultSection.retrieveTable("0").getGfJsonObject().getString("content")) .isEqualTo("{}"); }
@Test public void withTableContainingData() { CompositeResultData result = new CompositeResultData(); CompositeResultData.SectionResultData section = result.addSection(); TabularResultData table = section.addTable(); table.accumulate("column1", 1); table.accumulate("column1", "abc"); table.accumulate("column1", 2); assertThat(result.getGfJsonObject().getJSONObject("content").getJSONObject("__sections__-0") .getJSONObject("__tables__-0").getJSONObject("content").getString("column1")) .isEqualTo("[1,\"abc\",2]"); }
memberInformation.setProcessId("" + memberToBeDescribed.getProcessId()); CompositeResultData.SectionResultData section = crd.addSection(); section.addData("Name", memberInformation.getName()); section.addData("Id", memberInformation.getId()); CompositeResultData.SectionResultData clientServiceSection = crd.addSection(); List<CacheServerInfo> csList = memberInformation.getCacheServeInfo();
TabularResultData table1 = legacyCrd.addSection().addTable(); table1.setHeader("section-0 table-1 header"); table1.accumulate("Parameter", "param1"); CompositeResultData.SectionResultData section1 = legacyCrd.addSection(); section1.setHeader("section 0 header"); section1.addSeparator('-'); CompositeResultData.SectionResultData section2 = legacyCrd.addSection("named-section"); section2.setHeader("named section header"); section2.addSeparator('-');