}
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");
}