private void SetUp(Configuration config) { _messagesSentByTopic = new Dictionary <string, int> { { "test", 0 }, { "test2", 0 }, { "test1p", 0 }, { "test2p", 0 }, { "testallp", 0 } }; _nodes = new NodeMock[5]; for (int i = 0; i < _nodes.Length; ++i) { _nodes[i] = new NodeMock(); _nodes[i].MessageReceived += t => _messagesSentByTopic[t] += 1; // No need to use interlocked, NodeMock is synchronous } _routes = new Dictionary <string, Partition[]> { { "test1p", new[] { new Partition { Id = 0, Leader = _nodes[0] } } }, { "test2p", new[] { new Partition { Id = 0, Leader = _nodes[0] }, new Partition { Id = 1, Leader = _nodes[1] } } }, { "testallp", new[] { new Partition { Id = 0, Leader = _nodes[0] }, new Partition { Id = 1, Leader = _nodes[1] }, new Partition { Id = 2, Leader = _nodes[2] }, new Partition { Id = 3, Leader = _nodes[3] }, new Partition { Id = 4, Leader = _nodes[4] }, } } }; _cluster = new ClusterMock(_routes); MessagesEnqueued = MessagesExpired = MessagesReEnqueued = MessagesRouted = MessagesPostponed = RoutingTableRequired = 0; InitRouter(new ProduceRouter(_cluster, config, Pool)); _finished = null; }
public void TearDown() { _nodes = null; _cluster = null; }