public void StepNameIsMissing()
        {
            //Input
            JarStep jarStep = new JarStep();

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

            //Action
            try
            {
                jarStep.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>("Name property is missing for the Step. Example: \"map-reduce job 1\"", ex.Message, "Unexpected exception message");
            }
        }
        public void VisitJarStep()
        {
            //Init args
            JarStep jarStep = new JarStep();

            jarStep.Name            = "step-for-Hadoop-Version:{hadoopVersion}";
            jarStep.MainClass       = "com.supperslonic.{hadoopVersion}.Driver";
            jarStep.JarPath         = "{myBucket}/my.jar";
            jarStep.ActionOnFailure = ActionOnFailure.TERMINATE_CLUSTER;
            jarStep.Args            = new List <string> {
                "{arg1}", "900"
            };

            //Expectations
            List <string> expectedArgs = new List <string>()
            {
                "1234", "900"
            };

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

            //Action
            jarStep.Accept(visitor);

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

            StepConfig actual = visitorSubscriber.stepList[0];

            Assert.AreEqual("step-for-Hadoop-Version:2.2.0", actual.Name, "Unexpected Name");
            Assert.AreEqual(ActionOnFailure.TERMINATE_CLUSTER, actual.ActionOnFailure, "Unexpected ActionOnFailure");
            Assert.AreEqual("s3://myBucket/my.jar", actual.HadoopJarStep.Jar, "Unexpected Jar");
            Assert.AreEqual("com.supperslonic.2.2.0.Driver", actual.HadoopJarStep.MainClass, "Unexpected MainClass");
            Assert.IsTrue(expectedArgs.SequenceEqual(actual.HadoopJarStep.Args), "Unexpected args list");
        }