Search in sources :

Example 11 with SinkConfig

use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.

the class TestCmdSinks method testMissingTopicPattern.

@Test
public void testMissingTopicPattern() throws Exception {
    SinkConfig sinkConfig = getSinkConfig();
    sinkConfig.setTopicsPattern(null);
    testCmdSinkCliMissingArgs(TENANT, NAMESPACE, NAME, INPUTS, null, CUSTOM_SERDE_INPUT_STRING, PROCESSING_GUARANTEES, PARALLELISM, JAR_FILE_PATH, CPU, RAM, DISK, SINK_CONFIG_STRING, sinkConfig);
}
Also used : SinkConfig(org.apache.pulsar.common.io.SinkConfig) Test(org.testng.annotations.Test)

Example 12 with SinkConfig

use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.

the class TestCmdSinks method testMissingArchive.

@Test(expectedExceptions = ParameterException.class, expectedExceptionsMessageRegExp = "Sink archive not specfied")
public void testMissingArchive() throws Exception {
    SinkConfig sinkConfig = getSinkConfig();
    sinkConfig.setArchive(null);
    testCmdSinkCliMissingArgs(TENANT, NAMESPACE, NAME, INPUTS, TOPIC_PATTERN, CUSTOM_SERDE_INPUT_STRING, PROCESSING_GUARANTEES, PARALLELISM, null, CPU, RAM, DISK, SINK_CONFIG_STRING, sinkConfig);
}
Also used : SinkConfig(org.apache.pulsar.common.io.SinkConfig) Test(org.testng.annotations.Test)

Example 13 with SinkConfig

use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.

the class TestCmdSinks method testCmdSinkConfigFileMissingProcessingGuarantees.

@Test
public void testCmdSinkConfigFileMissingProcessingGuarantees() throws Exception {
    SinkConfig testSinkConfig = getSinkConfig();
    testSinkConfig.setProcessingGuarantees(null);
    SinkConfig expectedSinkConfig = getSinkConfig();
    expectedSinkConfig.setProcessingGuarantees(null);
    testCmdSinkConfigFile(testSinkConfig, expectedSinkConfig);
}
Also used : SinkConfig(org.apache.pulsar.common.io.SinkConfig) Test(org.testng.annotations.Test)

Example 14 with SinkConfig

use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.

the class TestCmdSinks method getSinkConfig.

public SinkConfig getSinkConfig() throws JsonProcessingException {
    SinkConfig sinkConfig = new SinkConfig();
    sinkConfig.setTenant(TENANT);
    sinkConfig.setNamespace(NAMESPACE);
    sinkConfig.setName(NAME);
    sinkConfig.setInputs(INPUTS_LIST);
    sinkConfig.setTopicToSerdeClassName(CUSTOM_SERDE_INPUT_MAP);
    sinkConfig.setTopicsPattern(TOPIC_PATTERN);
    sinkConfig.setProcessingGuarantees(PROCESSING_GUARANTEES);
    sinkConfig.setParallelism(PARALLELISM);
    sinkConfig.setArchive(JAR_FILE_PATH);
    sinkConfig.setResources(new Resources(CPU, RAM, DISK));
    sinkConfig.setConfigs(createSink.parseConfigs(SINK_CONFIG_STRING));
    return sinkConfig;
}
Also used : SinkConfig(org.apache.pulsar.common.io.SinkConfig) Resources(org.apache.pulsar.common.functions.Resources)

Example 15 with SinkConfig

use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.

the class TestCmdSinks method testCmdSinkConfigFileMissingTopicToSerdeClassName.

@Test
public void testCmdSinkConfigFileMissingTopicToSerdeClassName() throws Exception {
    SinkConfig testSinkConfig = getSinkConfig();
    SinkConfig expectedSinkConfig = getSinkConfig();
    testCmdSinkConfigFile(testSinkConfig, expectedSinkConfig);
}
Also used : SinkConfig(org.apache.pulsar.common.io.SinkConfig) Test(org.testng.annotations.Test)

Aggregations

SinkConfig (org.apache.pulsar.common.io.SinkConfig)223 Test (org.testng.annotations.Test)165 Gson (com.google.gson.Gson)42 HashMap (java.util.HashMap)33 Function (org.apache.pulsar.functions.proto.Function)27 File (java.io.File)24 ConsumerConfig (org.apache.pulsar.common.functions.ConsumerConfig)24 IdentityFunction (org.apache.pulsar.functions.api.utils.IdentityFunction)24 NarClassLoader (org.apache.pulsar.common.nar.NarClassLoader)21 PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)19 IOException (java.io.IOException)18 Resources (org.apache.pulsar.common.functions.Resources)15 FileInputStream (java.io.FileInputStream)12 WebTarget (javax.ws.rs.client.WebTarget)12 ObjectMapperFactory (org.apache.pulsar.common.util.ObjectMapperFactory)12 TopicStats (org.apache.pulsar.common.policies.data.TopicStats)10 List (java.util.List)9 Map (java.util.Map)9 CompletableFuture (java.util.concurrent.CompletableFuture)9 Cleanup (lombok.Cleanup)9