Package no.priv.garshol.duke.datasources

Examples of no.priv.garshol.duke.datasources.Column


    assertEquals("c", r.getValue("F3"));
  }

  @Test
  public void testMissingHeader() throws IOException {
    source.addColumn(new Column("F1", null, null, null));
    source.addColumn(new Column("F2", null, null, null));
    source.addColumn(new Column("F3", null, null, null));

    try {
      RecordIterator it = read("", ';');
      fail("accepted file with no header");
    } catch (DukeException e) {
View Full Code Here


  private JsonDataSource source;

  @Before
  public void setup() {
    source = new JsonDataSource();
    source.addColumn(new Column("F1", null, null, null));
    source.addColumn(new Column("F2", null, null, null));
    source.addColumn(new Column("F3", null, null, null));
  }
View Full Code Here

  @Test
  public void testOneRow() {
    perform("insert into testdata values (1, 'foo')");

    source.addColumn(new Column("ID", null, null, null));
    source.addColumn(new Column("NAME", null, null, null));
       
    RecordIterator it = source.getRecords();
    assertTrue(it.hasNext());

    Record r = it.next();
View Full Code Here

  @Test
  public void testOneRowSkipColumn() {
    perform("insert into testdata values (1, 'foo')");

    source.addColumn(new Column("ID", null, null, null));
       
    RecordIterator it = source.getRecords();
    assertTrue(it.hasNext());

    Record r = it.next();
View Full Code Here

    RegexpCleaner givencleaner = new RegexpCleaner();
    givencleaner.setRegexp(", (.+)");
    RegexpCleaner familycleaner = new RegexpCleaner();
    familycleaner.setRegexp("^([^,]+), ");
   
    source.addColumn(new Column("ID", null, null, null));
    source.addColumn(new Column("NAME", "GIVENNAME", null, givencleaner));
    source.addColumn(new Column("NAME", "FAMILYNAME", null, familycleaner));
       
    RecordIterator it = source.getRecords();
    assertTrue(it.hasNext());

    Record r = it.next();
View Full Code Here

  public void testNull() {
    perform("insert into testdata values (1, NULL)");

    LowerCaseNormalizeCleaner cleaner = new LowerCaseNormalizeCleaner();
   
    source.addColumn(new Column("ID", null, null, null));
    source.addColumn(new Column("NAME", "GIVENNAME", null, cleaner));
       
    RecordIterator it = source.getRecords();
    assertTrue(it.hasNext());

    Record r = it.next();
View Full Code Here

  @Test
  public void testSplitting() {
    perform("insert into testdata values (1, 'foo bar baz')");

    source.addColumn(new Column("ID", null, null, null));
    Column col = new Column("NAME", null, null, null);
    col.setSplitOn(" ");
    source.addColumn(col);
       
    RecordIterator it = source.getRecords();
    assertTrue(it.hasNext());
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.datasources.Column

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.