Search in sources :

Example 6 with Row

use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.

the class SqlTablesFillerTest method basicInfoTableSizeTest.

@Ignore
@Test
public void basicInfoTableSizeTest() throws Exception {
    Connector conn = new Connector();
    ArrayList<Row> rows = conn.runQuery("SELECT COUNT(*) FROM basic_info");
    Row row = rows.get(0);
    Entry<Object, Class> col = row.row.get(0);
    assertEquals(ENTRIES_NUM, (long) col.getValue().cast(col.getKey()));
}
Also used : Connector(infoeval.main.WikiData.Connector) AfterClass(org.junit.AfterClass) BeforeClass(org.junit.BeforeClass) Row(infoeval.main.mysql.Row) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with Row

use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.

the class QueryResultsSerializerTest method serializeANDdeSerializeTest.

@Ignore
@Test
@SuppressWarnings("unchecked")
public void serializeANDdeSerializeTest() throws Exception {
    int serialized_id = -1;
    String query_identifier = "testQuery";
    ArrayList<Row> rows = new ArrayList<Row>();
    Row row1 = new Row();
    row1.add(1, "integer");
    Row row2 = new Row();
    row2.add(2, "integer");
    Row row3 = new Row();
    row3.add(3, "integer");
    rows.add(row1);
    rows.add(row2);
    rows.add(row3);
    serialized_id = resultsSer.serializeQueryResults(connector, query_identifier, rows);
    ArrayList<Row> result = (ArrayList<Row>) resultsSer.deSerializeQueryResults(connector, serialized_id);
    int i = 1;
    for (Row r : result) {
        int val = (int) r.row.get(0).getValue().cast(r.row.get(0).getKey());
        assertEquals(val, i);
        ++i;
    }
    connector.close();
}
Also used : ArrayList(java.util.ArrayList) Row(infoeval.main.mysql.Row) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 8 with Row

use of infoeval.main.mysql.Row in project Info-Evaluation by TechnionYP5777.

the class ConnectorTest method wikiIdTableSizeTest.

@Ignore
@Test
public void wikiIdTableSizeTest() throws Exception {
    Connector conn = new Connector();
    assert conn.getConnection() != null;
    ArrayList<Row> rows = conn.runQuery("SELECT COUNT(*) FROM WikiID");
    Row row = rows.get(0);
    Entry<Object, Class> col = row.row.get(0);
    Object size = col.getValue().cast(col.getKey());
    assertEquals(ENTRIES_NUM, size);
    Extractor ext = new Extractor();
    ext.executeQuery(QueryTypes.WIKI_ID);
    assertEquals(ext.getResults().size(), size);
    conn.close();
}
Also used : Connector(infoeval.main.WikiData.Connector) Row(infoeval.main.mysql.Row) Extractor(infoeval.main.WikiData.Extractor) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Row (infoeval.main.mysql.Row)8 Ignore (org.junit.Ignore)6 Test (org.junit.Test)6 Connector (infoeval.main.WikiData.Connector)4 ArrayList (java.util.ArrayList)3 Extractor (infoeval.main.WikiData.Extractor)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 AfterClass (org.junit.AfterClass)2 BeforeClass (org.junit.BeforeClass)2 TableEntry (infoeval.main.mysql.TableEntry)1 Statement (java.sql.Statement)1