Search in sources :

Example 1 with UpdateFunction

use of org.apache.pulsar.admin.cli.CmdFunctions.UpdateFunction in project incubator-pulsar by apache.

the class CmdFunctionsTest method testUpdateFunction.

@Test
public void testUpdateFunction() throws Exception {
    String fnName = TEST_NAME + "-function";
    String inputTopicName = TEST_NAME + "-input-topic";
    String outputTopicName = TEST_NAME + "-output-topic";
    cmd.run(new String[] { "update", "--name", fnName, "--inputs", inputTopicName, "--output", outputTopicName, "--jar", "SomeJar.jar", "--tenant", "sample", "--namespace", "ns1", "--className", DummyFunction.class.getName() });
    UpdateFunction updater = cmd.getUpdater();
    assertEquals(fnName, updater.getFunctionName());
    assertEquals(inputTopicName, updater.getInputs());
    assertEquals(outputTopicName, updater.getOutput());
    verify(functions, times(1)).updateFunction(any(FunctionConfig.class), anyString());
}
Also used : FunctionConfig(org.apache.pulsar.functions.proto.Function.FunctionConfig) UpdateFunction(org.apache.pulsar.admin.cli.CmdFunctions.UpdateFunction) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

UpdateFunction (org.apache.pulsar.admin.cli.CmdFunctions.UpdateFunction)1 FunctionConfig (org.apache.pulsar.functions.proto.Function.FunctionConfig)1 Matchers.anyString (org.mockito.Matchers.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 Test (org.testng.annotations.Test)1