public void ICanGetAJob() { var expectedJob = new JobDetails() { ExitCode = 12, Name = "some jobDetails", StatusCode = Hadoop.Client.JobStatusCode.Completed, JobId = "2345" }; var factory = new MockRemotePocoLayerFactory(); var pocoMock = new MockRemotePoco { JobId = string.Empty, JobDetails = expectedJob }; factory.Mock = pocoMock; ServiceLocator.Instance.Locate <IServiceLocationIndividualTestManager>().Override <IRemoteHadoopJobSubmissionPocoClientFactory>(factory); var creds = new BasicAuthCredential() { Password = "******", Server = new Uri("http://somewhere"), UserName = "******" }; var poco = new HDInsightJobSubmissionPocoClient(creds, GetAbstractionContext(), false, pocoMock.GetUserAgentString()); var task = poco.GetJob("2345"); task.Wait(); Assert.AreEqual("2345", task.Result.JobId); Assert.IsTrue(pocoMock.GetJobCalled); Assert.AreEqual(expectedJob, task.Result); }
public void ICanSubmitASqoopJob() { var factory = new MockRemotePocoLayerFactory(); var pocoMock = new MockRemotePoco(); pocoMock.JobId = "54321"; factory.Mock = pocoMock; ServiceLocator.Instance.Locate <IServiceLocationIndividualTestManager>().Override <IRemoteHadoopJobSubmissionPocoClientFactory>(factory); // var creds = new JobSubmissionCertificateCredential(Guid.NewGuid(), null, "someCluster"); var creds = new BasicAuthCredential() { Password = "******", Server = new Uri("http://somewhere"), UserName = "******" }; var poco = new HDInsightJobSubmissionPocoClient(creds, GetAbstractionContext(), false, pocoMock.GetUserAgentString()); var task = poco.SubmitSqoopJob(new SqoopJobCreateParameters() { Command = "load remote;" }); task.Wait(); Assert.AreEqual("54321", task.Result.JobId); Assert.IsTrue(pocoMock.SubmitSqoopJobCalled); }
public void ICanListJobs() { var expectedJob = new JobDetails() { ExitCode = 12, Name = "some jobDetails", StatusCode = JobStatusCode.Completed, JobId = "2345" }; var factory = new MockRemotePocoLayerFactory(); var pocoMock = new MockRemotePoco { JobId = string.Empty, JobDetails = expectedJob }; factory.Mock = pocoMock; ServiceLocator.Instance.Locate<IServiceLocationIndividualTestManager>().Override<IRemoteHadoopJobSubmissionPocoClientFactory>(factory); // var creds = new JobSubmissionCertificateCredential(Guid.NewGuid(), null, "someCluster"); var creds = new BasicAuthCredential() { Password = "******", Server = new Uri("http://somewhere"), UserName = "******" }; var poco = new HDInsightJobSubmissionPocoClient(creds, GetAbstractionContext(), false, pocoMock.GetUserAgentString()); var task = poco.ListJobs(); task.Wait(); Assert.IsNotNull(task.Result); Assert.IsTrue(pocoMock.ListJobsCalled); Assert.AreEqual(1, task.Result.Jobs.Count); var job = task.Result.Jobs.First(); Assert.AreEqual("2345", job.JobId); Assert.AreEqual(expectedJob, job); }
public void ICanSubmitASqoopJob() { var factory = new MockRemotePocoLayerFactory(); var pocoMock = new MockRemotePoco(); pocoMock.JobId = "54321"; factory.Mock = pocoMock; ServiceLocator.Instance.Locate<IServiceLocationIndividualTestManager>().Override<IRemoteHadoopJobSubmissionPocoClientFactory>(factory); // var creds = new JobSubmissionCertificateCredential(Guid.NewGuid(), null, "someCluster"); var creds = new BasicAuthCredential() { Password = "******", Server = new Uri("http://somewhere"), UserName = "******" }; var poco = new HDInsightJobSubmissionPocoClient(creds, GetAbstractionContext(), false, pocoMock.GetUserAgentString()); var task = poco.SubmitSqoopJob(new SqoopJobCreateParameters() { Command = "load remote;" }); task.Wait(); Assert.AreEqual("54321", task.Result.JobId); Assert.IsTrue(pocoMock.SubmitSqoopJobCalled); }