use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class SinkConfigUtilsTest method testMergeEqual.
@Test
public void testMergeEqual() {
SinkConfig sinkConfig = createSinkConfig();
SinkConfig newSinkConfig = createSinkConfig();
SinkConfig mergedConfig = SinkConfigUtils.validateUpdate(sinkConfig, newSinkConfig);
assertEquals(new Gson().toJson(sinkConfig), new Gson().toJson(mergedConfig));
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class SinkConfigUtilsTest method testMergeDifferentRetainOrdering.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Retain Ordering cannot be altered")
public void testMergeDifferentRetainOrdering() {
SinkConfig sinkConfig = createSinkConfig();
SinkConfig newSinkConfig = createUpdatedSinkConfig("retainOrdering", true);
SinkConfigUtils.validateUpdate(sinkConfig, newSinkConfig);
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class SinkConfigUtilsTest method testMergeDifferentResources.
@Test
public void testMergeDifferentResources() {
SinkConfig sinkConfig = createSinkConfig();
Resources resources = new Resources();
resources.setCpu(0.3);
resources.setRam(1232l);
resources.setDisk(123456l);
SinkConfig newSinkConfig = createUpdatedSinkConfig("resources", resources);
SinkConfig mergedConfig = SinkConfigUtils.validateUpdate(sinkConfig, newSinkConfig);
assertEquals(mergedConfig.getResources(), resources);
mergedConfig.setResources(sinkConfig.getResources());
assertEquals(new Gson().toJson(sinkConfig), new Gson().toJson(mergedConfig));
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class SinkConfigUtilsTest method testMergeDifferentAutoAck.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "AutoAck cannot be altered")
public void testMergeDifferentAutoAck() {
SinkConfig sinkConfig = createSinkConfig();
SinkConfig newSinkConfig = createUpdatedSinkConfig("autoAck", false);
SinkConfig mergedConfig = SinkConfigUtils.validateUpdate(sinkConfig, newSinkConfig);
}
use of org.apache.pulsar.common.io.SinkConfig in project pulsar by apache.
the class SinkConfigUtilsTest method testPoolMessages.
@Test
public void testPoolMessages() throws IOException {
SinkConfig sinkConfig = createSinkConfig();
Function.FunctionDetails functionDetails = SinkConfigUtils.convert(sinkConfig, new SinkConfigUtils.ExtractedSinkDetails(null, null));
assertFalse(functionDetails.getSource().getInputSpecsMap().get("test-input").getPoolMessages());
SinkConfig convertedConfig = SinkConfigUtils.convertFromDetails(functionDetails);
assertFalse(convertedConfig.getInputSpecs().get("test-input").isPoolMessages());
Map<String, ConsumerConfig> inputSpecs = new HashMap<>();
inputSpecs.put("test-input", ConsumerConfig.builder().poolMessages(true).build());
sinkConfig.setInputSpecs(inputSpecs);
functionDetails = SinkConfigUtils.convert(sinkConfig, new SinkConfigUtils.ExtractedSinkDetails(null, null));
assertTrue(functionDetails.getSource().getInputSpecsMap().get("test-input").getPoolMessages());
convertedConfig = SinkConfigUtils.convertFromDetails(functionDetails);
assertTrue(convertedConfig.getInputSpecs().get("test-input").isPoolMessages());
}
Aggregations