Пример #1
0
        private static void TestJobLifecycle(AzureHDInsightJobDefinition mapReduceJobDefinition)
        {
            ClusterDetails    testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster();
            AzureHDInsightJob startedJob  = TestJobStart(mapReduceJobDefinition, testCluster);

            TestJobStop(testCluster, startedJob.JobId);
        }
Пример #2
0
        private static AzureHDInsightJob TestJobStart(AzureHDInsightJobDefinition mapReduceJobDefinition, ClusterDetails testCluster)
        {
            IStartAzureHDInsightJobCommand startJobCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateStartJob();

            startJobCommand.Cluster       = testCluster.ConnectionUrl;
            startJobCommand.Credential    = GetPSCredential(testCluster.HttpUserName, testCluster.HttpPassword);
            startJobCommand.JobDefinition = mapReduceJobDefinition;
            startJobCommand.EndProcessing();
            AzureHDInsightJob jobCreationResults = startJobCommand.Output.ElementAt(0);

            Assert.IsNotNull(jobCreationResults.JobId, "Should get a non-null jobDetails id");
            Assert.IsNotNull(jobCreationResults.StatusDirectory, "StatusDirectory should be set on jobDetails");
            return(jobCreationResults);
        }
Пример #3
0
        protected virtual async Task <AzureHDInsightJob> StartJob(
            AzureHDInsightJobDefinition jobDefinition, AzureHDInsightClusterConnection currentConnection)
        {
            jobDefinition.ArgumentNotNull("jobDefinition");
            currentConnection.ArgumentNotNull("currentCluster");
            this.ValidateNotCanceled();
            var startJobCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateStartJob();

            this.SetClient(startJobCommand);
            startJobCommand.Cluster             = currentConnection.Cluster.Name;
            startJobCommand.Logger              = this.Logger;
            startJobCommand.CurrentSubscription = this.CurrentSubscription;
            startJobCommand.JobDefinition       = jobDefinition;
            this.ValidateNotCanceled();
            await startJobCommand.EndProcessing();

            return(startJobCommand.Output.Last());
        }
Пример #4
0
        internal static AzureHDInsightJob RunJobInPowershell(
            IRunspace runspace, AzureHDInsightJobDefinition mapReduceJobDefinition, ClusterDetails cluster)
        {
            IPipelineResult results =
                runspace.NewPipeline()
                .AddCommand(CmdletConstants.StartAzureHDInsightJob)
                .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl)
                .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                .WithParameter(CmdletConstants.JobDefinition, mapReduceJobDefinition)
                .Invoke();

            Assert.AreEqual(1, results.Results.Count);
            IEnumerable <AzureHDInsightJob> jobCreationCmdletResults = results.Results.ToEnumerable <AzureHDInsightJob>();
            AzureHDInsightJob jobCreationResults = jobCreationCmdletResults.First();

            Assert.IsNotNull(jobCreationResults.JobId, "Should get a non-null jobDetails id");

            return(jobCreationResults);
        }
Пример #5
0
        internal static AzureHDInsightJob RunJobInPowershell(
            IRunspace runspace, AzureHDInsightJobDefinition mapReduceJobDefinition, ClusterDetails cluster, bool debug, string expectedLogMessage)
        {
            IPipelineResult result = null;

            if (debug)
            {
                var logWriter = new PowershellLogWriter();
                BufferingLogWriterFactory.Instance = logWriter;
                result =
                    runspace.NewPipeline()
                    .AddCommand(CmdletConstants.StartAzureHDInsightJob)
                    .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl)
                    .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                    .WithParameter(CmdletConstants.JobDefinition, mapReduceJobDefinition)
                    .WithParameter(CmdletConstants.Debug, null)
                    .Invoke();

                Assert.IsTrue(logWriter.Buffer.Any(message => message.Contains(expectedLogMessage)));
                BufferingLogWriterFactory.Reset();
            }
            else
            {
                result =
                    runspace.NewPipeline()
                    .AddCommand(CmdletConstants.StartAzureHDInsightJob)
                    .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl)
                    .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                    .WithParameter(CmdletConstants.JobDefinition, mapReduceJobDefinition)
                    .Invoke();
            }
            Assert.AreEqual(1, result.Results.Count);
            IEnumerable <AzureHDInsightJob> jobCreationCmdletResults = result.Results.ToEnumerable <AzureHDInsightJob>();
            AzureHDInsightJob jobCreationResults = jobCreationCmdletResults.First();

            Assert.IsNotNull(jobCreationResults.JobId, "Should get a non-null jobDetails id");

            return(jobCreationResults);
        }
