use of infoeval.main.WikiData.Connector in project Info-Evaluation by TechnionYP5777.
the class ConnectorTest method basicInfoTableSizeTest.
@Ignore
@Test
public void basicInfoTableSizeTest() throws Exception {
Connector conn = new Connector();
assert conn.getConnection() != null;
ArrayList<Row> rows = conn.runQuery("SELECT COUNT(*) FROM basic_info");
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.BASIC_INFO);
assertEquals(ext.getResults().size(), size);
conn.close();
}
use of infoeval.main.WikiData.Connector in project Info-Evaluation by TechnionYP5777.
the class ConnectorTest method runQueryTest.
@Test
@SuppressWarnings("rawtypes")
public void runQueryTest() throws Exception {
Connector conn = new Connector();
Row row = conn.runQuery("SELECT photoLink FROM basic_info LIMIT 1").get(0);
Entry<Object, Class> col = row.row.get(0);
assertNotNull(col.getValue().cast(col.getKey()));
int res = conn.runUpdate("INSERT INTO WikiID VALUES('osher','1234')");
assert res == 1;
res = conn.runUpdate("DELETE FROM WikiID WHERE name LIKE 'osher'");
assert res == 1;
conn.close();
}
use of infoeval.main.WikiData.Connector in project Info-Evaluation by TechnionYP5777.
the class SqlTablesFillerTest method wikiIdTableSizeTest.
@SuppressWarnings("rawtypes")
@Ignore
@Test
public void wikiIdTableSizeTest() throws Exception {
Row row = new Connector().runQuery("SELECT COUNT(*) FROM WikiID").get(0);
Entry<Object, Class> col = row.row.get(0);
assertEquals(ENTRIES_NUM, (long) col.getValue().cast(col.getKey()));
}
use of infoeval.main.WikiData.Connector 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();
}
use of infoeval.main.WikiData.Connector in project Info-Evaluation by TechnionYP5777.
the class ConnectorTest method runUpdateTest.
@Test
@SuppressWarnings("rawtypes")
public void runUpdateTest() throws Exception {
Connector conn = new Connector();
assert conn.getConnection() != null;
Object[] inp = new Object[] { "Jessica" };
Row row = conn.runQuery("SELECT photoLink FROM basic_info WHERE name LIKE CONCAT('%',?,'%') LIMIT 1", inp).get(0);
Entry<Object, Class> col = row.row.get(0);
assertNotNull(col.getValue().cast(col.getKey()));
inp = new Object[] { "osher", "1234" };
int res = conn.runUpdate("INSERT INTO WikiID VALUES(?,?)", inp);
assert res == 1;
res = conn.runUpdate("DELETE FROM WikiID WHERE name LIKE ?", new Object[] { "osher" });
assert res == 1;
conn.close();
}
Aggregations