当前位置: 首页>>代码示例>>Java>>正文


Java CatalogUtil.compileDeployment方法代码示例

本文整理汇总了Java中org.voltdb.utils.CatalogUtil.compileDeployment方法的典型用法代码示例。如果您正苦于以下问题:Java CatalogUtil.compileDeployment方法的具体用法?Java CatalogUtil.compileDeployment怎么用?Java CatalogUtil.compileDeployment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.utils.CatalogUtil的用法示例。


在下文中一共展示了CatalogUtil.compileDeployment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildCatalog

import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
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");

    if (!builder.compile(cat.getAbsolutePath())) {
        throw new IOException();
    }

    byte[] bytes = MiscUtils.fileToBytes(cat);
    String serializedCat =
        CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
    assertNotNull(serializedCat);
    Catalog catalog = new Catalog();
    catalog.execute(serializedCat);

    String deploymentPath = builder.getPathToDeployment();
    CatalogUtil.compileDeployment(catalog, deploymentPath, false);

    m_context = new CatalogContext(0, 0, catalog, bytes, new byte[] {}, 0);
    TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), TheHashinator.getConfigureBytes(3));
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:29,代码来源:TestClientInterface.java

示例2: testSnapshotSettings

import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public void testSnapshotSettings() throws IOException {
    String schemaPath = "";
    try {
        final URL url = TPCCProjectBuilder.class.getResource("tpcc-ddl.sql");
        schemaPath = URLDecoder.decode(url.getPath(), "UTF-8");
    } catch (final UnsupportedEncodingException e) {
        e.printStackTrace();
        System.exit(-1);
    }

    VoltProjectBuilder builder = new VoltProjectBuilder();

    builder.addProcedures(org.voltdb.compiler.procedures.TPCCTestProc.class);
    builder.setSnapshotSettings("32m", 5, "/tmp", "woobar");
    builder.addSchema(schemaPath);
    try {
        assertTrue(builder.compile("/tmp/snapshot_settings_test.jar"));
        final String catalogContents =
            VoltCompilerUtils.readFileFromJarfile("/tmp/snapshot_settings_test.jar", "catalog.txt");
        final Catalog cat = new Catalog();
        cat.execute(catalogContents);
        CatalogUtil.compileDeployment(cat, builder.getPathToDeployment(), false);
        SnapshotSchedule schedule =
            cat.getClusters().get("cluster").getDatabases().
                get("database").getSnapshotschedule().get("default");
        assertEquals(32, schedule.getFrequencyvalue());
        assertEquals("m", schedule.getFrequencyunit());
        //Will be empty because the deployment file initialization is what sets this value
        assertEquals("/tmp", schedule.getPath());
        assertEquals("woobar", schedule.getPrefix());
    } finally {
        final File jar = new File("/tmp/snapshot_settings_test.jar");
        jar.delete();
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:36,代码来源:TestVoltCompiler.java

示例3: testExportTableCase

import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public void testExportTableCase() throws IOException {
    if (!MiscUtils.isPro()) { return; } // not supported in community

    final VoltProjectBuilder project = new VoltProjectBuilder();
    project.addSchema(TestVoltCompiler.class.getResource("ExportTester-ddl.sql"));
    project.addStmtProcedure("Dummy", "insert into a values (?, ?, ?);",
                            "a.a_id: 0");
    project.addPartitionInfo("A", "A_ID");
    project.addPartitionInfo("B", "B_ID");
    project.addPartitionInfo("e", "e_id");
    project.addPartitionInfo("f", "f_id");
    project.addExport(true /* enabled */);
    project.setTableAsExportOnly("A"); // uppercase DDL, uppercase export
    project.setTableAsExportOnly("b"); // uppercase DDL, lowercase export
    project.setTableAsExportOnly("E"); // lowercase DDL, uppercase export
    project.setTableAsExportOnly("f"); // lowercase DDL, lowercase export
    try {
        assertTrue(project.compile("/tmp/exportsettingstest.jar"));
        final String catalogContents =
            VoltCompilerUtils.readFileFromJarfile("/tmp/exportsettingstest.jar", "catalog.txt");
        final Catalog cat = new Catalog();
        cat.execute(catalogContents);
        CatalogUtil.compileDeployment(cat, project.getPathToDeployment(), false);
        Connector connector = cat.getClusters().get("cluster").getDatabases().
            get("database").getConnectors().get(Constants.DEFAULT_EXPORT_CONNECTOR_NAME);
        assertTrue(connector.getEnabled());
        // Assert that all tables exist in the connector section of catalog
        assertNotNull(connector.getTableinfo().getIgnoreCase("a"));
        assertNotNull(connector.getTableinfo().getIgnoreCase("b"));
        assertNotNull(connector.getTableinfo().getIgnoreCase("e"));
        assertNotNull(connector.getTableinfo().getIgnoreCase("f"));
    } finally {
        final File jar = new File("/tmp/exportsettingstest.jar");
        jar.delete();
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:37,代码来源:TestVoltCompiler.java


注:本文中的org.voltdb.utils.CatalogUtil.compileDeployment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。