// test special (non-string) key in row doesn't throw public void testTextNonStringKey() throws Exception { MockStatusAccessor statusAccessor = new MockStatusAccessor(); List cols = ListUtil.list("foo", StatusTable.ROW_SEPARATOR); statusAccessor.setRows(MockStatusAccessor.makeRowsFrom(cols, rowArray1), null); statusAccessor.setColumnDescriptors( MockStatusAccessor.makeColumnDescriptorsFrom(colArray1), null); statSvc.registerStatusAccessor("testtbl", statusAccessor); WebResponse resp = getTable("testtbl", true); log.debug(resp.getText()); }
// test null value in rows doesn't throw public void testTextNull() throws Exception { MockStatusAccessor statusAccessor = MockStatusAccessor.generateStatusAccessor(colArray1, rowArrayWithNulls); statSvc.registerStatusAccessor("testtbl", statusAccessor); WebResponse resp = getTable("testtbl", true); log.debug(resp.getText()); List lines = getLines(resp); assertEqualTables(tableWithNulls, lines); }
public void testText() throws Exception { MockStatusAccessor statusAccessor = MockStatusAccessor.generateStatusAccessor(colArray1, rowArray1); statusAccessor.setTitle("testtbl", null); statSvc.registerStatusAccessor("testtbl", statusAccessor); WebResponse resp = getTable("testtbl", true); assertResponseOk(resp); assertEquals("Content type", "text/plain", resp.getContentType()); log.debug(resp.getText()); List lines = getLines(resp); assertEquals(rowArray1.length + 3, lines.size()); Map row0 = getRow((String) lines.get(0)); assertEquals("2.4.6.8", row0.get("host")); Map row2 = getRow((String) lines.get(2)); assertEquals("testtbl", row2.get("table")); assertEqualTables(table1, lines); }