Source:
<code>public void testAddRemoveUDF() throws IOException, ProcCallException { Client client = getClient(); String[] functionNamesToTry = new String[] {"testfunc", "TESTFUNC", "testFunc"}; for (String functionName : functionNamesToTry) { <START> verifyStmtFails(client, String.format("SELECT %s(a) FROM T;", functionName), "user lacks privilege or object not found: TESTFUNC"); <END> } try { client.callProcedure("@AdHoc", "CREATE FUNCTION testfunc FROM METHOD org.voltdb_testfuncs.IntFunction.run;"); } catch (ProcCallException pce) { pce.printStackTrace(); fail("Should be able to CREATE FUNCTION testfunc FROM METHOD org.voltdb_testfuncs.IntFunction.run;"); } assertSuccessfulDML(client, "INSERT INTO T VALUES (1, 'abc');"); assertSuccessfulDML(client, "INSERT INTO T VALUES (2, 'def');"); for (String functionName : functionNamesToTry) { VoltTable[] results = client.callProcedure("@AdHoc", String.format("SELECT %s(a) FROM T;", functionName)).getResults(); assert(results != null); assertEquals(1, results.length); VoltTable t = results[0]; assertContentOfTable(new Object[][] {{null}, {null}}, t); } try { client.callProcedure("@AdHoc", "DROP FUNCTION testfunc;"); } catch (ProcCallException pce) { pce.printStackTrace(); fail("Should be able to drop function testfunc"); } for (String functionName : functionNamesToTry) { verifyStmtFails(client, String.format("SELECT %s(a) FROM T;", functionName), "user lacks privilege or object not found: TESTFUNC"); } }</code><technical_language>good test 0, 1, 2 parameters</technical_language>

Target:
public void testAddRemoveUDF() throws IOException, ProcCallException { Client client = getClient(); String[] functionNamesToTest = new String[] {"testfunc", "TESTFUNC", "testFunc"}; String[] methodNamesToTest = new String[] {"constantIntFunction", "unaryIntFunction", "generalIntFunction"}; assertSuccessfulDML(client, "INSERT INTO T VALUES (1, 'abc');"); assertSuccessfulDML(client, "INSERT INTO T VALUES (2, 'def');"); for (int i = 0; i < methodNamesToTest.length; i++) { String methodName = methodNamesToTest[i]; for (String functionName : functionNamesToTest) { verifyStmtFails(client, String.format("SELECT %s(%s) FROM T;", functionName, String.join(", ", Collections.nCopies(i, "a"))), "user lacks privilege or object not found: TESTFUNC"); try { client.callProcedure("@AdHoc", String.format("CREATE FUNCTION %s FROM METHOD org.voltdb_testfuncs.IntFunction.%s;", functionName, methodName)); } catch (ProcCallException pce) { pce.printStackTrace(); fail(String.format("Should be able to CREATE FUNCTION %s FROM METHOD org.voltdb_testfuncs.IntFunction.%s;", functionName, methodName)); } VoltTable[] results = client.callProcedure("@AdHoc", String.format("SELECT %s(%s) FROM T;", functionName, String.join(", ", Collections.nCopies(i, "a")))).getResults(); assert(results != null); assertEquals(1, results.length); VoltTable t = results[0]; assertContentOfTable(new Object[][] {{null}, {null}}, t); try { client.callProcedure("@AdHoc", String.format("DROP FUNCTION %s;", functionName)); } catch (ProcCallException pce) { pce.printStackTrace(); fail(String.format("Should be able to drop function %s", functionName)); } verifyStmtFails(client, String.format("SELECT %s(%s) FROM T;", functionName, String.join(", ", Collections.nCopies(i, "a"))), "user lacks privilege or object not found: TESTFUNC"); } } }