Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.RecordIterator


        {"http://a/2", "http://a/name", "2"},
        {"http://a/2", "http://a/age", "23"},
        {"http://a/3", "http://a/name", "3"},
        {"http://a/3", "http://a/age", "2323"}});
   
    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "1", r.getValue("NAME"));
    assertEquals("wrong AGE", "32", r.getValue("AGE"));

    assertTrue("data source contains only one record", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
    assertEquals("wrong NAME", "2", r.getValue("NAME"));
    assertEquals("wrong AGE", "23", r.getValue("AGE"));   

    assertTrue("data source contains only two records", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/3", r.getValue("ID"));
    assertEquals("wrong NAME", "3", r.getValue("NAME"));
    assertEquals("wrong AGE", "2323", r.getValue("AGE"));   
   
    assertFalse("data source contains more than three records", it.hasNext());
    assertEquals("wrong number of pages", pages, source.getPages());
  }
View Full Code Here


        {"http://a/1", "http://a/name", "1"},
        {"http://a/1", "http://a/age", "32"},
        {"http://a/2", "http://a/name", "2"},
        {"http://a/2", "http://a/age", "23"}});
   
    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "1", r.getValue("NAME"));
    assertEquals("wrong AGE", "32", r.getValue("AGE"));

    assertTrue("data source contains only one record", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
    assertEquals("wrong NAME", "2", r.getValue("NAME"));
    assertEquals("wrong AGE", "23", r.getValue("AGE"));   
   
    assertFalse("data source contains more than two records", it.hasNext());
    assertEquals("wrong number of pages", 1, source.getPages());
  }
View Full Code Here

  @Test
  public void testSingleRow() {
    setupTabularConfig1();
    source.setRows(new String[][] {{"http://a/1", "Peter", "15"}});
   
    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
    assertEquals("wrong AGE", "15", r.getValue("AGE"));

    assertFalse("data source contains more than one record", it.hasNext());
    assertEquals("wrong number of pages", 2, source.getPages());
  }
View Full Code Here

    setupTabularConfig1();
    source.setRows(new String[][] {
        {"http://a/1", "Peter", "15"},
        {"http://a/2", "George", "151"}});
   
    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
    assertEquals("wrong AGE", "15", r.getValue("AGE"));

    assertTrue("data source contains only one record", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
    assertEquals("wrong NAME", "George", r.getValue("NAME"));
    assertEquals("wrong AGE", "151", r.getValue("AGE"));   
   
    assertFalse("data source contains more than two records", it.hasNext());
    assertEquals("wrong number of pages", 2, source.getPages());
  }
View Full Code Here

    setupTabularConfig1();
    // this column is not configured, so Duke should just ignore it
    source.setVariables(new String[] {"ID", "NAME", "AGE", "EXTRA"});
    source.setRows(new String[][] {{"http://a/1", "Peter", "15", "ignore"}});
   
    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
    assertEquals("wrong AGE", "15", r.getValue("AGE"));

    assertFalse("data source contains more than one record", it.hasNext());
    assertEquals("wrong number of pages", 2, source.getPages());
  }
View Full Code Here

    source.setPageSize(1);
    source.setRows(new String[][] {
        {"http://a/1", "Peter", "15"},
        {"http://a/2", "George", "151"}});

    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
    assertEquals("wrong AGE", "15", r.getValue("AGE"));

    assertTrue("data source contains only one record", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
    assertEquals("wrong NAME", "George", r.getValue("NAME"));
    assertEquals("wrong AGE", "151", r.getValue("AGE"));   

    assertFalse("data source contains more than two records", it.hasNext());
    assertEquals("wrong number of pages", 3, source.getPages());
  }
View Full Code Here

    source.setRows(new String[][] {
        {"http://a/1", "Peter", "15"},
        {"http://a/2", "George", "151"},
        {"http://a/3", "Fluffy", "25151"}});

    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
    assertEquals("wrong AGE", "15", r.getValue("AGE"));

    assertTrue("data source contains only one record", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
    assertEquals("wrong NAME", "George", r.getValue("NAME"));
    assertEquals("wrong AGE", "151", r.getValue("AGE"));   

    assertTrue("data source contains only two records", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/3", r.getValue("ID"));
    assertEquals("wrong NAME", "Fluffy", r.getValue("NAME"));
    assertEquals("wrong AGE", "25151", r.getValue("AGE"));   
   
    assertFalse("data source contains more than three records", it.hasNext());
    assertEquals("wrong number of pages", pages, source.getPages());
  }
View Full Code Here

    source.setPageSize(0);
    source.setRows(new String[][] {
        {"http://a/1", "Peter", "15"},
        {"http://a/2", "George", "151"}});
   
    RecordIterator it = source.getRecords();
    assertTrue("data source contains no records", it.hasNext());

    Record r = it.next();
    assertEquals("wrong ID", "http://a/1", r.getValue("ID"));
    assertEquals("wrong NAME", "Peter", r.getValue("NAME"));
    assertEquals("wrong AGE", "15", r.getValue("AGE"));

    assertTrue("data source contains only one record", it.hasNext());

    r = it.next();
    assertEquals("wrong ID", "http://a/2", r.getValue("ID"));
    assertEquals("wrong NAME", "George", r.getValue("NAME"));
    assertEquals("wrong AGE", "151", r.getValue("AGE"));   
   
    assertFalse("data source contains more than two records", it.hasNext());
    assertEquals("wrong number of pages", 1, source.getPages());
  }
View Full Code Here

    source = new NTriplesDataSource();
  }
 
  @Test
  public void testEmpty() {
    RecordIterator it = read("");
    assertFalse("empty data source contains records",
                it.hasNext());
  }
View Full Code Here

    testEmpty();
  }

  @Test
  public void testEmptyBlank() {
    RecordIterator it = read("\n\n");
    assertFalse("empty data source contains records",
                it.hasNext());
  }
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.RecordIterator

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.