Esempio n. 1
0
        public void Topics_Update()
        {
            if (!TestConfig.Run_Management_Topic_UpdateDeleteTests) { Assert.Inconclusive(); }

            base.RunningTest = base.TestList["Update"];
            t.Create(base.SingleTestName);
            base.TopicsCreated.Add(base.SingleTestName);

            TopicDefinition tdf1 = t.GetDefinition(base.SingleTestName);
            TopicDefinition tdf2 = new TopicDefinition(tdf1.TopicName, tdf1);
            tdf2.MaxSizeInMegabytes = 5120;

            t.Update(tdf1.TopicName, tdf2);

            Thread.Sleep(500);

            TopicDefinition tdf3 = t.GetDefinition(tdf2.TopicName);

            Assert.AreNotEqual<TopicDefinition>(tdf1, tdf3);
            Assert.AreEqual<TopicDefinition>(tdf2, tdf3);

            TopicDefinition tdf4 = new TopicDefinition(tdf3.TopicName, tdf3);

            // Micro$suck says this is immutable after creation, but, whatever.
            // Change from TimeSpan.MaxValue (default) to 30 minutes.
            // Does not work for Topics -- Topics appears to return the same result (immutable)
            tdf4.DefaultMessageTimeToLive = new TimeSpan(0, 30, 0);

            t.Update(tdf4.TopicName, tdf4);

            Thread.Sleep(500);

            TopicDefinition tdf5 = t.GetDefinition(tdf4.TopicName);

            // Changed from Queues to accomodate Micro$uck's indifference to paying attention to detail; lacking documentation quality.
            //Assert.AreNotEqual<TopicDefinition>(tdf3, tdf5);
            Assert.AreEqual<TopicDefinition>(tdf3, tdf5);

            try
            {
                TopicDefinition tdf6 = new TopicDefinition(tdf5.TopicName, tdf5);
                tdf6.RequiresDuplicateDetection = (tdf6.RequiresDuplicateDetection) ? false : true;
                t.Update(tdf6.TopicName, tdf6);
                //The update should fail, and we should go no further. This can only be set at Topic creation time.
                Assert.Fail("RequiresDuplicateDetection can only be set at Topic creation time. If the Update operation succeeded, then this test should fail.");
            }
            catch //(Exception ex)
            {
                Console.WriteLine("Expected exception received attempting to update RequiresDuplicateDetection.");
                // Do nothing, pass.
            }
        }
Esempio n. 2
0
        public void Topics_Create_byName_withTopicDefinition()
        {
            if (!TestConfig.Run_Management_Topic_CreateTests) { Assert.Inconclusive(); }

            base.RunningTest = base.TestList["Topics_Create_byName_withTopicDefinition"];
            string testName = base.SingleTestName;
            TopicDefinition td = new TopicDefinition(testName);
            td.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0);
            td.DuplicateDetectionHistoryTimeWindow = new TimeSpan(0, 0, 15);
            td.EnableBatchedOperations = false;
            td.MaxSizeInMegabytes = 1024;
            Assert.AreEqual<string>(testName, td.TopicName);
            td.RequiresDuplicateDetection = true;
            t.Create(testName, td);
            base.TopicsCreated.Add(testName);
        }
Esempio n. 3
0
 public TopicDefinition(string topicName, TopicDefinition topicDefinition)
 {
     TopicName = topicName;
     //LockDuration = topicDefinition.LockDuration;
     MaxSizeInMegabytes = topicDefinition.MaxSizeInMegabytes;
     RequiresDuplicateDetection = topicDefinition.RequiresDuplicateDetection;
     DefaultMessageTimeToLive = topicDefinition.DefaultMessageTimeToLive;
     //DeadLetteringOnMessageExpiration = topicDefinition.DeadLetteringOnMessageExpiration;
     DuplicateDetectionHistoryTimeWindow = topicDefinition.DuplicateDetectionHistoryTimeWindow;
     /*
     MaxDeliveryCount =
         (topicDefinition.MaxDeliveryCount < 0 || topicDefinition.MaxDeliveryCount > UInt16.MaxValue) ?
         UInt16.MaxValue :
         Convert.ToUInt16(topicDefinition.MaxDeliveryCount);
     */
     EnableBatchedOperations = topicDefinition.EnableBatchedOperations;
     EnableFilteringMessagesBeforePublishing = topicDefinition.EnableFilteringMessagesBeforePublishing;
     //SupportOrdering = topicDefinition.SupportOrdering;
 }
Esempio n. 4
0
 public bool Create(string topicName, TopicDefinition topicDefinition)
 {
     return Create(topicName, topicDefinition.ToString(), false);
 }
Esempio n. 5
0
 public bool Update(string topicName, TopicDefinition topicDefinition)
 {
     return Update(topicName, topicDefinition.ToString());
 }