Search in sources :

Example 1 with SimpleHeaderConverter

use of org.apache.kafka.connect.storage.SimpleHeaderConverter in project kafka by apache.

the class PluginsTest method shouldInstantiateAndConfigureDefaultHeaderConverter.

@Test
public void shouldInstantiateAndConfigureDefaultHeaderConverter() {
    props.remove(WorkerConfig.HEADER_CONVERTER_CLASS_CONFIG);
    createConfig();
    // Because it's not explicitly set on the supplied configuration, the logic to use the current classloader for the connector
    // will exit immediately, and so this method always returns null
    HeaderConverter headerConverter = plugins.newHeaderConverter(config, WorkerConfig.HEADER_CONVERTER_CLASS_CONFIG, ClassLoaderUsage.CURRENT_CLASSLOADER);
    assertNull(headerConverter);
    // But we should always find it (or the worker's default) when using the plugins classloader ...
    headerConverter = plugins.newHeaderConverter(config, WorkerConfig.HEADER_CONVERTER_CLASS_CONFIG, ClassLoaderUsage.PLUGINS);
    assertNotNull(headerConverter);
    assertTrue(headerConverter instanceof SimpleHeaderConverter);
}
Also used : SimpleHeaderConverter(org.apache.kafka.connect.storage.SimpleHeaderConverter) HeaderConverter(org.apache.kafka.connect.storage.HeaderConverter) SimpleHeaderConverter(org.apache.kafka.connect.storage.SimpleHeaderConverter) Test(org.junit.Test)

Aggregations

HeaderConverter (org.apache.kafka.connect.storage.HeaderConverter)1 SimpleHeaderConverter (org.apache.kafka.connect.storage.SimpleHeaderConverter)1 Test (org.junit.Test)1