Пример #6
0
 internal static AzureHDInsightJob RunJobInPowershell(IRunspace runspace, AzureHDInsightJobDefinition mapReduceJobDefinition)
 {
     return(RunJobInPowershell(runspace, mapReduceJobDefinition, CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster()));
 }
        internal static AzureHDInsightJob RunJobInPowershell(
            IRunspace runspace, AzureHDInsightJobDefinition mapReduceJobDefinition, ClusterDetails cluster, bool debug, string expectedLogMessage)
        {
            IPipelineResult result = null;
            if (debug)
            {
                var logWriter = new PowershellLogWriter();
                BufferingLogWriterFactory.Instance = logWriter;
                result =
                    runspace.NewPipeline()
                            .AddCommand(CmdletConstants.StartAzureHDInsightJob)
                            .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl)
                            .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                            .WithParameter(CmdletConstants.JobDefinition, mapReduceJobDefinition)
                            .WithParameter(CmdletConstants.Debug, null)
                            .Invoke();

                Assert.IsTrue(logWriter.Buffer.Any(message => message.Contains(expectedLogMessage)));
                BufferingLogWriterFactory.Reset();
            }
            else
            {
                result =
                    runspace.NewPipeline()
                            .AddCommand(CmdletConstants.StartAzureHDInsightJob)
                            .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl)
                            .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                            .WithParameter(CmdletConstants.JobDefinition, mapReduceJobDefinition)
                            .Invoke();
            }
            Assert.AreEqual(1, result.Results.Count);
            IEnumerable<AzureHDInsightJob> jobCreationCmdletResults = result.Results.ToEnumerable<AzureHDInsightJob>();
            AzureHDInsightJob jobCreationResults = jobCreationCmdletResults.First();
            Assert.IsNotNull(jobCreationResults.JobId, "Should get a non-null jobDetails id");

            return jobCreationResults;
        }
        internal static AzureHDInsightJob RunJobInPowershell(
            IRunspace runspace, AzureHDInsightJobDefinition mapReduceJobDefinition, ClusterDetails cluster)
        {
            IPipelineResult results =
                runspace.NewPipeline()
                        .AddCommand(CmdletConstants.StartAzureHDInsightJob)
                        .WithParameter(CmdletConstants.Cluster, cluster.ConnectionUrl)
                        .WithParameter(CmdletConstants.Credential, GetPSCredential(cluster.HttpUserName, cluster.HttpPassword))
                        .WithParameter(CmdletConstants.JobDefinition, mapReduceJobDefinition)
                        .Invoke();
            Assert.AreEqual(1, results.Results.Count);
            IEnumerable<AzureHDInsightJob> jobCreationCmdletResults = results.Results.ToEnumerable<AzureHDInsightJob>();
            AzureHDInsightJob jobCreationResults = jobCreationCmdletResults.First();
            Assert.IsNotNull(jobCreationResults.JobId, "Should get a non-null jobDetails id");

            return jobCreationResults;
        }
 internal static AzureHDInsightJob RunJobInPowershell(IRunspace runspace, AzureHDInsightJobDefinition mapReduceJobDefinition)
 {
     return RunJobInPowershell(runspace, mapReduceJobDefinition, CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster());
 }
 private static AzureHDInsightJob TestJobStart(AzureHDInsightJobDefinition mapReduceJobDefinition)
 {
     ClusterDetails testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster();
     IStartAzureHDInsightJobCommand startJobCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateStartJob();
     startJobCommand.Cluster = testCluster.ConnectionUrl;
     startJobCommand.Credential = GetPSCredential(testCluster.HttpUserName, testCluster.HttpPassword);
     startJobCommand.JobDefinition = mapReduceJobDefinition;
     startJobCommand.EndProcessing().Wait();
     AzureHDInsightJob jobCreationResults = startJobCommand.Output.ElementAt(0);
     Assert.IsNotNull(jobCreationResults.JobId, "Should get a non-null jobDetails id");
     Assert.IsNotNull(jobCreationResults.StatusDirectory, "StatusDirectory should be set on jobDetails");
     return jobCreationResults;
 }
 private static void TestJobLifecycle(AzureHDInsightJobDefinition mapReduceJobDefinition)
 {
     ClusterDetails testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster();
     AzureHDInsightJob startedJob = TestJobStart(mapReduceJobDefinition, testCluster);
     TestJobStop(testCluster, startedJob.JobId);
 }
 private static AzureHDInsightJob TestJobStart(AzureHDInsightJobDefinition mapReduceJobDefinition)
 {
     ClusterDetails testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster();
     return TestJobStart(mapReduceJobDefinition, testCluster);
 }
 protected virtual async Task<AzureHDInsightJob> StartJob(
     AzureHDInsightJobDefinition jobDefinition, AzureHDInsightClusterConnection currentConnection)
 {
     jobDefinition.ArgumentNotNull("jobDefinition");
     currentConnection.ArgumentNotNull("currentCluster");
     this.ValidateNotCanceled();
     var startJobCommand = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateStartJob();
     this.SetClient(startJobCommand);
     startJobCommand.Cluster = currentConnection.Cluster.Name;
     startJobCommand.Logger = this.Logger;
     startJobCommand.CurrentSubscription = this.CurrentSubscription;
     startJobCommand.JobDefinition = jobDefinition;
     this.ValidateNotCanceled();
     await startJobCommand.EndProcessing();
     return startJobCommand.Output.Last();
 }
Пример #14
0
        private static AzureHDInsightJob TestJobStart(AzureHDInsightJobDefinition mapReduceJobDefinition)
        {
            ClusterDetails testCluster = CmdletScenariosTestCaseBase.GetHttpAccessEnabledCluster();

            return(TestJobStart(mapReduceJobDefinition, testCluster));
        }