public virtual void WaitForJobWithId() { var hiveJobDefinition = new HiveJobCreateParameters() { JobName = "show tables jobDetails", Query = "show tables" }; var cluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster(); using (var runspace = this.GetPowerShellRunspace()) { var results = runspace.NewPipeline() .AddCommand(CmdletConstants.NewAzureHDInsightHiveJobDefinition) .WithParameter(CmdletConstants.JobName, hiveJobDefinition.JobName) .WithParameter(CmdletConstants.Query, hiveJobDefinition.Query) .AddCommand(CmdletConstants.StartAzureHDInsightJob) .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl) .WithParameter(CmdletConstants.Credential, IntegrationTestBase.GetPSCredential(cluster.HttpUserName, cluster.HttpPassword)) .Invoke(); Assert.AreEqual(1, results.Results.Count); var job = results.Results.First().BaseObject as Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightJob; results = runspace.NewPipeline() .AddCommand(CmdletConstants.WaitAzureHDInsightJob) .WithParameter(CmdletConstants.Credential, IntegrationTestBase.GetPSCredential(cluster.HttpUserName, cluster.HttpPassword)) .WithParameter(CmdletConstants.JobId, job.JobId) .WithParameter(CmdletConstants.Cluster, job.Cluster) .Invoke(); var completedJob = results.Results.ToEnumerable <AzureHDInsightJob>().FirstOrDefault(); Assert.IsNotNull(completedJob); Assert.AreEqual(job.JobId, completedJob.JobId); Assert.AreEqual("Completed", completedJob.State); } }
public virtual void WaitForInvalidJobIdDoesNotThrow() { var jobDetails = new JobDetails() { JobId = Guid.NewGuid().ToString() }; var cluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster(); using (var runspace = this.GetPowerShellRunspace()) { runspace.NewPipeline() .AddCommand(CmdletConstants.WaitAzureHDInsightJob) .WithParameter(CmdletConstants.Credential, IntegrationTestBase.GetPSCredential(cluster.HttpUserName, cluster.HttpPassword)) .WithParameter(CmdletConstants.JobId, jobDetails.JobId) .WithParameter(CmdletConstants.Cluster, jobDetails.JobId) .Invoke(); } }