Exemple #1
0
        public void RegisterStateStoreAlreadyRegistered()
        {
            TaskId id = new TaskId {
                Id = 1, Partition = 0, Topic = "topic"
            };
            TopicPartition        partition = new TopicPartition("topic", 0);
            ProcessorStateManager stateMgt  = new ProcessorStateManager(id, partition);

            stateMgt.Register(new TestStateStore("state-store1"), null);
            Assert.Throws <ArgumentException>(() => stateMgt.Register(new TestStateStore("state-store1"), null));
        }
Exemple #2
0
        public void RegisterStateStoreAndGetUnknown()
        {
            TaskId id = new TaskId {
                Id = 1, Partition = 0, Topic = "topic"
            };
            TopicPartition        partition = new TopicPartition("topic", 0);
            ProcessorStateManager stateMgt  = new ProcessorStateManager(id, partition);

            stateMgt.Register(new TestStateStore("state-store1"), null);
            var store = stateMgt.GetStore("sdfdfre1");

            Assert.IsNull(store);
        }
        public void RegisterStateStoreAndGetIt()
        {
            TaskId id = new TaskId {
                Id = 1, Partition = 0
            };
            TopicPartition        partition = new TopicPartition("topic", 0);
            ProcessorStateManager stateMgt  = new ProcessorStateManager(id, new List <TopicPartition> {
                partition
            });

            stateMgt.Register(new TestStateStore("state-store1"), null);
            var store = stateMgt.GetStore("state-store1");

            Assert.IsNotNull(store);
            Assert.AreEqual("state-store1", store.Name);
        }
        public void GetChangelogTopicPartition()
        {
            TaskId id = new TaskId {
                Id = 0, Partition = 2
            };
            TopicPartition        partition = new TopicPartition("topic", 0);
            ProcessorStateManager stateMgt  = new ProcessorStateManager(
                id,
                new List <TopicPartition> {
                partition
            },
                new Dictionary <string, string> {
                { "state-store1", "state-store1-cl" }
            },
                new MockChangelogRegister(),
                new MockOffsetCheckpointManager());

            stateMgt.Register(new TestStateStore("state-store1"), null);
            var tp = stateMgt.GetRegisteredChangelogPartitionFor("state-store1");

            Assert.AreEqual(2, tp.Partition.Value);
            Assert.AreEqual("state-store1-cl", tp.Topic);
        }