Search in sources :

Example 1 with CsvImporter

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();
}
Also used : CsvImporter(com.cinchapi.concourse.importer.CsvImporter) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) Importer(com.cinchapi.concourse.importer.Importer)

Example 2 with CsvImporter

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)));
}
Also used : CsvImporter(com.cinchapi.concourse.importer.CsvImporter) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) Importer(com.cinchapi.concourse.importer.Importer) ConcourseIntegrationTest(com.cinchapi.concourse.test.ConcourseIntegrationTest) Test(org.junit.Test)

Example 3 with CsvImporter

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();
}
Also used : Connection(java.sql.Connection) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) Importer(com.cinchapi.concourse.importer.Importer)

Example 4 with CsvImporter

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);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) CsvImporter(com.cinchapi.concourse.importer.CsvImporter) Importer(com.cinchapi.concourse.importer.Importer) Test(org.junit.Test) ClientServerTest(com.cinchapi.concourse.test.ClientServerTest)

Aggregations

CsvImporter (com.cinchapi.concourse.importer.CsvImporter)4 Importer (com.cinchapi.concourse.importer.Importer)4 Test (org.junit.Test)2 Benchmark (com.cinchapi.common.profile.Benchmark)1 ClientServerTest (com.cinchapi.concourse.test.ClientServerTest)1 ConcourseIntegrationTest (com.cinchapi.concourse.test.ConcourseIntegrationTest)1 Connection (java.sql.Connection)1