Examples of VoltCompiler


Examples of org.voltdb.compiler.VoltCompiler

        System.out.println(simpleProject);

        File projectFile = VoltProjectBuilder.writeStringToTempFile(simpleProject);
        String projectPath = projectFile.getPath();

        VoltCompiler compiler = new VoltCompiler();
        ClusterConfig cluster_config = new ClusterConfig(1, 1, 0, "localhost");
        assertTrue(compiler.compile(projectPath, cluster_config,
                                    "testout.jar", System.out, null));

        // Now read the jar file back in and make sure that we can grab the
        // class file from it using JarClassLoader
        this.jarPath = new File("testout.jar");
        this.catalog = compiler.getCatalog();
        assertNotNull(this.catalog);
        this.catalog_db = this.catalog.getClusters().get("cluster").getDatabases().get("database");
        assertNotNull(this.catalog_db);
    }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

        db = catalog.getClusters().get("cluster").getDatabases().get("database");
        proc = db.getProcedures().add(basename);

        String schemaPath = URLDecoder.decode(ddlurl.getPath(), "UTF-8");

        VoltCompiler compiler = new VoltCompiler();
        hsql = HSQLInterface.loadHsqldb();
        //hsql.runDDLFile(schemaPath);
        DDLCompiler ddl_compiler = new DDLCompiler(compiler, hsql);
        ddl_compiler.loadSchema(schemaPath);
        ddl_compiler.compileToCatalog(catalog, db);
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

import edu.brown.catalog.CatalogUtil;

public abstract class CompilerUtil {

    public static AbstractPlanNode compileSQL(final Procedure catalog_proc, String name, String sql) throws Exception {
        VoltCompiler compiler = new VoltCompiler();
        HSQLInterface hsql = HSQLInterface.loadHsqldb();

        Database catalog_db = (Database) catalog_proc.getParent();
        Catalog catalog = catalog_db.getCatalog();
        Statement catalog_stmt = catalog_proc.getStatements().add(name);
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

        Catalog catalog = new Catalog();
        catalog.execute("add / clusters " + CatalogUtil.DEFAULT_CLUSTER_NAME);
        catalog.execute("add /clusters[" + CatalogUtil.DEFAULT_CLUSTER_NAME + "] databases " + CatalogUtil.DEFAULT_DATABASE_NAME);
        Database catalog_db = catalog.getClusters().get(CatalogUtil.DEFAULT_CLUSTER_NAME).getDatabases().get(CatalogUtil.DEFAULT_DATABASE_NAME);

        VoltCompiler compiler = new VoltCompiler();
        DDLCompiler ddl_compiler = new DDLCompiler(compiler, hzsql);
        ddl_compiler.fillCatalogFromXML(catalog, catalog_db, xmlSchema);
        return (catalog);
    }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

        PrintWriter ddlWriter = null;
        try {
            ddlWriter = new PrintWriter(ddlName);
            ddlWriter.println(ddl);
            ddlWriter.close();
            VoltCompiler vc = new VoltCompiler();
            boolean success = vc.compileFromDDL(jarName, ddlName);
            assertTrue("Catalog compilation failed!", success);
            report = new String(Files.readAllBytes(Paths.get("catalog-report.html")), Charsets.UTF_8);
        }
        catch (Exception e) {
        }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

