Search in sources :

Example 6 with DbSettings

use of org.voltdb.settings.DbSettings in project voltdb by VoltDB.

the class TestClientInterface method buildCatalog.

private static void buildCatalog() throws IOException {
    // build a real catalog
    File cat = File.createTempFile("temp-log-reinitiator", "catalog");
    cat.deleteOnExit();
    VoltProjectBuilder builder = new VoltProjectBuilder();
    String schema = "create table A (i integer not null, primary key (i));";
    builder.addLiteralSchema(schema);
    builder.addPartitionInfo("A", "i");
    builder.addStmtProcedure("hello", "select * from A where i = ?", "A.i: 0");
    builder.addStmtProcedure("hellorw", "delete from A where i = ?", "A.i: 0");
    if (!builder.compile(cat.getAbsolutePath())) {
        throw new IOException();
    }
    byte[] bytes = MiscUtils.fileToBytes(cat);
    String serializedCat = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes, false).getFirst());
    assertNotNull(serializedCat);
    Catalog catalog = new Catalog();
    catalog.execute(serializedCat);
    String deploymentPath = builder.getPathToDeployment();
    CatalogUtil.compileDeployment(catalog, deploymentPath, false);
    DbSettings dbSettings = CatalogUtil.asDbSettings(deploymentPath);
    m_context = new CatalogContext(0, 0, catalog, dbSettings, bytes, null, new byte[] {}, 0, mock(HostMessenger.class));
    TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), TheHashinator.getConfigureBytes(3));
}
Also used : DbSettings(org.voltdb.settings.DbSettings) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) IOException(java.io.IOException) File(java.io.File) Catalog(org.voltdb.catalog.Catalog)

Aggregations

DbSettings (org.voltdb.settings.DbSettings)6 Catalog (org.voltdb.catalog.Catalog)5 File (java.io.File)4 IOException (java.io.IOException)3 HostMessenger (org.voltcore.messaging.HostMessenger)3 CatalogContext (org.voltdb.CatalogContext)3 PlannerTool (org.voltdb.compiler.PlannerTool)3 VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SocketException (java.net.SocketException)1 ExecutionException (java.util.concurrent.ExecutionException)1 KeeperException (org.apache.zookeeper_voltpatches.KeeperException)1 ZooKeeper (org.apache.zookeeper_voltpatches.ZooKeeper)1 JSONException (org.json_voltpatches.JSONException)1 Before (org.junit.Before)1 VoltDB (org.voltdb.VoltDB)1 TPCCProjectBuilder (org.voltdb.benchmark.tpcc.TPCCProjectBuilder)1 Cluster (org.voltdb.catalog.Cluster)1 AdHocPlannedStatement (org.voltdb.compiler.AdHocPlannedStatement)1