public void Should_be_able_to_extend_topic_settings() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var topicsSettings = extensions.Topics(); Assert.IsInstanceOf <AzureServiceBusTopicSettings>(topicsSettings); }
public void Should_be_able_to_set_RequiresDuplicateDetection() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var topicSettings = extensions.Topics().RequiresDuplicateDetection(true); Assert.True(topicSettings.GetSettings().Get <bool>(WellKnownConfigurationKeys.Topology.Resources.Topics.RequiresDuplicateDetection)); }
public void Should_be_able_to_set_EnablePartitioning() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var topicSettings = extensions.Topics().EnablePartitioning(true); Assert.IsTrue(topicSettings.GetSettings().Get <bool>(WellKnownConfigurationKeys.Topology.Resources.Topics.EnablePartitioning)); }
public void Should_be_able_to_set_AutoDeleteOnIdle() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var topicSettings = extensions.Topics().AutoDeleteOnIdle(TimeSpan.MinValue); Assert.AreEqual(TimeSpan.MinValue, topicSettings.GetSettings().Get <TimeSpan>(WellKnownConfigurationKeys.Topology.Resources.Topics.AutoDeleteOnIdle)); }
public void Should_be_able_to_set_DuplicateDetectionHistoryTimeWindow() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var dedupTimeWindow = TimeSpan.FromMilliseconds(30000); var topicSettings = extensions.Topics().DuplicateDetectionHistoryTimeWindow(dedupTimeWindow); Assert.AreEqual(dedupTimeWindow, topicSettings.GetSettings().Get <TimeSpan>(WellKnownConfigurationKeys.Topology.Resources.Topics.DuplicateDetectionHistoryTimeWindow)); }
public void Should_be_able_to_set_DefaultMessageTimeToLive() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var timeToLive = TimeSpan.FromHours(5); var topicSettings = extensions.Topics().DefaultMessageTimeToLive(timeToLive); Assert.AreEqual(timeToLive, topicSettings.GetSettings().Get <TimeSpan>(WellKnownConfigurationKeys.Topology.Resources.Topics.DefaultMessageTimeToLive)); }
public void Should_be_able_to_set_MaxSizeInMegabytes() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); const long maxTopicSizeInMB = 2048; var topicSettings = extensions.Topics().MaxSizeInMegabytes(SizeInMegabytes.Size2048); Assert.AreEqual(maxTopicSizeInMB, topicSettings.GetSettings().Get <long>(WellKnownConfigurationKeys.Topology.Resources.Topics.MaxSizeInMegabytes)); }
public void Should_be_able_to_set_topic_description_factory_method() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); Func <string, ReadOnlySettings, TopicDescription> registeredFactory = (name, s) => new TopicDescription(name); var connectivitySettings = extensions.Topics().DescriptionFactory(registeredFactory); Assert.AreEqual(registeredFactory, connectivitySettings.GetSettings().Get <Func <string, ReadOnlySettings, TopicDescription> >(WellKnownConfigurationKeys.Topology.Resources.Topics.DescriptionFactory)); }
public void Should_be_able_to_set_EnableExpress_conditionally() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); Func <string, bool> condition = name => name != "expresstopic"; var topicSettings = extensions.Topics().EnableExpress(condition, true); Assert.IsTrue(topicSettings.GetSettings().Get <bool>(WellKnownConfigurationKeys.Topology.Resources.Topics.EnableExpress)); Assert.AreEqual(condition, topicSettings.GetSettings().Get <Func <string, bool> >(WellKnownConfigurationKeys.Topology.Resources.Topics.EnableExpressCondition)); }
public async Task Should_set_SupportOrdering_on_created_entity() { var namespaceManager = new NamespaceManagerAdapter(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); var settings = new DefaultConfigurationValues().Apply(new SettingsHolder()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.Topics().SupportOrdering(true); var creator = new AzureServiceBusTopicCreator(settings); const string topicPath = "mytopic12"; await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.IsTrue(foundTopic.SupportOrdering); }
public async Task Should_set_MaxSizeInMegabytes_on_created_entity() { var namespaceManager = new NamespaceManagerAdapter(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); var settings = new DefaultConfigurationValues().Apply(new SettingsHolder()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.Topics().MaxSizeInMegabytes(SizeInMegabytes.Size4096); var creator = new AzureServiceBusTopicCreator(settings); const string topicPath = "mytopic10"; await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(4096, foundTopic.MaxSizeInMegabytes); }
public async Task Should_set_DefaultMessageTimeToLive_on_the_created_entity() { var namespaceManager = new NamespaceManagerAdapter(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); var settings = new DefaultConfigurationValues().Apply(new SettingsHolder()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var timeToLive = TimeSpan.FromDays(1); extensions.Topics().DefaultMessageTimeToLive(timeToLive); var creator = new AzureServiceBusTopicCreator(settings); const string topicPath = "mytopic5"; await namespaceManager.DeleteTopic(topicPath); await creator.Create(topicPath, namespaceManager); var foundTopic = await namespaceManager.GetTopic(topicPath); Assert.AreEqual(timeToLive, foundTopic.DefaultMessageTimeToLive); }
public async Task Should_be_able_to_update_an_existing_topic_with_new_property_values_without_failing_on_readonly_properties() { var namespaceManager = new NamespaceManagerAdapter(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); await namespaceManager.DeleteTopic("existingtopic2"); await namespaceManager.CreateTopic(new TopicDescription("existingtopic2") { MaxSizeInMegabytes = SizeInMegabytes.Size2048, RequiresDuplicateDetection = true, EnablePartitioning = true }); var topicDescription = await namespaceManager.GetTopic("existingtopic2"); // partitioned topics will have a size that is 16x the requested max Assert.AreEqual(2048 * 16, topicDescription.MaxSizeInMegabytes); Assert.IsTrue(topicDescription.EnablePartitioning); Assert.IsTrue(topicDescription.RequiresDuplicateDetection); var settings = new DefaultConfigurationValues().Apply(new SettingsHolder()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.Topics().DescriptionFactory((queuePath, readOnlySettings) => new TopicDescription(queuePath) { MaxSizeInMegabytes = SizeInMegabytes.Size3072, RequiresDuplicateDetection = false, EnablePartitioning = false }); var creator = new AzureServiceBusTopicCreator(settings); await creator.Create("existingtopic2", namespaceManager); topicDescription = await namespaceManager.GetTopic("existingtopic2"); Assert.AreEqual(3072 * 16, topicDescription.MaxSizeInMegabytes); Assert.IsTrue(topicDescription.EnablePartitioning); Assert.IsTrue(topicDescription.RequiresDuplicateDetection); }
public async Task Should_use_topic_description_provided_by_user() { var settings = new DefaultConfigurationValues().Apply(new SettingsHolder()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var namespaceManager = new NamespaceManagerAdapter(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); const string topicPath = "mytopic3"; await namespaceManager.DeleteTopic(topicPath); var topicDescriptionToUse = new TopicDescription(topicPath) { AutoDeleteOnIdle = TimeSpan.MaxValue }; extensions.Topics().DescriptionFactory((path, s) => topicDescriptionToUse); var creator = new AzureServiceBusTopicCreator(settings); var description = await creator.Create(topicPath, namespaceManager); Assert.IsTrue(await namespaceManager.TopicExists(topicPath)); Assert.AreEqual(topicDescriptionToUse, description); }
public async Task Should_be_able_to_update_an_existing_topic_with_new_property_values() { var namespaceManager = new NamespaceManagerAdapter(NamespaceManager.CreateFromConnectionString(AzureServiceBusConnectionString.Value)); await namespaceManager.DeleteTopic("existingtopic1"); await namespaceManager.CreateTopic(new TopicDescription("existingtopic1")); var settings = new DefaultConfigurationValues().Apply(new SettingsHolder()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.Topics().DescriptionFactory((topicPath, readOnlySettings) => new TopicDescription(topicPath) { AutoDeleteOnIdle = TimeSpan.FromMinutes(100), EnableExpress = true }); var creator = new AzureServiceBusTopicCreator(settings); await creator.Create("existingtopic1", namespaceManager); var topicDescription = await namespaceManager.GetTopic("existingtopic1"); Assert.AreEqual(TimeSpan.FromMinutes(100), topicDescription.AutoDeleteOnIdle); }
public void Should_be_able_to_set_AutoDeleteOnIdle() { extensions.Topics().AutoDeleteOnIdle(TimeSpan.MinValue); Assert.AreEqual(TimeSpan.MinValue, settings.Get <TopologySettings>().TopicSettings.AutoDeleteOnIdle); }