public virtual void WaitForInvalidJobDoesNotThrow()
        {
            var jobDetails = new JobDetails { JobId = Guid.NewGuid().ToString() };
            var invalidJob = new AzureHDInsightJob(jobDetails, TestCredentials.WellKnownCluster.DnsName);

            // IHadoopClientExtensions.GetPollingInterval = () => 0;
            ClusterDetails cluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster();
            using (IRunspace runspace = this.GetPowerShellRunspace())
            {
                runspace.NewPipeline()
                                      .AddCommand(CmdletConstants.WaitAzureHDInsightJob)
                        .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                        .WithParameter(CmdletConstants.Job, invalidJob)
                                      .Invoke();
            }
        }
 protected virtual async Task WriteJobSuccess(AzureHDInsightJob completedJob, AzureHDInsightClusterConnection currentConnection)
 {
     completedJob.ArgumentNotNull("completedJob");
     currentConnection.ArgumentNotNull("currentConnection");
     this.WriteOutput("Hive query completed Successfully");
     this.WriteOutput(Environment.NewLine);
     this.ValidateNotCanceled();
     var getJobOutputCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateGetJobOutput();
     this.SetClient(getJobOutputCommand);
     getJobOutputCommand.JobId = completedJob.JobId;
     getJobOutputCommand.Logger = this.Logger;
     getJobOutputCommand.CurrentSubscription = this.CurrentSubscription;
     getJobOutputCommand.Cluster = currentConnection.Cluster.Name;
     this.ValidateNotCanceled();
     await getJobOutputCommand.EndProcessing();
     var outputStream = getJobOutputCommand.Output.First();
     string content = new StreamReader(outputStream).ReadToEnd();
     this.WriteOutput(content);
 }
 protected virtual async Task<AzureHDInsightJob> WaitForCompletion(
     AzureHDInsightJob startedJob, AzureHDInsightClusterConnection currentConnection)
 {
     startedJob.ArgumentNotNull("startedJob");
     currentConnection.ArgumentNotNull("currentConnection");
     this.ValidateNotCanceled();
     var waitJobCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateWaitJobs();
     waitJobCommand.JobStatusEvent += this.ClientOnJobStatus;
     this.SetClient(waitJobCommand);
     waitJobCommand.Job = startedJob;
     waitJobCommand.Logger = this.Logger;
     waitJobCommand.WaitTimeoutInSeconds = WaitAnHourInSeconds;
     waitJobCommand.CurrentSubscription = this.CurrentSubscription;
     this.ValidateNotCanceled();
     await waitJobCommand.ProcessRecord();
     return waitJobCommand.Output.Last();
 }