use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class TestCmdSinks method testInvalidJar.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Sink Archive file /tmp/foo.jar" + " does not exist")
public void testInvalidJar() throws Exception {
SinkConfig sinkConfig = getSinkConfig();
String fakeJar = "/tmp/foo.jar";
sinkConfig.setArchive(fakeJar);
testCmdSinkCliMissingArgs(TENANT, NAMESPACE, NAME, INPUTS, TOPIC_PATTERN, CUSTOM_SERDE_INPUT_STRING, PROCESSING_GUARANTEES, PARALLELISM, fakeJar, CPU, RAM, DISK, SINK_CONFIG_STRING, sinkConfig);
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class TestCmdSinks method testMissingCustomSerdeInput.
@Test
public void testMissingCustomSerdeInput() throws Exception {
SinkConfig sinkConfig = getSinkConfig();
sinkConfig.setTopicToSerdeClassName(null);
sinkConfig.setTopicToSchemaType(null);
testCmdSinkCliMissingArgs(TENANT, NAMESPACE, NAME, INPUTS, TOPIC_PATTERN, null, PROCESSING_GUARANTEES, PARALLELISM, JAR_FILE_PATH, CPU, RAM, DISK, SINK_CONFIG_STRING, sinkConfig);
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class TestCmdSinks method testCmdSinkConfigFile.
private void testCmdSinkConfigFile(SinkConfig testSinkConfig, SinkConfig expectedSinkConfig) throws Exception {
File file = Files.createTempFile("", "").toFile();
new YAMLMapper().writeValue(file, testSinkConfig);
Assert.assertEquals(testSinkConfig, CmdUtils.loadConfig(file.getAbsolutePath(), SinkConfig.class));
// test create sink
createSink.sinkConfigFile = file.getAbsolutePath();
createSink.processArguments();
createSink.runCmd();
// test update sink
updateSink.sinkConfigFile = file.getAbsolutePath();
updateSink.processArguments();
updateSink.runCmd();
// test local runner
localSinkRunner.sinkConfigFile = file.getAbsolutePath();
localSinkRunner.processArguments();
localSinkRunner.runCmd();
verify(createSink).validateSinkConfigs(eq(expectedSinkConfig));
verify(updateSink).validateSinkConfigs(eq(expectedSinkConfig));
verify(localSinkRunner).validateSinkConfigs(eq(expectedSinkConfig));
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class TestCmdSinks method testParseConfigs.
@Test
public void testParseConfigs() throws Exception {
SinkConfig testSinkConfig = getSinkConfig();
Map<String, Object> config = testSinkConfig.getConfigs();
Assert.assertEquals(config.get("int"), 1000);
Assert.assertEquals(config.get("int_string"), "1000");
Assert.assertEquals(config.get("float"), 1000.0);
Assert.assertEquals(config.get("float_string"), "1000.0");
Assert.assertEquals(config.get("created_at"), "Mon Jul 02 00:33:15 +0000 2018");
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class TestCmdSinks method testMissingConfig.
@Test
public void testMissingConfig() throws Exception {
SinkConfig sinkConfig = getSinkConfig();
sinkConfig.setConfigs(null);
testCmdSinkCliMissingArgs(TENANT, NAMESPACE, NAME, INPUTS, TOPIC_PATTERN, CUSTOM_SERDE_INPUT_STRING, PROCESSING_GUARANTEES, PARALLELISM, JAR_FILE_PATH, CPU, RAM, DISK, null, sinkConfig);
}
Aggregations