use of org.voltdb.utils.InMemoryJarfile in project voltdb by VoltDB.
the class TestInitStartLocalClusterInProcess method testGetClasses.
public void testGetClasses() throws IOException {
InMemoryJarfile jarFile = getProcJarFromCatalog();
assertTrue(!anyCatalogDefaultArtifactsExists(jarFile));
org.voltdb.client.ClientResponse resp = null;
// No java stored proc at this time, will give jar with no classes
try {
resp = client.callProcedure("@SystemCatalog", "CLASSES");
} catch (ProcCallException excp) {
assert false : "@SystemCatalogClasses failed";
}
assertTrue(jarFile.getLoader().getClassNames().size() == resp.getResults()[0].getRowCount());
// load java stored proc classes and verify the retrieved classes count
loadAndAddProcs();
jarFile = getProcJarFromCatalog();
assertTrue(!anyCatalogDefaultArtifactsExists(jarFile));
try {
resp = client.callProcedure("@SystemCatalog", "CLASSES");
} catch (ProcCallException excp) {
assert false : "@SystemCatalogClasses failed";
}
assertTrue(jarFile.getLoader().getClassNames().size() == resp.getResults()[0].getRowCount());
}
use of org.voltdb.utils.InMemoryJarfile in project voltdb by VoltDB.
the class TestInitStartLocalClusterInProcess method loadAndAddProcs.
void loadAndAddProcs() throws IOException, NoConnectionsException {
ClientResponse resp = null;
long numberOfClasses = 0;
try {
resp = client.callProcedure("@SystemCatalog", "CLASSES");
} catch (ProcCallException excp) {
assert false : "@SystemCatalogClasses failed";
}
numberOfClasses = resp.getResults()[0].getRowCount();
InMemoryJarfile jarfile = new InMemoryJarfile();
VoltCompiler comp = new VoltCompiler(false);
try {
comp.addClassToJar(jarfile, org.voltdb_testprocs.updateclasses.testImportProc.class);
comp.addClassToJar(jarfile, org.voltdb_testprocs.updateclasses.testCreateProcFromClassProc.class);
comp.addClassToJar(jarfile, org.voltdb_testprocs.updateclasses.InnerClassesTestProc.class);
comp.addClassToJar(jarfile, RangeCount.class);
} catch (Exception e) {
assert false : "Failed add class to jar: " + e.getMessage();
}
try {
client.callProcedure("@UpdateClasses", jarfile.getFullJarBytes(), null);
} catch (ProcCallException excp) {
assert false : "Failed updating the class";
}
try {
resp = client.callProcedure("@SystemCatalog", "CLASSES");
} catch (ProcCallException excp) {
assert false : "@SystemCatalogClasses failed";
}
assertTrue((numberOfClasses + jarfile.getLoader().getClassNames().size()) == resp.getResults()[0].getRowCount());
}
Aggregations