use of org.apache.kafka.test.GlobalStateManagerStub in project kafka by apache.
the class GlobalStateTaskTest method before.
@Before
public void before() {
sourceOne = new MockSourceNode<>(new String[] { "t1" }, new StringDeserializer(), new StringDeserializer());
sourceTwo = new MockSourceNode<>(new String[] { "t2" }, new IntegerDeserializer(), new IntegerDeserializer());
processorNodes = Arrays.asList(sourceOne, sourceTwo, new MockProcessorNode<>(-1), new MockProcessorNode<>(-1));
final Set<String> storeNames = Utils.mkSet("t1-store", "t2-store");
final Map<String, SourceNode> sourceByTopics = new HashMap<>();
sourceByTopics.put("t1", sourceOne);
sourceByTopics.put("t2", sourceTwo);
final Map<String, String> storeToTopic = new HashMap<>();
storeToTopic.put("t1-store", "t1");
storeToTopic.put("t2-store", "t2");
final ProcessorTopology topology = new ProcessorTopology(processorNodes, sourceByTopics, Collections.<String, SinkNode>emptyMap(), Collections.<StateStore>emptyList(), storeToTopic, Collections.<StateStore>emptyList());
context = new NoOpProcessorContext();
t1 = new TopicPartition("t1", 1);
t2 = new TopicPartition("t2", 1);
offsets = new HashMap<>();
offsets.put(t1, 50L);
offsets.put(t2, 100L);
stateMgr = new GlobalStateManagerStub(storeNames, offsets);
globalStateTask = new GlobalStateUpdateTask(topology, context, stateMgr);
}
Aggregations