Search in sources :

Example 16 with StandaloneConfig

use of org.apache.kafka.connect.runtime.standalone.StandaloneConfig in project kafka by apache.

the class ConnectUtilsTest method testAddMetricsContextPropertiesStandalone.

@Test
public void testAddMetricsContextPropertiesStandalone() {
    Map<String, String> props = new HashMap<>();
    props.put(StandaloneConfig.OFFSET_STORAGE_FILE_FILENAME_CONFIG, "offsetStorageFile");
    props.put(StandaloneConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
    props.put(StandaloneConfig.KEY_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter");
    props.put(StandaloneConfig.VALUE_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter");
    StandaloneConfig config = new StandaloneConfig(props);
    Map<String, Object> prop = new HashMap<>();
    ConnectUtils.addMetricsContextProperties(prop, config, "cluster-1");
    assertNull(prop.get(CommonClientConfigs.METRICS_CONTEXT_PREFIX + WorkerConfig.CONNECT_GROUP_ID));
    assertEquals("cluster-1", prop.get(CommonClientConfigs.METRICS_CONTEXT_PREFIX + WorkerConfig.CONNECT_KAFKA_CLUSTER_ID));
}
Also used : HashMap(java.util.HashMap) StandaloneConfig(org.apache.kafka.connect.runtime.standalone.StandaloneConfig) Test(org.junit.Test)

Example 17 with StandaloneConfig

use of org.apache.kafka.connect.runtime.standalone.StandaloneConfig in project kafka by apache.

the class FileOffsetBackingStoreTest method setup.

@Before
public void setup() throws IOException {
    store = new FileOffsetBackingStore();
    tempFile = File.createTempFile("fileoffsetbackingstore", null);
    props = new HashMap<>();
    props.put(StandaloneConfig.OFFSET_STORAGE_FILE_FILENAME_CONFIG, tempFile.getAbsolutePath());
    props.put(StandaloneConfig.KEY_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter");
    props.put(StandaloneConfig.VALUE_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter");
    config = new StandaloneConfig(props);
    store.configure(config);
    store.start();
}
Also used : StandaloneConfig(org.apache.kafka.connect.runtime.standalone.StandaloneConfig) Before(org.junit.Before)

Aggregations

StandaloneConfig (org.apache.kafka.connect.runtime.standalone.StandaloneConfig)17 HashMap (java.util.HashMap)8 Before (org.junit.Before)7 MockTime (org.apache.kafka.common.utils.MockTime)5 PluginClassLoader (org.apache.kafka.connect.runtime.isolation.PluginClassLoader)5 Worker (org.apache.kafka.connect.runtime.Worker)4 Plugins (org.apache.kafka.connect.runtime.isolation.Plugins)4 StandaloneHerder (org.apache.kafka.connect.runtime.standalone.StandaloneHerder)4 WorkerConfig (org.apache.kafka.connect.runtime.WorkerConfig)3 URI (java.net.URI)2 TestKafkaBroker (org.apache.ignite.stream.kafka.TestKafkaBroker)2 SystemTime (org.apache.kafka.common.utils.SystemTime)2 Time (org.apache.kafka.common.utils.Time)2 Connect (org.apache.kafka.connect.runtime.Connect)2 Herder (org.apache.kafka.connect.runtime.Herder)2 MockMetricsReporter (org.apache.kafka.connect.runtime.MockConnectMetrics.MockMetricsReporter)2 WorkerInfo (org.apache.kafka.connect.runtime.WorkerInfo)2 RestServer (org.apache.kafka.connect.runtime.rest.RestServer)2 FileOffsetBackingStore (org.apache.kafka.connect.storage.FileOffsetBackingStore)2 FutureCallback (org.apache.kafka.connect.util.FutureCallback)2