use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.
the class TableBuilderJUnitTest method createTableStructure.
private Table createTableStructure(int cols, String separator, String... colNames) {
Table resultTable = TableBuilder.newTable();
resultTable.setTabularResult(true);
resultTable.setColumnSeparator(separator);
resultTable.newBlankRow();
RowGroup rowGroup = resultTable.newRowGroup();
Row row = rowGroup.newRow();
for (int colIndex = 0; colIndex < cols; colIndex++) {
row.newCenterCol(colNames[colIndex] + colIndex);
}
rowGroup.newRowSeparator('-', false);
return resultTable;
}
use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.
the class TableBuilderJUnitTest method testManyColumns.
/**
* multiple columns upto 8 : done
*/
@Test
public void testManyColumns() throws Exception {
assertTrue(TableBuilderHelper.shouldTrimColumns());
Table table = createTableStructure(8, "|");
RowGroup rowGroup = table.getLastRowGroup();
Row row1 = rowGroup.newRow();
row1.newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-");
List<String> result = validateTable(table, true);
// Check the last line
assertEquals("123456789-|123456789-|..|..|..|..|..|..", result.get(3));
}
use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.
the class TableBuilderJUnitTest method testSanity.
/**
* Test Variations table-wide separator true false
*/
@Test
public void testSanity() throws Exception {
assertTrue(TableBuilderHelper.shouldTrimColumns());
Table table = createTableStructure(3, "|");
RowGroup rowGroup = table.getLastRowGroup();
Row row1 = rowGroup.newRow();
row1.newLeftCol("1").newLeftCol("1").newLeftCol("1");
List<String> result = validateTable(table, true);
// Check the last line
assertEquals("1 |1 |1", result.get(3));
}
use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.
the class TableBuilderJUnitTest method testColumnsWithShortNames.
@Test
public void testColumnsWithShortNames() throws Exception {
when(TableBuilderHelper.class, "getScreenWidth").thenReturn(9);
assertTrue(TableBuilderHelper.shouldTrimColumns());
Table table = createTableStructure(3, "|", "A", "A", "A");
RowGroup rowGroup = table.getLastRowGroup();
Row row1 = rowGroup.newRow();
row1.newLeftCol("123").newLeftCol("123").newLeftCol("123");
List<String> result = validateTable(table, true);
// Check the last line
assertEquals("..|..|..", result.get(3));
}
use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.
the class TableBuilderJUnitTest method testLastColumnTruncated.
@Test
public void testLastColumnTruncated() throws Exception {
assertTrue(TableBuilderHelper.shouldTrimColumns());
Table table = createTableStructure(4, "|");
RowGroup rowGroup = table.getLastRowGroup();
Row row1 = rowGroup.newRow();
row1.newLeftCol("1").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-123456789-12345");
List<String> result = validateTable(table, true);
// Check the last line
assertEquals("1 |123456789-|123456789-|123456789..", result.get(3));
}
Aggregations