Beispiel #1
0
        public WaitAzureHDInsightJobCommand GetWaitAzureHDInsightJobCommandDefinition(JobCompletionType jobCompetionType)
        {
            // Update HDInsight Management properties for Job.
            SetupManagementClientForJobTests();

            // Setup Job Management mocks
            const string jobId = "jobid_1984120_001";

            var cmdlet = new WaitAzureHDInsightJobCommand
            {
                CommandRuntime            = commandRuntimeMock.Object,
                HDInsightJobClient        = hdinsightJobManagementMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                HttpCredential            = new PSCredential("httpuser", string.Format("Password1!").ConvertToSecureString()),
                ClusterName      = ClusterName,
                JobId            = jobId,
                TimeoutInSeconds = 10
            };

            JobGetResponse jobDetails  = null;
            TimeSpan?      jobDuration = TimeSpan.FromSeconds(10);

            hdinsightJobManagementMock.Setup(c => c.WaitForJobCompletion(It.IsAny <string>(), It.IsAny <TimeSpan?>(), null))
            .Callback((string id, TimeSpan? duration, TimeSpan? interval) => { jobDetails = MockJobCompletion(id, jobCompetionType); })
            .Returns(() => jobDetails);

            return(cmdlet);
        }
Beispiel #2
0
        public WaitAzureHDInsightJobCommand GetWaitAzureHDInsightJobCommandDefinition(JobCompletionType jobCompetionType)
        {
            // Update HDInsight Management properties for Job.
            SetupManagementClientForJobTests();

            // Setup Job Management mocks
            const string jobId = "jobid_1984120_001";

            var cmdlet = new WaitAzureHDInsightJobCommand
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightJobClient = hdinsightJobManagementMock.Object,
                HDInsightManagementClient = hdinsightManagementMock.Object,
                HttpCredential = new PSCredential("httpuser", string.Format("Password1!").ConvertToSecureString()),
                ClusterName = ClusterName,
                JobId = jobId,
                TimeoutInSeconds = 10
            };

            JobGetResponse jobDetails = null;
            TimeSpan? jobDuration = TimeSpan.FromSeconds(10);
            hdinsightJobManagementMock.Setup(c => c.WaitForJobCompletion(It.IsAny<string>(), It.IsAny<TimeSpan?>(), null))
                .Callback((string id, TimeSpan? duration, TimeSpan? interval) => { jobDetails = MockJobCompletion(id, jobCompetionType); })
                .Returns(() => jobDetails);

            return cmdlet;
        }