Examples of InMemoryJarfile


Examples of org.voltdb.utils.InMemoryJarfile

            "import class org.voltdb_testprocs.fullddlfeatures.*;" +
            "create procedure from class org.voltdb_testprocs.fullddlfeatures.testImportProc;";

        VoltCompiler c = compileForDDLTest2(schema);
        JdbcDatabaseMetaDataGenerator dut =
            new JdbcDatabaseMetaDataGenerator(c.getCatalog(), new InMemoryJarfile(testout_jar));
        VoltTable classes = dut.getMetaData("classes");
        System.out.println(classes);
        assertTrue(VoltTableTestHelpers.moveToMatchingRow(classes, "CLASS_NAME", "org.voltdb_testprocs.fullddlfeatures.testImportProc"));
        assertEquals(1, classes.get("VOLT_PROCEDURE", VoltType.INTEGER));
        assertEquals(1, classes.get("ACTIVE_PROC", VoltType.INTEGER));
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

                threw = true;
            }
            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");
            }
            catch (ProcCallException pce) {
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

            ClientResponse resp;
            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) {
                pce.printStackTrace();
                fail("Triggered ENG-6611!");
            }
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

     */
    public Catalog compileCatalogFromDDL(final String... ddlFilePaths)
            throws VoltCompilerException
    {
        DatabaseType database = getProjectDatabase(null);
        InMemoryJarfile jarOutput = new InMemoryJarfile();
        return compileCatalogInternal(database, DDLPathsToReaderList(ddlFilePaths), jarOutput);
    }
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

            throw new VoltCompilerException(String.format(
                    "Unable to create project reader for \"%s\": %s",
                    projectFileURL, e.getMessage()));
        }
        DatabaseType database = getProjectDatabase(projectReader);
        InMemoryJarfile jarOutput = new InMemoryJarfile();
        // Provide an empty DDL reader list.
        return compileCatalogInternal(database, DDLPathsToReaderList(), jarOutput);
    }
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

        m_catalog = new Catalog(); //
        m_catalog.execute("add / clusters cluster");
        Database db = initCatalogDatabase();
        List<VoltCompilerReader> ddlReaderList = DDLPathsToReaderList(ddlFilePaths);
        final VoltDDLElementTracker voltDdlTracker = new VoltDDLElementTracker(this);
        InMemoryJarfile jarOutput = new InMemoryJarfile();
        compileDatabase(db, hsql, voltDdlTracker, ddlReaderList, null, null, whichProcs, jarOutput);

        return m_catalog;
    }
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

        }

        String classAsPath = c.getName().replace('.', '/') + ".class";

        if (cl instanceof JarLoader) {
            InMemoryJarfile memJar = ((JarLoader) cl).getInMemoryJarfile();
            return memJar.get(classAsPath);
        }
        else {
            BufferedInputStream   cis = null;
            ByteArrayOutputStream baos = null;
            try {
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

        // classes can be found and copied to the new file that gets written.
        ClassLoader originalClassLoader = m_classLoader;
        try {
            m_classLoader = jarfile.getLoader();
            // Do the compilation work.
            InMemoryJarfile jarOut = compileInternal(null, ddlReaderList, jarfile);
            // Trim the compiler output to try to provide a concise failure
            // explanation
            if (jarOut != null) {
                compilerLog.debug("Successfully recompiled InMemoryJarfile");
            }
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

        //m_path = pathToCatalogJar;
        long tempCRC = 0;
        if (catalogBytes != null) {
            try {
                m_jarfile = new InMemoryJarfile(catalogBytes);
                tempCRC = m_jarfile.getCRC();
            }
            catch (Exception e) {
                throw new RuntimeException(e);
            }
View Full Code Here

Examples of org.voltdb.utils.InMemoryJarfile

            } finally {
                fin.close();
                fin = null;
            }
            byte[] catalogBytes = Arrays.copyOf(buffer, totalBytes);
            InMemoryJarfile jarfile = new InMemoryJarfile(catalogBytes);
            if (jarfile.getCRC() != catalog_crc) {
                m_snapshotErrLogStr.append("\nRejected snapshot ")
                                .append(s.getNonce())
                                .append(" because catalog CRC did not match digest.");
                return null;
            }
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.