Search in sources :

Example 6 with StandaloneConfig

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

the class WorkerSinkTaskThreadedTest method setup.

@SuppressWarnings("unchecked")
@Override
public void setup() {
    super.setup();
    time = new MockTime();
    Map<String, String> workerProps = new HashMap<>();
    workerProps.put("key.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("value.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("internal.key.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("internal.value.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("internal.key.converter.schemas.enable", "false");
    workerProps.put("internal.value.converter.schemas.enable", "false");
    workerProps.put("offset.storage.file.filename", "/tmp/connect.offsets");
    workerConfig = new StandaloneConfig(workerProps);
    workerTask = PowerMock.createPartialMock(WorkerSinkTask.class, new String[] { "createConsumer" }, taskId, sinkTask, statusListener, initialState, workerConfig, keyConverter, valueConverter, TransformationChain.<SinkRecord>noOp(), time);
    recordsReturned = 0;
}
Also used : HashMap(java.util.HashMap) StandaloneConfig(org.apache.kafka.connect.runtime.standalone.StandaloneConfig) SinkRecord(org.apache.kafka.connect.sink.SinkRecord) MockTime(org.apache.kafka.connect.util.MockTime)

Example 7 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<String, String>();
    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");
    props.put(StandaloneConfig.INTERNAL_KEY_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter");
    props.put(StandaloneConfig.INTERNAL_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)

Example 8 with StandaloneConfig

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

the class WorkerTest method setup.

@Before
public void setup() {
    super.setup();
    Map<String, String> workerProps = new HashMap<>();
    workerProps.put("key.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("value.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("internal.key.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("internal.value.converter", "org.apache.kafka.connect.json.JsonConverter");
    workerProps.put("internal.key.converter.schemas.enable", "false");
    workerProps.put("internal.value.converter.schemas.enable", "false");
    workerProps.put("offset.storage.file.filename", "/tmp/connect.offsets");
    config = new StandaloneConfig(workerProps);
}
Also used : HashMap(java.util.HashMap) StandaloneConfig(org.apache.kafka.connect.runtime.standalone.StandaloneConfig) Before(org.junit.Before)

Example 9 with StandaloneConfig

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

the class IgniteSinkConnectorTest method beforeTest.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
protected void beforeTest() throws Exception {
    kafkaBroker = new TestKafkaBroker();
    for (String topic : TOPICS) kafkaBroker.createTopic(topic, PARTITIONS, REPLICATION_FACTOR);
    WorkerConfig workerCfg = new StandaloneConfig(makeWorkerProps());
    OffsetBackingStore offBackingStore = mock(OffsetBackingStore.class);
    offBackingStore.configure(workerCfg);
    worker = new Worker(WORKER_ID, new SystemTime(), workerCfg, offBackingStore);
    worker.start();
    herder = new StandaloneHerder(worker);
    herder.start();
}
Also used : OffsetBackingStore(org.apache.kafka.connect.storage.OffsetBackingStore) StandaloneHerder(org.apache.kafka.connect.runtime.standalone.StandaloneHerder) WorkerConfig(org.apache.kafka.connect.runtime.WorkerConfig) Worker(org.apache.kafka.connect.runtime.Worker) TestKafkaBroker(org.apache.ignite.stream.kafka.TestKafkaBroker) StandaloneConfig(org.apache.kafka.connect.runtime.standalone.StandaloneConfig) SystemTime(org.apache.kafka.common.utils.SystemTime)

Aggregations

StandaloneConfig (org.apache.kafka.connect.runtime.standalone.StandaloneConfig)9 HashMap (java.util.HashMap)4 Worker (org.apache.kafka.connect.runtime.Worker)3 WorkerConfig (org.apache.kafka.connect.runtime.WorkerConfig)3 StandaloneHerder (org.apache.kafka.connect.runtime.standalone.StandaloneHerder)3 Before (org.junit.Before)3 TestKafkaBroker (org.apache.ignite.stream.kafka.TestKafkaBroker)2 SystemTime (org.apache.kafka.common.utils.SystemTime)2 MockTime (org.apache.kafka.connect.util.MockTime)2 URI (java.net.URI)1 Response (javax.ws.rs.core.Response)1 Time (org.apache.kafka.common.utils.Time)1 Connect (org.apache.kafka.connect.runtime.Connect)1 ConnectorFactory (org.apache.kafka.connect.runtime.ConnectorFactory)1 Herder (org.apache.kafka.connect.runtime.Herder)1 RestServer (org.apache.kafka.connect.runtime.rest.RestServer)1 ConnectorInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo)1 SinkRecord (org.apache.kafka.connect.sink.SinkRecord)1 FileOffsetBackingStore (org.apache.kafka.connect.storage.FileOffsetBackingStore)1 MemoryOffsetBackingStore (org.apache.kafka.connect.storage.MemoryOffsetBackingStore)1