use of com.cinchapi.concourse.importer.CsvImporter in project concourse by cinchapi.
the class ExportCliTest method beforeEachTest.
@Override
public void beforeEachTest() {
String file = Resources.getAbsolutePath("/college.csv");
Importer importer = new CsvImporter(client);
importer.importFile(file);
output = FileOps.tempFile();
}
use of com.cinchapi.concourse.importer.CsvImporter in project concourse by cinchapi.
the class FindCriteriaTest method testSimpleWithTime.
@Test
public void testSimpleWithTime() {
Set<Long> results = client.find(Criteria.where().key("graduation_rate").operator(Operator.GREATER_THAN).value(90));
Timestamp t1 = Timestamp.now();
System.out.println("Importing college data into Concourse");
Importer importer = new CsvImporter(client);
importer.importFile(Resources.get("/college.csv").getFile());
Assert.assertEquals(results, client.find(Criteria.where().key("graduation_rate").operator(Operator.GREATER_THAN).value(90).at(t1)));
}
use of com.cinchapi.concourse.importer.CsvImporter in project concourse by cinchapi.
the class FindCriteriaTest method beforeEachTest.
@Override
protected void beforeEachTest() {
// Import data into Concourse
System.out.println("Importing college data into Concourse");
Importer importer = new CsvImporter(client);
importer.importFile(Resources.get("/college.csv").getFile());
// Load up the SQL db which also contains a copy of the data
System.out.println("Loading SQL database with college data");
try {
// NOTE: The JDBC API is atrocious :o=
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:" + Resources.get("/college.db").getFile());
sql = conn.createStatement();
} catch (Exception e) {
throw CheckedExceptions.wrapAsRuntimeException(e);
}
super.beforeEachTest();
}
use of com.cinchapi.concourse.importer.CsvImporter in project concourse by cinchapi.
the class PaginationPerformanceTest method testPaginationDoesNotLoadEntireResultSet.
@Test
public void testPaginationDoesNotLoadEntireResultSet() {
Importer importer = new CsvImporter(client);
Set<Long> records = importer.importFile(Resources.get("/generated.csv").getFile());
server.stop();
server.start();
client = server.connect();
Benchmark all = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
client.select(records);
}
};
long allTime = all.run();
server.stop();
server.start();
client = server.connect();
Benchmark paginated = new Benchmark(TimeUnit.MILLISECONDS) {
@Override
public void action() {
client.select(records, Page.sized(100).go(90));
}
};
long paginatedTime = paginated.run();
System.out.println(allTime);
System.out.println(paginatedTime);
Assert.assertTrue(paginatedTime < allTime);
}
Aggregations