コード例 #1
0
        public void WindowedChangelogTopicGetPropertiesWithDefault()
        {
            WindowedChangelogTopicConfig c = new WindowedChangelogTopicConfig()
            {
                Name             = "topic1",
                NumberPartitions = 1,
                Configs          = new Dictionary <string, string>()
                {
                    { "config1", "100" }
                },
                RetentionMs = 50
            };

            var configs = c.GetProperties(new Dictionary <string, string>()
            {
                { "default1", "test" }
            }, 120);

            Assert.AreEqual(5, configs.Count);
            Assert.AreEqual("test", configs["default1"]);
            Assert.AreEqual("170", configs[InternalTopicConfigCst.RETENTION_MS_CONFIG]);
            Assert.AreEqual("100", configs["config1"]);
            Assert.AreEqual("CreateTime", configs[InternalTopicConfigCst.MESSAGE_TIMESTAMP_TYPE_CONFIG]);
            Assert.AreEqual("compact,delete", configs[InternalTopicConfigCst.CLEANUP_POLICY_CONFIG]);
        }
コード例 #2
0
        public void WindowedChangelogTopicConfigCtrComplete()
        {
            WindowedChangelogTopicConfig c = new WindowedChangelogTopicConfig()
            {
                Name             = "topic1",
                NumberPartitions = 1,
                RetentionMs      = 10,
                Configs          = new Dictionary <string, string>()
            };

            Assert.AreEqual("topic1", c.Name);
            Assert.AreEqual(1, c.NumberPartitions);
            Assert.AreEqual(10, c.RetentionMs);
            Assert.AreEqual(0, c.Configs.Count);
        }
コード例 #3
0
        public void WindowedChangelogTopicGetPropertiesTooBigLonger()
        {
            WindowedChangelogTopicConfig c = new WindowedChangelogTopicConfig()
            {
                Name             = "topic1",
                NumberPartitions = 1,
                Configs          = new Dictionary <string, string>(),
                RetentionMs      = long.MaxValue - 3
            };

            var configs = c.GetProperties(new Dictionary <string, string>(), 5);

            Assert.AreEqual(3, configs.Count);
            Assert.AreEqual(long.MaxValue.ToString(), configs[InternalTopicConfigCst.RETENTION_MS_CONFIG]);
            Assert.AreEqual("CreateTime", configs[InternalTopicConfigCst.MESSAGE_TIMESTAMP_TYPE_CONFIG]);
            Assert.AreEqual("compact,delete", configs[InternalTopicConfigCst.CLEANUP_POLICY_CONFIG]);
        }
コード例 #4
0
        public void WindowedChangelogTopicConfigRetention()
        {
            WindowedChangelogTopicConfig c = new WindowedChangelogTopicConfig()
            {
                Name             = "topic1",
                NumberPartitions = 1,
                Configs          = new Dictionary <string, string>()
                {
                    { InternalTopicConfigCst.RETENTION_MS_CONFIG, "100" }
                }
            };

            c.RetentionMs = 50;

            Assert.AreEqual("topic1", c.Name);
            Assert.AreEqual(1, c.NumberPartitions);
            Assert.AreEqual(100, c.RetentionMs);
            Assert.AreEqual(1, c.Configs.Count);
        }
コード例 #5
0
        private InternalTopicConfig CreateChangelogTopicConfig(StateStoreFactory stateStoreFactory, string changelogTopic)
        {
            if (stateStoreFactory.IsWindowStore)
            {
                var windowChangelogTopicConfig = new WindowedChangelogTopicConfig
                {
                    Configs     = stateStoreFactory.LogConfig,
                    Name        = changelogTopic,
                    RetentionMs = stateStoreFactory.RetentionMs
                };
                return(windowChangelogTopicConfig);
            }

            var unknownChangelogTopicConfig = new UnwindowedChangelogTopicConfig
            {
                Configs = stateStoreFactory.LogConfig,
                Name    = changelogTopic,
            };

            return(unknownChangelogTopicConfig);
        }