|
|
@ -71,6 +71,7 @@ import java.util.HashMap; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperatorTest.NOOP_OPERATOR; |
|
|
|
import static org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperatorTest.NOOP_OPERATOR; |
|
|
|
import static org.easymock.EasyMock.anyObject; |
|
|
|
import static org.easymock.EasyMock.anyObject; |
|
|
@ -118,6 +119,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
@Mock private Converter taskKeyConverter; |
|
|
|
@Mock private Converter taskKeyConverter; |
|
|
|
@Mock private Converter taskValueConverter; |
|
|
|
@Mock private Converter taskValueConverter; |
|
|
|
@Mock private HeaderConverter taskHeaderConverter; |
|
|
|
@Mock private HeaderConverter taskHeaderConverter; |
|
|
|
|
|
|
|
@Mock private ExecutorService executorService; |
|
|
|
|
|
|
|
|
|
|
|
@Before |
|
|
|
@Before |
|
|
|
public void setup() { |
|
|
|
public void setup() { |
|
|
@ -543,8 +545,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
expectTaskValueConverters(ClassLoaderUsage.CURRENT_CLASSLOADER, taskValueConverter); |
|
|
|
expectTaskValueConverters(ClassLoaderUsage.CURRENT_CLASSLOADER, taskValueConverter); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.CURRENT_CLASSLOADER, taskHeaderConverter); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.CURRENT_CLASSLOADER, taskHeaderConverter); |
|
|
|
|
|
|
|
|
|
|
|
workerTask.run(); |
|
|
|
EasyMock.expect(executorService.submit(workerTask)).andReturn(null); |
|
|
|
EasyMock.expectLastCall(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EasyMock.expect(plugins.delegatingLoader()).andReturn(delegatingLoader); |
|
|
|
EasyMock.expect(plugins.delegatingLoader()).andReturn(delegatingLoader); |
|
|
|
EasyMock.expect(delegatingLoader.connectorLoader(WorkerTestConnector.class.getName())) |
|
|
|
EasyMock.expect(delegatingLoader.connectorLoader(WorkerTestConnector.class.getName())) |
|
|
@ -568,7 +569,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
|
|
|
|
|
|
|
|
PowerMock.replayAll(); |
|
|
|
PowerMock.replayAll(); |
|
|
|
|
|
|
|
|
|
|
|
worker = new Worker(WORKER_ID, new MockTime(), plugins, config, offsetBackingStore); |
|
|
|
worker = new Worker(WORKER_ID, new MockTime(), plugins, config, offsetBackingStore, executorService); |
|
|
|
worker.start(); |
|
|
|
worker.start(); |
|
|
|
assertStatistics(worker, 0, 0); |
|
|
|
assertStatistics(worker, 0, 0); |
|
|
|
assertStartupStatistics(worker, 0, 0, 0, 0); |
|
|
|
assertStartupStatistics(worker, 0, 0, 0, 0); |
|
|
@ -685,8 +686,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.CURRENT_CLASSLOADER, null); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.CURRENT_CLASSLOADER, null); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.PLUGINS, taskHeaderConverter); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.PLUGINS, taskHeaderConverter); |
|
|
|
|
|
|
|
|
|
|
|
workerTask.run(); |
|
|
|
EasyMock.expect(executorService.submit(workerTask)).andReturn(null); |
|
|
|
EasyMock.expectLastCall(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EasyMock.expect(plugins.delegatingLoader()).andReturn(delegatingLoader); |
|
|
|
EasyMock.expect(plugins.delegatingLoader()).andReturn(delegatingLoader); |
|
|
|
EasyMock.expect(delegatingLoader.connectorLoader(WorkerTestConnector.class.getName())) |
|
|
|
EasyMock.expect(delegatingLoader.connectorLoader(WorkerTestConnector.class.getName())) |
|
|
@ -712,7 +712,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
|
|
|
|
|
|
|
|
PowerMock.replayAll(); |
|
|
|
PowerMock.replayAll(); |
|
|
|
|
|
|
|
|
|
|
|
worker = new Worker(WORKER_ID, new MockTime(), plugins, config, offsetBackingStore); |
|
|
|
worker = new Worker(WORKER_ID, new MockTime(), plugins, config, offsetBackingStore, executorService); |
|
|
|
worker.start(); |
|
|
|
worker.start(); |
|
|
|
assertStatistics(worker, 0, 0); |
|
|
|
assertStatistics(worker, 0, 0); |
|
|
|
worker.startTask(TASK_ID, ClusterConfigState.EMPTY, anyConnectorConfigMap(), origProps, taskStatusListener, TargetState.STARTED); |
|
|
|
worker.startTask(TASK_ID, ClusterConfigState.EMPTY, anyConnectorConfigMap(), origProps, taskStatusListener, TargetState.STARTED); |
|
|
@ -778,8 +778,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.CURRENT_CLASSLOADER, null); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.CURRENT_CLASSLOADER, null); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.PLUGINS, taskHeaderConverter); |
|
|
|
expectTaskHeaderConverter(ClassLoaderUsage.PLUGINS, taskHeaderConverter); |
|
|
|
|
|
|
|
|
|
|
|
workerTask.run(); |
|
|
|
EasyMock.expect(executorService.submit(workerTask)).andReturn(null); |
|
|
|
EasyMock.expectLastCall(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EasyMock.expect(plugins.delegatingLoader()).andReturn(delegatingLoader); |
|
|
|
EasyMock.expect(plugins.delegatingLoader()).andReturn(delegatingLoader); |
|
|
|
EasyMock.expect(delegatingLoader.connectorLoader(WorkerTestConnector.class.getName())) |
|
|
|
EasyMock.expect(delegatingLoader.connectorLoader(WorkerTestConnector.class.getName())) |
|
|
@ -803,7 +802,7 @@ public class WorkerTest extends ThreadedTest { |
|
|
|
|
|
|
|
|
|
|
|
PowerMock.replayAll(); |
|
|
|
PowerMock.replayAll(); |
|
|
|
|
|
|
|
|
|
|
|
worker = new Worker(WORKER_ID, new MockTime(), plugins, config, offsetBackingStore); |
|
|
|
worker = new Worker(WORKER_ID, new MockTime(), plugins, config, offsetBackingStore, executorService); |
|
|
|
worker.start(); |
|
|
|
worker.start(); |
|
|
|
assertStatistics(worker, 0, 0); |
|
|
|
assertStatistics(worker, 0, 0); |
|
|
|
assertEquals(Collections.emptySet(), worker.taskIds()); |
|
|
|
assertEquals(Collections.emptySet(), worker.taskIds()); |
|
|
|