Search in sources :

Example 6 with StatusBackingStore

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

the class WorkerTaskTest method stopBeforeStarting.

@Test
public void stopBeforeStarting() {
    ConnectorTaskId taskId = new ConnectorTaskId("foo", 0);
    WorkerTask workerTask = partialMockBuilder(WorkerTask.class).withConstructor(ConnectorTaskId.class, TaskStatus.Listener.class, TargetState.class, ClassLoader.class, ConnectMetrics.class, RetryWithToleranceOperator.class, Time.class, StatusBackingStore.class).withArgs(taskId, statusListener, TargetState.STARTED, loader, metrics, retryWithToleranceOperator, Time.SYSTEM, statusBackingStore).addMockedMethod("initialize").addMockedMethod("execute").addMockedMethod("close").createStrictMock();
    workerTask.initialize(TASK_CONFIG);
    EasyMock.expectLastCall();
    workerTask.close();
    EasyMock.expectLastCall();
    replay(workerTask);
    workerTask.initialize(TASK_CONFIG);
    workerTask.stop();
    workerTask.awaitStop(1000L);
    // now run should not do anything
    workerTask.run();
    verify(workerTask);
}
Also used : StatusBackingStore(org.apache.kafka.connect.storage.StatusBackingStore) ConnectorTaskId(org.apache.kafka.connect.util.ConnectorTaskId) RetryWithToleranceOperator(org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator) MockTime(org.apache.kafka.common.utils.MockTime) Time(org.apache.kafka.common.utils.Time) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) RetryWithToleranceOperatorTest(org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperatorTest) Test(org.junit.Test)

Aggregations

StatusBackingStore (org.apache.kafka.connect.storage.StatusBackingStore)6 ConfigBackingStore (org.apache.kafka.connect.storage.ConfigBackingStore)5 HashMap (java.util.HashMap)3 Worker (org.apache.kafka.connect.runtime.Worker)3 DistributedConfig (org.apache.kafka.connect.runtime.distributed.DistributedConfig)3 DistributedHerder (org.apache.kafka.connect.runtime.distributed.DistributedHerder)3 Plugins (org.apache.kafka.connect.runtime.isolation.Plugins)3 Converter (org.apache.kafka.connect.storage.Converter)3 KafkaConfigBackingStore (org.apache.kafka.connect.storage.KafkaConfigBackingStore)3 KafkaOffsetBackingStore (org.apache.kafka.connect.storage.KafkaOffsetBackingStore)3 KafkaStatusBackingStore (org.apache.kafka.connect.storage.KafkaStatusBackingStore)3 URI (java.net.URI)2 Time (org.apache.kafka.common.utils.Time)2 Connector (org.apache.kafka.connect.connector.Connector)2 ConnectorClientConfigOverridePolicy (org.apache.kafka.connect.connector.policy.ConnectorClientConfigOverridePolicy)2 Connect (org.apache.kafka.connect.runtime.Connect)2 WorkerConfigTransformer (org.apache.kafka.connect.runtime.WorkerConfigTransformer)2 RestServer (org.apache.kafka.connect.runtime.rest.RestServer)2 SharedTopicAdmin (org.apache.kafka.connect.util.SharedTopicAdmin)2 Map (java.util.Map)1