use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class TestCmdSources method testCmdSourceConfigFileMissingJar.
@Test(expectedExceptions = ParameterException.class, expectedExceptionsMessageRegExp = "Source archive not specified")
public void testCmdSourceConfigFileMissingJar() throws Exception {
SourceConfig testSourceConfig = getSourceConfig();
testSourceConfig.setArchive(null);
SourceConfig expectedSourceConfig = getSourceConfig();
expectedSourceConfig.setArchive(null);
testCmdSourceConfigFile(testSourceConfig, expectedSourceConfig);
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class TestCmdSources method testCliCorrect.
@Test
public void testCliCorrect() throws Exception {
SourceConfig sourceConfig = getSourceConfig();
testCmdSourceCliMissingArgs(TENANT, NAMESPACE, NAME, TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES, PARALLELISM, JAR_FILE_PATH, CPU, RAM, DISK, SINK_CONFIG_STRING, sourceConfig);
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class TestCmdSources method testCliOverwriteConfigFile.
@Test
public void testCliOverwriteConfigFile() throws Exception {
SourceConfig testSourceConfig = new SourceConfig();
testSourceConfig.setTenant(TENANT + "-prime");
testSourceConfig.setNamespace(NAMESPACE + "-prime");
testSourceConfig.setName(NAME + "-prime");
testSourceConfig.setTopicName(TOPIC_NAME + "-prime");
testSourceConfig.setSerdeClassName(SERDE_CLASS_NAME + "-prime");
testSourceConfig.setProcessingGuarantees(FunctionConfig.ProcessingGuarantees.EFFECTIVELY_ONCE);
testSourceConfig.setParallelism(PARALLELISM + 1);
testSourceConfig.setArchive(JAR_FILE_PATH + "-prime");
testSourceConfig.setResources(new Resources(CPU + 1, RAM + 1, DISK + 1));
testSourceConfig.setConfigs(createSource.parseConfigs("{\"created_at-prime\":\"Mon Jul 02 00:33:15 +0000 2018\", \"otherProperties\":{\"property1.value\":\"value1\",\"property2.value\":\"value2\"}}"));
SourceConfig expectedSourceConfig = getSourceConfig();
File file = Files.createTempFile("", "").toFile();
new YAMLMapper().writeValue(file, testSourceConfig);
Assert.assertEquals(testSourceConfig, CmdUtils.loadConfig(file.getAbsolutePath(), SourceConfig.class));
testMixCliAndConfigFile(TENANT, NAMESPACE, NAME, TOPIC_NAME, SERDE_CLASS_NAME, PROCESSING_GUARANTEES, PARALLELISM, JAR_FILE_PATH, CPU, RAM, DISK, SINK_CONFIG_STRING, file.getAbsolutePath(), expectedSourceConfig);
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class TestCmdSources method testBatchSourceConfigCorrect.
@Test
public void testBatchSourceConfigCorrect() throws Exception {
SourceConfig testSourceConfig = getSourceConfig();
testSourceConfig.setBatchSourceConfig(getBatchSourceConfig());
SourceConfig expectedSourceConfig = getSourceConfig();
expectedSourceConfig.setBatchSourceConfig(getBatchSourceConfig());
testCmdSourceConfigFile(testSourceConfig, expectedSourceConfig);
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class TestCmdSources method testCmdSourceConfigFileMissingProcessingGuarantees.
@Test
public void testCmdSourceConfigFileMissingProcessingGuarantees() throws Exception {
SourceConfig testSourceConfig = getSourceConfig();
testSourceConfig.setProcessingGuarantees(null);
SourceConfig expectedSourceConfig = getSourceConfig();
expectedSourceConfig.setProcessingGuarantees(null);
testCmdSourceConfigFile(testSourceConfig, expectedSourceConfig);
}
Aggregations