Search in sources :

Example 1 with IdentityFunction

use of org.apache.pulsar.functions.api.utils.IdentityFunction in project pulsar by apache.

the class CmdFunctionsTest method testCreateFunctionWithoutBasicArguments.

@Test
public void testCreateFunctionWithoutBasicArguments() throws Exception {
    cmd.run(new String[] { "create", "--inputs", INPUT_TOPIC_NAME, "--output", OUTPUT_TOPIC_NAME, "--jar", URL, "--className", IdentityFunction.class.getName() });
    CreateFunction creater = cmd.getCreater();
    assertEquals("IdentityFunction", creater.getFunctionConfig().getName());
    assertEquals("public", creater.getFunctionConfig().getTenant());
    assertEquals("default", creater.getFunctionConfig().getNamespace());
    assertEquals(INPUT_TOPIC_NAME, creater.getInputs());
    assertEquals(OUTPUT_TOPIC_NAME, creater.getOutput());
    verify(functions, times(1)).createFunctionWithUrl(any(FunctionConfig.class), anyString());
}
Also used : FunctionConfig(org.apache.pulsar.common.functions.FunctionConfig) IdentityFunction(org.apache.pulsar.functions.api.utils.IdentityFunction) CreateFunction(org.apache.pulsar.admin.cli.CmdFunctions.CreateFunction) Test(org.testng.annotations.Test)

Example 2 with IdentityFunction

use of org.apache.pulsar.functions.api.utils.IdentityFunction in project incubator-pulsar by apache.

the class CmdFunctionsTest method testCreateFunctionWithoutBasicArguments.

@Test
public void testCreateFunctionWithoutBasicArguments() throws Exception {
    cmd.run(new String[] { "create", "--inputs", INPUT_TOPIC_NAME, "--output", OUTPUT_TOPIC_NAME, "--jar", URL, "--className", IdentityFunction.class.getName() });
    CreateFunction creater = cmd.getCreater();
    assertEquals("IdentityFunction", creater.getFunctionConfig().getName());
    assertEquals("public", creater.getFunctionConfig().getTenant());
    assertEquals("default", creater.getFunctionConfig().getNamespace());
    assertEquals(INPUT_TOPIC_NAME, creater.getInputs());
    assertEquals(OUTPUT_TOPIC_NAME, creater.getOutput());
    verify(functions, times(1)).createFunctionWithUrl(any(FunctionConfig.class), anyString());
}
Also used : FunctionConfig(org.apache.pulsar.common.functions.FunctionConfig) IdentityFunction(org.apache.pulsar.functions.api.utils.IdentityFunction) CreateFunction(org.apache.pulsar.admin.cli.CmdFunctions.CreateFunction) Test(org.testng.annotations.Test)

Example 3 with IdentityFunction

use of org.apache.pulsar.functions.api.utils.IdentityFunction in project pulsar by yahoo.

the class CmdFunctionsTest method testCreateFunctionWithoutBasicArguments.

@Test
public void testCreateFunctionWithoutBasicArguments() throws Exception {
    cmd.run(new String[] { "create", "--inputs", INPUT_TOPIC_NAME, "--output", OUTPUT_TOPIC_NAME, "--jar", URL, "--className", IdentityFunction.class.getName() });
    CreateFunction creater = cmd.getCreater();
    assertEquals("IdentityFunction", creater.getFunctionConfig().getName());
    assertEquals("public", creater.getFunctionConfig().getTenant());
    assertEquals("default", creater.getFunctionConfig().getNamespace());
    assertEquals(INPUT_TOPIC_NAME, creater.getInputs());
    assertEquals(OUTPUT_TOPIC_NAME, creater.getOutput());
    verify(functions, times(1)).createFunctionWithUrl(any(FunctionConfig.class), anyString());
}
Also used : FunctionConfig(org.apache.pulsar.common.functions.FunctionConfig) IdentityFunction(org.apache.pulsar.functions.api.utils.IdentityFunction) CreateFunction(org.apache.pulsar.admin.cli.CmdFunctions.CreateFunction) Test(org.testng.annotations.Test)

Aggregations

CreateFunction (org.apache.pulsar.admin.cli.CmdFunctions.CreateFunction)3 FunctionConfig (org.apache.pulsar.common.functions.FunctionConfig)3 IdentityFunction (org.apache.pulsar.functions.api.utils.IdentityFunction)3 Test (org.testng.annotations.Test)3