use of org.apache.geode.management.internal.cli.json.GfJsonArray in project geode by apache.
the class GemfireDataCommandsDUnitTest method validateJSONGetResult.
private void validateJSONGetResult(CommandResult cmdResult, String[] expectedCols) {
CompositeResultData rd = (CompositeResultData) cmdResult.getResultData();
SectionResultData section = rd.retrieveSectionByIndex(0);
TabularResultData table = section.retrieveTableByIndex(0);
GfJsonArray array = table.getHeaders();
assertEquals(expectedCols.length, array.size());
try {
for (String col : expectedCols) {
boolean found = false;
getLogWriter().info("Validating column " + col);
for (int i = 0; i < array.size(); i++) {
String header = (String) array.get(i);
if (col.equals(header))
found = true;
}
assertEquals(true, found);
}
} catch (GfJsonException e) {
fail("Error accessing table data", e);
}
}
use of org.apache.geode.management.internal.cli.json.GfJsonArray in project geode by apache.
the class GemfireDataCommandsDUnitTest method validateJSONGetResultValues.
private void validateJSONGetResultValues(CommandResult cmdResult, String[] expectedCols) {
CompositeResultData rd = (CompositeResultData) cmdResult.getResultData();
SectionResultData section = rd.retrieveSectionByIndex(0);
TabularResultData table = section.retrieveTableByIndex(0);
GfJsonArray array = table.getHeaders();
assertEquals(expectedCols.length, array.size());
try {
for (String col : expectedCols) {
boolean found = false;
getLogWriter().info("Validating column " + col);
for (int i = 0; i < array.size(); i++) {
String header = (String) array.get(i);
if (col.equals(header))
found = true;
}
assertEquals(true, found);
List<String> values = table.retrieveAllValues(col);
for (String value : values) {
assertNotSame("null", value);
}
}
} catch (GfJsonException e) {
fail("Error accessing table data", e);
}
}
Aggregations