Examples of VoltCompiler


Examples of org.voltdb.compiler.VoltCompiler

            "create table Table2 (Column1 integer);" +
            "create view View1 (Column1, num) as select Column1, count(*) from Table1 group by Column1;" +
            "create table Export1 (Column1 integer);" +
            "export table Export1;" +
            "create procedure sample as select * from Table1;";
        VoltCompiler c = compileForDDLTest2(schema);
        System.out.println(c.getCatalog().serialize());
        JdbcDatabaseMetaDataGenerator dut =
            new JdbcDatabaseMetaDataGenerator(c.getCatalog(), new InMemoryJarfile(testout_jar));
        VoltTable tables = dut.getMetaData("tables");
        System.out.println(tables);
        assertEquals(10, tables.getColumnCount());
        assertEquals(4, tables.getRowCount());
        assertTrue(VoltTableTestHelpers.moveToMatchingRow(tables, "TABLE_NAME", "Table1"));
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

            "create table Table4 (Column9 varbinary(250) not null);" +
            "create view View1 (Column10, Column11) as select Column1, count(*) from Table1 group by Column1;" +
            "create table Table5 (Default1 tinyint default 10, Default2 varchar(50) default 'DUDE');" +
            "create procedure sample as select * from Table1;";

        VoltCompiler c = compileForDDLTest2(schema);
        System.out.println(c.getCatalog().serialize());
        JdbcDatabaseMetaDataGenerator dut =
            new JdbcDatabaseMetaDataGenerator(c.getCatalog(), new InMemoryJarfile(testout_jar));
        VoltTable columns = dut.getMetaData("ColUmns");
        System.out.println(columns);
        assertEquals(23, columns.getColumnCount());
        assertEquals(13, columns.getRowCount());
        for (Map.Entry<String, Object[]> entry : refcolumns.entrySet())
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

            "partition table Table1 on column Column3;" +
            "create index Index1_tree on Table1 (Column2, Column3);" +
            "create index Index2_hash on Table1 (Column4, Column5);" +
            "create procedure sample as select * from Table1;";

        VoltCompiler c = compileForDDLTest2(schema);
        System.out.println(c.getCatalog().serialize());
        JdbcDatabaseMetaDataGenerator dut =
            new JdbcDatabaseMetaDataGenerator(c.getCatalog(), new InMemoryJarfile(testout_jar));
        VoltTable indexes = dut.getMetaData("IndexInfo");
        System.out.println(indexes);
        assertEquals(13, indexes.getColumnCount());
        assertEquals(7, indexes.getRowCount());
        assertTrue(VoltTableTestHelpers.moveToMatchingTupleRow(indexes, "INDEX_NAME", "INDEX1_TREE", "COLUMN_NAME", "Column2"));
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

            "partition table Table1 on column Column1;" +
            "create table Table2 (Column2 smallint not null, Column3 smallint not null, Column4 smallint not null, " +
            "  constraint primary2 primary key (Column2, Column3, Column4));" +
            "create procedure sample as select * from Table1;";

        VoltCompiler c = compileForDDLTest2(schema);
        System.out.println(c.getCatalog().serialize());
        JdbcDatabaseMetaDataGenerator dut =
            new JdbcDatabaseMetaDataGenerator(c.getCatalog(), new InMemoryJarfile(testout_jar));
        VoltTable pkeys = dut.getMetaData("PrimaryKeys");
        System.out.println(pkeys);
        assertEquals(6, pkeys.getColumnCount());
        assertEquals(4, pkeys.getRowCount());
        assertTrue(VoltTableTestHelpers.moveToMatchingRow(pkeys, "COLUMN_NAME", "Column1"));
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

            }
            assertTrue("Shouldn't be able to create a procedure backed by no class", threw);
            assertFalse(findProcedureInSystemCatalog("testImportProc"));

            InMemoryJarfile jarfile = new InMemoryJarfile();
            VoltCompiler comp = new VoltCompiler();
            comp.addClassToJar(jarfile, org.voltdb_testprocs.updateclasses.testImportProc.class);

            resp = m_client.callProcedure("@UpdateClasses", jarfile.getFullJarBytes(), null);
            // Missing the dependency, try again.  It will succeed but we won't be able to
            // call the procedure.  Maybe this gets better in the future
            try {
                resp = m_client.callProcedure("@AdHoc",
                        "create procedure from class org.voltdb_testprocs.updateclasses.testImportProc");
            }
            catch (ProcCallException pce) {
                fail("We allow procedures to be created with unsatisfied dependencies");
            }
            assertTrue(findProcedureInSystemCatalog("testImportProc"));
            // Make sure we don't crash when we call it though
            threw = false;
            try {
                resp = m_client.callProcedure("testImportProc");
            }
            catch (ProcCallException pce) {
                pce.printStackTrace();
                assertTrue(pce.getMessage().contains("ClassNotFoundException"));
                threw = true;
            }
            assertTrue("Should return an error and not crash calling procedure w/ bad dependencies",
                    threw);

            // Okay, add the missing dependency
            jarfile = new InMemoryJarfile();
            comp = new VoltCompiler();
            comp.addClassToJar(jarfile, org.voltdb_testprocs.updateclasses.NoMeaningClass.class);
            resp = m_client.callProcedure("@UpdateClasses", jarfile.getFullJarBytes(), null);
            // now we should be able to call it
            try {
                resp = m_client.callProcedure("testImportProc");
            }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

            resp = m_client.callProcedure("@SystemCatalog", "CLASSES");
            System.out.println(resp.getResults()[0]);

            // Now load the procedure requiring the already-resident dependency
            InMemoryJarfile jarfile = new InMemoryJarfile();
            VoltCompiler comp = new VoltCompiler();
            comp.addClassToJar(jarfile, org.voltdb_testprocs.updateclasses.testImportProc.class);

            try {
                resp = m_client.callProcedure("@UpdateClasses", jarfile.getFullJarBytes(), null);
            }
            catch (ProcCallException pce) {
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

    {
        // Throws IOException on load failure.
        InMemoryJarfile jarfile = loadInMemoryJarFile(catalogBytes);
        // Let VoltCompiler do a version check and upgrade the catalog on the fly.
        // I.e. jarfile may be modified.
        VoltCompiler compiler = new VoltCompiler();
        String upgradedFromVersion = compiler.upgradeCatalogAsNeeded(jarfile);
        return new Pair<InMemoryJarfile, String>(jarfile, upgradedFromVersion);
    }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

     * @throws IOException on failure to create temporary jar file
     */
    public static File createTemporaryEmptyCatalogJarFile() throws IOException {
        File emptyJarFile = File.createTempFile("catalog-empty", ".jar");
        emptyJarFile.deleteOnExit();
        VoltCompiler compiler = new VoltCompiler();
        if (!compiler.compileEmptyCatalog(emptyJarFile.getAbsolutePath())) {
            return null;
        }
        return emptyJarFile;
    }
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

        MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);

        // This is maybe cheating a little bit?
        InMemoryJarfile jarfile = new InMemoryJarfile();
        for (Class<?> clazz : PROC_CLASSES) {
            VoltCompiler comp = new VoltCompiler();
            comp.addClassToJar(jarfile, clazz);
        }
        for (Class<?> clazz : EXTRA_CLASSES) {
            VoltCompiler comp = new VoltCompiler();
            comp.addClassToJar(jarfile, clazz);
        }
        // Add a deployment file just to have something other than classes in the jar
        jarfile.put("deployment.xml", new File(pathToDeployment));

        try {
View Full Code Here

Examples of org.voltdb.compiler.VoltCompiler

        MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);

        // This is maybe cheating a little bit?
        InMemoryJarfile jarfile = new InMemoryJarfile();
        for (Class<?> clazz : PROC_CLASSES) {
            VoltCompiler comp = new VoltCompiler();
            comp.addClassToJar(jarfile, clazz);
        }
        for (Class<?> clazz : EXTRA_CLASSES) {
            VoltCompiler comp = new VoltCompiler();
            comp.addClassToJar(jarfile, clazz);
        }

        Client auth_client = null;
        try {
            VoltDB.Configuration config = new VoltDB.Configuration();
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.