use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class SourceConfigUtilsTest method testMergeDifferentName.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Function Names differ")
public void testMergeDifferentName() {
SourceConfig sourceConfig = createSourceConfig();
SourceConfig newSourceConfig = createUpdatedSourceConfig("name", "Different");
SourceConfigUtils.validateUpdate(sourceConfig, newSourceConfig);
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class SourceConfigUtilsTest method testMergeDifferentSecrets.
@Test
public void testMergeDifferentSecrets() {
SourceConfig sourceConfig = createSourceConfig();
Map<String, String> mySecrets = new HashMap<>();
mySecrets.put("MyKey", "MyValue");
SourceConfig newSourceConfig = createUpdatedSourceConfig("secrets", mySecrets);
SourceConfig mergedConfig = SourceConfigUtils.validateUpdate(sourceConfig, newSourceConfig);
assertEquals(mergedConfig.getSecrets(), mySecrets);
mergedConfig.setSecrets(sourceConfig.getSecrets());
assertEquals(new Gson().toJson(sourceConfig), new Gson().toJson(mergedConfig));
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class SourceConfigUtilsTest method testSupportsBatchBuilderWhenProducerConfigIsNull.
@Test
public void testSupportsBatchBuilderWhenProducerConfigIsNull() {
SourceConfig sourceConfig = createSourceConfig();
sourceConfig.setProducerConfig(null);
sourceConfig.setBatchBuilder("KEY_BASED");
Function.FunctionDetails functionDetails = SourceConfigUtils.convert(sourceConfig, new SourceConfigUtils.ExtractedSourceDetails(null, null));
assertEquals(functionDetails.getSink().getProducerSpec().getBatchBuilder(), "KEY_BASED");
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class SourceConfigUtilsTest method testMergeDifferentUserConfig.
@Test
public void testMergeDifferentUserConfig() {
SourceConfig sourceConfig = createSourceConfig();
Map<String, String> myConfig = new HashMap<>();
myConfig.put("MyKey", "MyValue");
SourceConfig newSourceConfig = createUpdatedSourceConfig("configs", myConfig);
SourceConfig mergedConfig = SourceConfigUtils.validateUpdate(sourceConfig, newSourceConfig);
assertEquals(mergedConfig.getConfigs(), myConfig);
mergedConfig.setConfigs(sourceConfig.getConfigs());
assertEquals(new Gson().toJson(sourceConfig), new Gson().toJson(mergedConfig));
}
use of org.apache.pulsar.common.io.SourceConfig in project pulsar by apache.
the class SourceConfigUtilsTest method testBatchConfigMergeEqual.
@Test
public void testBatchConfigMergeEqual() {
SourceConfig sourceConfig = createSourceConfigWithBatch();
SourceConfig newSourceConfig = createSourceConfigWithBatch();
SourceConfig mergedConfig = SourceConfigUtils.validateUpdate(sourceConfig, newSourceConfig);
assertEquals(new Gson().toJson(sourceConfig), new Gson().toJson(mergedConfig));
}
Aggregations