            "</project>";
        String simpleProject = String.format(simpleProjectTmpl, elemPfx, elemPfx, elemPfx);
        System.out.println(simpleProject);
        File projectFile = VoltProjectBuilder.writeStringToTempFile(simpleProject);
        String projectPath = projectFile.getPath();
        VoltCompiler compiler = new VoltCompiler();
        assertTrue(compiler.compileWithProjectXML(projectPath, jarFileName));
        return compiler.getCatalog();
    }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

    public void testJarfileRemoveClassRemovesInnerClasses() throws Exception
    {
        InMemoryJarfile dut = new InMemoryJarfile();
        // Add a class file that we know has inner classes
        // Someday this seems like it should be an operation directly on InMemoryJarfile
        VoltCompiler comp = new VoltCompiler();
        // This will pull in all the inner classes (currently 4 of them), but check anyway
        comp.addClassToJar(dut, org.voltdb_testprocs.updateclasses.InnerClassesTestProc.class);
        JarLoader loader = dut.getLoader();
        assertEquals(5, loader.getClassNames().size());
        System.out.println(loader.getClassNames());
        assertTrue(loader.getClassNames().contains("org.voltdb_testprocs.updateclasses.InnerClassesTestProc$InnerNotPublic"));
        assertTrue(dut.get("org/voltdb_testprocs/updateclasses/InnerClassesTestProc$InnerNotPublic.class") != null);
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

        //Custom deployment with bad class export will be disabled.
        final File tmpBad = VoltProjectBuilder.writeStringToTempFile(withBadCustomExport);
        DeploymentType bad_deployment = CatalogUtil.getDeployment(new FileInputStream(tmpBad));

        VoltCompiler compiler = new VoltCompiler();
        String x[] = {tmpDdl.getAbsolutePath()};
        Catalog cat = compiler.compileCatalogFromDDL(x);

        long crc = CatalogUtil.compileDeployment(cat, bad_deployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        Database db = cat.getClusters().get("cluster").getDatabases().get("database");
        org.voltdb.catalog.Connector catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertFalse(bad_deployment.getExport().isEnabled());

        //This is a good deployment with custom class that can be found
        final File tmpGood = VoltProjectBuilder.writeStringToTempFile(withGoodCustomExport);
        DeploymentType good_deployment = CatalogUtil.getDeployment(new FileInputStream(tmpGood));

        Catalog cat2 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat2, good_deployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        db = cat2.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertTrue(good_deployment.getExport().isEnabled());
        assertEquals(good_deployment.getExport().getTarget(), ServerExportEnum.CUSTOM);
        assertEquals(good_deployment.getExport().getExportconnectorclass(),
                "org.voltdb.exportclient.NoOpTestExportClient");
        ConnectorProperty prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals(prop.getValue(), "org.voltdb.exportclient.NoOpTestExportClient");

        // This is to test previous deployment with builtin export functionality.
        final File tmpBuiltin = VoltProjectBuilder.writeStringToTempFile(withBuiltinFileExport);
        DeploymentType builtin_deployment = CatalogUtil.getDeployment(new FileInputStream(tmpBuiltin));

        Catalog cat3 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat3, builtin_deployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        db = cat3.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertTrue(builtin_deployment.getExport().isEnabled());
        assertEquals(builtin_deployment.getExport().getTarget(), ServerExportEnum.FILE);
        prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals(prop.getValue(), "org.voltdb.exportclient.ExportToFileClient");

        //Check kafka option.
        final File tmpKafkaBuiltin = VoltProjectBuilder.writeStringToTempFile(withBuiltinKafkaExport);
        DeploymentType builtin_kafkadeployment = CatalogUtil.getDeployment(new FileInputStream(tmpKafkaBuiltin));

        Catalog cat4 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat4, builtin_kafkadeployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        db = cat4.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertTrue(builtin_kafkadeployment.getExport().isEnabled());
        assertEquals(builtin_kafkadeployment.getExport().getTarget(), ServerExportEnum.KAFKA);
        prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals(prop.getValue(), "org.voltdb.exportclient.KafkaExportClient");

        // Check RabbitMQ option
        final File tmpRabbitMQBuiltin = VoltProjectBuilder.writeStringToTempFile(withBuiltinRabbitMQExport);
        DeploymentType builtin_rabbitmqdeployment = CatalogUtil.getDeployment(new FileInputStream(tmpRabbitMQBuiltin));
        Catalog cat5 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat5, builtin_rabbitmqdeployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);
        db = cat5.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

    private boolean triedSqlcmdDryRun = false;

    private String getFirstCanonicalDDL() throws Exception {
        String pathToCatalog = Configuration.getPathToCatalogForTest("fullDDL.jar");

        VoltCompiler compiler = new VoltCompiler();
        final URL url = TestCanonicalDDLThroughSQLcmd.class.getResource("fullDDL.sql");
        String pathToSchema = URLDecoder.decode(url.getPath(), "UTF-8");
        boolean success = compiler.compileFromDDL(pathToCatalog, pathToSchema);
        assertTrue(success);
        return compiler.getCanonicalDDL();
    }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

    private void secondCanonicalDDLFromAdhoc() throws Exception {
        String pathToCatalog = Configuration.getPathToCatalogForTest("emptyDDL.jar");
        String pathToDeployment = Configuration.getPathToCatalogForTest("emptyDDL.xml");

        VoltCompiler compiler = new VoltCompiler();
        VoltProjectBuilder builder = new VoltProjectBuilder();

        builder.setUseDDLSchema(true);
        boolean success = builder.compile(pathToCatalog);
        assertTrue(success);
        MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);

        VoltDB.Configuration config = new VoltDB.Configuration();
        config.m_pathToCatalog = pathToCatalog;
        config.m_pathToDeployment = pathToDeployment;

        startSystem(config);

        m_client.callProcedure("@AdHoc", firstCanonicalDDL);

        assertEquals(compiler.getCanonicalDDL(), firstCanonicalDDL);

        teardownSystem();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.