public void Visit(ClusterTag clusterTag)
        {
            if (String.IsNullOrEmpty(clusterTag.Key))
            {
                throw new InvalidOperationException(Resources.E_ClusterTagKeyIsMissing);
            }

            if (String.IsNullOrEmpty(clusterTag.Value))
            {
                throw new InvalidOperationException(Resources.E_ClusterTagValueIsMissing);
            }

            Tag tag = new Tag();

            tag.Key   = this.settings.FillPlaceHolders(clusterTag.Key);
            tag.Value = this.settings.FillPlaceHolders(clusterTag.Value);

            if (this.OnTagCreated != null)
            {
                this.OnTagCreated(this, tag);
            }
        }
        public void VisitClusterTag()
        {
            //Init args
            ClusterTag clusterTag = new ClusterTag()
            {
                Key = "contact-{jobFlowId}", Value = "url:{contact}"
            };

            //Init visitor
            BuildRequestVisitor visitor           = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings());
            VisitorSubscriber   visitorSubscriber = new VisitorSubscriber(visitor);

            //Action
            clusterTag.Accept(visitor);

            //Verify
            Assert.AreEqual(1, visitorSubscriber.TotalObjCount, "Unexpected number of objects created");

            Tag actual = visitorSubscriber.tagList[0];

            Assert.AreEqual("contact-j-111AAABBBNJ2I", actual.Key, "Unexpected Key");
            Assert.AreEqual("url:supperslonic.com", actual.Value, "Unexpected Value");
        }
        public void ClusterTagValueIsMissing()
        {
            //Input
            ClusterTag clusterTag = new ClusterTag()
            {
                Key = "tag1 key"
            };

            //Init visitor
            BuildRequestVisitor visitor           = new BuildRequestVisitor(BuildRequestVisitorTest.GetSettings());
            VisitorSubscriber   visitorSubscriber = new VisitorSubscriber(visitor);

            //Action
            try
            {
                clusterTag.Accept(visitor);
                Assert.Fail("Exception has not been thrown!!!");
            }
            catch (InvalidOperationException ex)
            {
                Assert.IsFalse(visitorSubscriber.wasAnyEventFired, "None of the visitor's events should be fired!");
                Assert.AreEqual <string>("Value property is missing for the Cluster Tag. Example: \"SupperSlonic.com\"", ex.Message, "Unexpected exception message");
            }
        }
Example #4
0
 public override int GetHashCode() => ClusterTag?.GetHashCode() ?? 0;