public void CannotCreateNewHiveJob_WithRestrictedCharacters_StartJob()
        {
            var hiveJobDefinition = new HiveJobCreateParameters {
                JobName = "show tables jobDetails", Query = "show tables %"
            };

            INewAzureHDInsightHiveJobDefinitionCommand newHiveJobDefinitionCommand =
                ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewHiveDefinition();

            newHiveJobDefinitionCommand.JobName = hiveJobDefinition.JobName;
            newHiveJobDefinitionCommand.Query   = hiveJobDefinition.Query;
            newHiveJobDefinitionCommand.EndProcessing();

            AzureHDInsightHiveJobDefinition hiveJobFromCommand = newHiveJobDefinitionCommand.Output.ElementAt(0);

            try
            {
                TestJobStart(hiveJobFromCommand);
                Assert.Fail();
            }
            catch (AggregateException aggregateException)
            {
                var invalidOperationException = aggregateException.GetBaseException() as InvalidOperationException;
                Assert.IsNotNull(invalidOperationException);
                Assert.AreEqual("Query text contains restricted character '%', please upload the query to a file in storage and re-submit the job using the -File parameter",
                                invalidOperationException.Message);
            }
        }
        public void CannotCreateNewHiveJob_WithRestrictedCharacters_StartJob()
        {
            var hiveJobDefinition = new HiveJobCreateParameters {
                JobName = "show tables jobDetails", Query = "show tables %"
            };

            INewAzureHDInsightHiveJobDefinitionCommand newHiveJobDefinitionCommand =
                ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewHiveDefinition();

            newHiveJobDefinitionCommand.JobName = hiveJobDefinition.JobName;
            newHiveJobDefinitionCommand.Query   = hiveJobDefinition.Query;
            newHiveJobDefinitionCommand.EndProcessing();

            AzureHDInsightHiveJobDefinition hiveJobFromCommand = newHiveJobDefinitionCommand.Output.ElementAt(0);

            try
            {
                TestJobStart(hiveJobFromCommand);
                Assert.Fail();
            }
            catch (AggregateException aggregateException)
            {
                var invalidOperationException = aggregateException.GetBaseException() as InvalidOperationException;
                Assert.IsNotNull(invalidOperationException);
                Assert.IsTrue(invalidOperationException.Message.Contains("Query contains restricted character :'%'"), "Exception not thrown for special character");
            }
        }
        public void CanCreateNewHiveJob_StartJob()
        {
            var hiveJobDefinition = new HiveJobCreateParameters {
                JobName = "show tables jobDetails", Query = "show tables"
            };

            INewAzureHDInsightHiveJobDefinitionCommand newHiveJobDefinitionCommand =
                ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewHiveDefinition();

            newHiveJobDefinitionCommand.JobName = hiveJobDefinition.JobName;
            newHiveJobDefinitionCommand.Query   = hiveJobDefinition.Query;
            newHiveJobDefinitionCommand.EndProcessing();

            AzureHDInsightHiveJobDefinition hiveJobFromCommand = newHiveJobDefinitionCommand.Output.ElementAt(0);

            TestJobStart(hiveJobFromCommand);
        }
Example #4
0
 /// <summary>
 ///     Initializes a new instance of the NewAzureHDInsightHiveJobDefinitionCmdlet class.
 /// </summary>
 public NewAzureHDInsightHiveJobDefinitionCmdlet()
 {
     this.command = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateNewHiveDefinition();
 }
 /// <summary>
 ///     Initializes a new instance of the NewAzureHDInsightHiveJobDefinitionCmdlet class.
 /// </summary>
 public NewAzureHDInsightHiveJobDefinitionCmdlet()
 {
     this.command = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateNewHiveDefinition();
 }