Package org.apache.wink.common.model.csv

Examples of org.apache.wink.common.model.csv.CsvTable


        return synd;
    }

    @Produces
    public CsvTable getCsv() {
        CsvTable cvs = new CsvTable("Id", "Name", "Severity", "Status", "Author");
        for (DefectBean defectBean : defects) {
            cvs.addRow(defectBean.getId(),
                       defectBean.getName(),
                       defectBean.getSeverity(),
                       defectBean.getStatus(),
                       defectBean.getAuthor());
        }
View Full Code Here


        return synd;
    }

    @Produces
    public CsvTable getCsv() {
        CsvTable cvs = new CsvTable("Id", "Name", "Severity", "Status", "Author");
        for (DefectBean defectBean : defects) {
            cvs.addRow(defectBean.getId(),
                       defectBean.getName(),
                       defectBean.getSeverity(),
                       defectBean.getStatus(),
                       defectBean.getAuthor());
        }
View Full Code Here

            return csv;
        }
    }

    public void testSingleTableWrite() {
        CsvTable table = createCsvTable();
        Iterator<String[]> entities = table.getEntities();
        int rows = 0;
        while (entities.hasNext()) {
            String[] next = entities.next();
            switch (rows) {
                case 0:
                    assertTrue(Arrays.deepEquals(TABLE1_HEADER, next));
                    break;
                case 1:
                    assertTrue(Arrays.deepEquals(TABLE1_ROW1, next));
                    break;
                case 2:
                    assertTrue(Arrays.deepEquals(TABLE1_ROW2, next));
                    break;
                case 3:
                    assertTrue(Arrays.deepEquals(TABLE1_ROW3, next));
                    break;
                default:
                    fail("too many rows");
            }
            ++rows;
        }
        assertEquals(rows, table.getRows().size());
    }
View Full Code Here

        }
        assertEquals(rows, table.getRows().size());
    }

    public void testSingleTableRead() {
        CsvTable table = new CsvTable();
        CsvTable writable = createCsvTable();
        Iterator<String[]> entities = writable.getEntities();
        while (entities.hasNext()) {
            String[] row = entities.next();
            table.addEntity(row);
        }
        assertCsvTable(table);
View Full Code Here

        assertEquals(200, response.getStatus());
        assertEquals(MULTI_CSV, response.getContentAsString());
    }

    public static CsvTable createCsvTable() {
        CsvTable table = new CsvTable(TABLE1_HEADER);
        table.addRow(TABLE1_ROW1);
        table.addRow(TABLE1_ROW2);
        table.addRow(TABLE1_ROW3);
        return table;
    }
View Full Code Here

        assertTrue(Arrays.deepEquals(TABLE1_ROW3, table.getRows().get(3)));
    }

    public static MultiCsvTable createMultiCsvTable() {
        MultiCsvTable descriptor = new MultiCsvTable();
        CsvTable table1 = descriptor.createCsvTable(TABLE1_HEADER);
        table1.addRow(TABLE1_ROW1);
        table1.addRow(TABLE1_ROW2);
        table1.addRow(TABLE1_ROW3);
        CsvTable table2 = descriptor.createCsvTable(TABLE2_HEADER);
        table2.addRow(TABLE2_ROW1);
        table2.addRow(TABLE2_ROW2);
        CsvTable table3 = descriptor.createCsvTable();
        table3.addRow(TABLE3_ROW1);
        table3.addRow(TABLE3_ROW2);
        return descriptor;
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.csv.CsvTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.