Search in sources :

Example 1 with UpdateCore

use of org.voltdb.sysprocs.UpdateCore in project voltdb by VoltDB.

the class TestNTProcs method testUAC.

public void testUAC() throws Exception {
    String pathToCatalog = Configuration.getPathToCatalogForTest("adhocddl.jar");
    String pathToDeployment = Configuration.getPathToCatalogForTest("adhocddl.xml");
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("--dont care");
    builder.setUseDDLSchema(true);
    boolean success = builder.compile(pathToCatalog, 2, 1, 0);
    assertTrue("Schema compilation failed", success);
    MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
    VoltDB.Configuration config = new VoltDB.Configuration();
    config.m_pathToCatalog = pathToCatalog;
    config.m_pathToDeployment = pathToDeployment;
    ServerThread localServer = new ServerThread(config);
    localServer.start();
    localServer.waitForInitialization();
    Client client = ClientFactory.createClient();
    client.createConnection("localhost");
    ClientResponseImpl response = (ClientResponseImpl) client.callProcedure("@AdHoc", "create table blah (pkey integer not null, strval varchar(200), PRIMARY KEY(pkey));");
    assertEquals(ClientResponse.SUCCESS, response.getStatus());
    // CHECK STATS
    VoltTable statsT = getStats(client, "PROCEDURE");
    System.out.println("STATS: " + statsT.toFormattedString());
    assertTrue(VoltTableUtil.tableContainsString(statsT, "UpdateCore", true));
    Map<String, Long> stats = aggregateProcRow(client, UpdateCore.class.getName());
    assertEquals(1, stats.get("INVOCATIONS").longValue());
    localServer.shutdown();
    localServer.join();
}
Also used : Configuration(org.voltdb.VoltDB.Configuration) UpdateCore(org.voltdb.sysprocs.UpdateCore) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) Configuration(org.voltdb.VoltDB.Configuration) AtomicLong(java.util.concurrent.atomic.AtomicLong) Client(org.voltdb.client.Client)

Aggregations

AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Configuration (org.voltdb.VoltDB.Configuration)1 Client (org.voltdb.client.Client)1 VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)1 UpdateCore (org.voltdb.sysprocs.UpdateCore)1