use of org.apache.kafka.connect.runtime.MockConnectMetrics in project kafka by apache.
the class ErrorReporterTest method setup.
@Before
public void setup() {
metrics = new MockConnectMetrics();
errorHandlingMetrics = new ErrorHandlingMetrics(new ConnectorTaskId("connector-", 1), metrics);
}
use of org.apache.kafka.connect.runtime.MockConnectMetrics in project kafka by apache.
the class DistributedHerderTest method setUp.
@Before
public void setUp() throws Exception {
time = new MockTime();
metrics = new MockConnectMetrics(time);
worker = PowerMock.createMock(Worker.class);
EasyMock.expect(worker.isSinkConnector(CONN1)).andStubReturn(Boolean.TRUE);
AutoCloseable uponShutdown = () -> shutdownCalled.countDown();
// Default to the old protocol unless specified otherwise
connectProtocolVersion = CONNECT_PROTOCOL_V0;
herder = PowerMock.createPartialMock(DistributedHerder.class, new String[] { "connectorTypeForClass", "updateDeletedConnectorStatus", "updateDeletedTaskStatus", "validateConnectorConfig", "buildRestartPlan", "recordRestarting" }, new DistributedConfig(HERDER_CONFIG), worker, WORKER_ID, KAFKA_CLUSTER_ID, statusBackingStore, configBackingStore, member, MEMBER_URL, metrics, time, noneConnectorClientConfigOverridePolicy, new AutoCloseable[] { uponShutdown });
configUpdateListener = herder.new ConfigUpdateListener();
rebalanceListener = herder.new RebalanceListener(time);
plugins = PowerMock.createMock(Plugins.class);
conn1SinkConfig = new SinkConnectorConfig(plugins, CONN1_CONFIG);
conn1SinkConfigUpdated = new SinkConnectorConfig(plugins, CONN1_CONFIG_UPDATED);
EasyMock.expect(herder.connectorTypeForClass(BogusSourceConnector.class.getName())).andReturn(ConnectorType.SOURCE).anyTimes();
pluginLoader = PowerMock.createMock(PluginClassLoader.class);
delegatingLoader = PowerMock.createMock(DelegatingClassLoader.class);
PowerMock.mockStatic(Plugins.class);
PowerMock.expectPrivate(herder, "updateDeletedConnectorStatus").andVoid().anyTimes();
PowerMock.expectPrivate(herder, "updateDeletedTaskStatus").andVoid().anyTimes();
}
use of org.apache.kafka.connect.runtime.MockConnectMetrics in project apache-kafka-on-k8s by banzaicloud.
the class DistributedHerderTest method setUp.
@Before
public void setUp() throws Exception {
time = new MockTime();
metrics = new MockConnectMetrics(time);
worker = PowerMock.createMock(Worker.class);
EasyMock.expect(worker.isSinkConnector(CONN1)).andStubReturn(Boolean.TRUE);
herder = PowerMock.createPartialMock(DistributedHerder.class, new String[] { "backoff", "connectorTypeForClass", "updateDeletedConnectorStatus" }, new DistributedConfig(HERDER_CONFIG), worker, WORKER_ID, KAFKA_CLUSTER_ID, statusBackingStore, configBackingStore, member, MEMBER_URL, metrics, time);
configUpdateListener = herder.new ConfigUpdateListener();
rebalanceListener = herder.new RebalanceListener();
plugins = PowerMock.createMock(Plugins.class);
conn1SinkConfig = new SinkConnectorConfig(plugins, CONN1_CONFIG);
conn1SinkConfigUpdated = new SinkConnectorConfig(plugins, CONN1_CONFIG_UPDATED);
EasyMock.expect(herder.connectorTypeForClass(BogusSourceConnector.class.getName())).andReturn(ConnectorType.SOURCE).anyTimes();
pluginLoader = PowerMock.createMock(PluginClassLoader.class);
delegatingLoader = PowerMock.createMock(DelegatingClassLoader.class);
PowerMock.mockStatic(Plugins.class);
PowerMock.expectPrivate(herder, "updateDeletedConnectorStatus").andVoid().anyTimes();
}
Aggregations