예제 #1
0
        public void SetAttributesTest()
        {
            Topic topic = client.GetNativeTopic("UTTopic");

            var resp = topic.GetAttributes();
            var originalLoggingEnabled = resp.Attributes.LoggingEnabled;

            TopicAttributes qa = new TopicAttributes();

            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(originalLoggingEnabled, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = false
            };
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes();
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = true
            };
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(true, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes();
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(true, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = false
            };
            topic.SetAttributes(qa);
            resp = topic.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);

            qa = new TopicAttributes()
            {
                LoggingEnabled = true
            };
            var req = new CreateTopicRequest()
            {
                TopicName = "UTTopic2", Attributes = qa
            };
            Topic topic2 = client.CreateTopic(req);

            resp = topic2.GetAttributes();
            Assert.AreEqual(true, resp.Attributes.LoggingEnabled);

            client.DeleteTopic("UTTopic2");

            qa = new TopicAttributes()
            {
                LoggingEnabled = false
            };
            req = new CreateTopicRequest()
            {
                TopicName = "UTTopic2", Attributes = qa
            };
            topic2 = client.CreateTopic(req);
            resp   = topic2.GetAttributes();
            Assert.AreEqual(false, resp.Attributes.LoggingEnabled);
        }
예제 #2
0
 public TopicAgent(IMNS client, string topicName)
 {
     topic = client.GetNativeTopic(topicName);
 }