Search in sources :

Example 6 with RowGroup

use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.

the class TableBuilderJUnitTest method testSeparatorWithMultipleChars.

@Test
public void testSeparatorWithMultipleChars() 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-<|>123..", result.get(3));
}
Also used : Table(org.apache.geode.management.internal.cli.result.TableBuilder.Table) RowGroup(org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup) Row(org.apache.geode.management.internal.cli.result.TableBuilder.Row) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 7 with RowGroup

use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.

the class TableBuilderJUnitTest method testMultipleColumnsTruncated.

@Test
public void testMultipleColumnsTruncated() throws Exception {
    assertTrue(TableBuilderHelper.shouldTrimColumns());
    Table table = createTableStructure(4, "|");
    RowGroup rowGroup = table.getLastRowGroup();
    Row row1 = rowGroup.newRow();
    row1.newLeftCol("1").newLeftCol("123456789-").newLeftCol("123456789-123456789-123456789-").newLeftCol("123456789-123456789-12345");
    List<String> result = validateTable(table, true);
    // Check the last line
    assertEquals("1     |123456789-|123456789..|1234567..", result.get(3));
}
Also used : Table(org.apache.geode.management.internal.cli.result.TableBuilder.Table) RowGroup(org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup) Row(org.apache.geode.management.internal.cli.result.TableBuilder.Row) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 8 with RowGroup

use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.

the class TableBuilderJUnitTest method testDisableColumnAdjustment.

/**
   * set gfsh env property result_viewer to basic disable for external reader
   */
@Test
public void testDisableColumnAdjustment() throws Exception {
    when(TableBuilderHelper.class, "shouldTrimColumns").thenReturn(false);
    assertFalse(TableBuilderHelper.shouldTrimColumns());
    Table table = createTableStructure(5, "|");
    RowGroup rowGroup = table.getLastRowGroup();
    Row row1 = rowGroup.newRow();
    row1.newLeftCol("1").newLeftCol("123456789-").newLeftCol("123456789-").newLeftCol("123456789-123456789-12345").newLeftCol("1");
    List<String> result = validateTable(table, false);
    // Check the last line
    assertEquals("1     |123456789-|123456789-|123456789-123456789-12345|1", result.get(3));
}
Also used : Table(org.apache.geode.management.internal.cli.result.TableBuilder.Table) TableBuilderHelper(org.apache.geode.management.internal.cli.result.TableBuilderHelper) RowGroup(org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup) Row(org.apache.geode.management.internal.cli.result.TableBuilder.Row) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 9 with RowGroup

use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.

the class TableBuilderJUnitTest method testLongestColumnFirstTruncated.

@Test
public void testLongestColumnFirstTruncated() throws Exception {
    assertTrue(TableBuilderHelper.shouldTrimColumns());
    Table table = createTableStructure(4, "|");
    RowGroup rowGroup = table.getLastRowGroup();
    Row row1 = rowGroup.newRow();
    row1.newLeftCol("123456789-123456789-").newLeftCol("123456789-12345").newLeftCol("123456789-").newLeftCol("1");
    List<String> result = validateTable(table, true);
    // Check the last line
    assertEquals("1234..|123456789-12345|123456789-|1", result.get(3));
}
Also used : Table(org.apache.geode.management.internal.cli.result.TableBuilder.Table) RowGroup(org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup) Row(org.apache.geode.management.internal.cli.result.TableBuilder.Row) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 10 with RowGroup

use of org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup in project geode by apache.

the class TableBuilderJUnitTest method testMultipleColumnsTruncatedLongestFirst.

@Test
public void testMultipleColumnsTruncatedLongestFirst() throws Exception {
    assertTrue(TableBuilderHelper.shouldTrimColumns());
    Table table = createTableStructure(4, "|");
    RowGroup rowGroup = table.getLastRowGroup();
    Row row1 = rowGroup.newRow();
    row1.newLeftCol("123456789-123456789-123456789-").newLeftCol("123456789-123456789-12345").newLeftCol("1").newLeftCol("123456789-");
    List<String> result = validateTable(table, true);
    // Check the last line
    assertEquals("123456789..|1234567..|1     |123456789-", result.get(3));
}
Also used : Table(org.apache.geode.management.internal.cli.result.TableBuilder.Table) RowGroup(org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup) Row(org.apache.geode.management.internal.cli.result.TableBuilder.Row) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

Row (org.apache.geode.management.internal.cli.result.TableBuilder.Row)14 RowGroup (org.apache.geode.management.internal.cli.result.TableBuilder.RowGroup)14 Table (org.apache.geode.management.internal.cli.result.TableBuilder.Table)12 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)11 Test (org.junit.Test)11 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)11 TableBuilderHelper (org.apache.geode.management.internal.cli.result.TableBuilderHelper)3 GfJsonObject (org.apache.geode.management.internal.cli.json.GfJsonObject)2 HashMap (java.util.HashMap)1 GfJsonArray (org.apache.geode.management.internal.cli.json.GfJsonArray)1 GfJsonException (org.apache.geode.management.internal.cli.json.GfJsonException)1