コード例 #1
0
        public void CanCreateSDKObjectFromPowershellObject()
        {
            var sqoopJobDefinition = new AzureHDInsightSqoopJobDefinition
            {
                Command = "Import into sqlserver",
                File = "http://myfileshare.txt",
                StatusFolder = Guid.NewGuid().ToString(),
            };

            sqoopJobDefinition.Arguments.Add("arg1");
            sqoopJobDefinition.Files.Add("file1.sqoop");
            SqoopJobCreateParameters sdkObject = sqoopJobDefinition.ToSqoopJobCreateParameters();

            Assert.AreEqual(sqoopJobDefinition.StatusFolder, sdkObject.StatusFolder);
            Assert.AreEqual(sqoopJobDefinition.File, sdkObject.File);
            Assert.AreEqual(sqoopJobDefinition.Command, sdkObject.Command);

            foreach (string file in sqoopJobDefinition.Files)
            {
                Assert.IsTrue(sdkObject.Files.Contains(file), file);
            }
        }
コード例 #2
0
        public void CanStartSqoopJob()
        {
            var sqoopJobDefinition = new AzureHDInsightSqoopJobDefinition { Command = "show tables;" };

            TestJobStart(sqoopJobDefinition);
        }
コード例 #3
0
 public void CannotStartSqoopJob_WithRestrictedCharacters()
 {
     var sqoopJobDefinition = new AzureHDInsightSqoopJobDefinition { Command = "show tables; %" };
     try
     {
         TestJobStart(sqoopJobDefinition);
         Assert.Fail();
     }
     catch (AggregateException aggregateException)
     {
         var invalidOperationException = aggregateException.GetBaseException() as InvalidOperationException;
         Assert.IsNotNull(invalidOperationException);
         Assert.AreEqual("Command 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 CannotStartSqoopJob_WithRestrictedCharacters()
 {
     var sqoopJobDefinition = new AzureHDInsightSqoopJobDefinition { Command = "show tables; %" };
     try
     {
         TestJobStart(sqoopJobDefinition);
         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");
     }
 }