/// <inheritdoc />
 public async Task<HadoopJobList> ListJobs()
 {
     List<string> jobIds = new List<string>();
     JobPayloadConverter converter = new JobPayloadConverter();
     using (var client = ServiceLocator.Instance.Locate<IHDInsightJobSubmissionRestClientFactory>().Create(this.credentials))
     {
         var result = await client.ListJobs(dnsName, location);
         return converter.DeserializeJobList(result.Content);
     }
 }
 /// <inheritdoc />
 public async Task<HadoopJobCreationResults> SubmitMapReduceJob(HadoopMapReduceJobCreationDetails details)
 {
     JobPayloadConverter converter = new JobPayloadConverter();
     using (var client = ServiceLocator.Instance.Locate<IHDInsightJobSubmissionRestClientFactory>().Create(this.credentials))
     {
         var payload = converter.SerializeJobCreationDetails(details);
         var result = await client.CreateJob(dnsName, location, payload);
         return converter.DeserializeJobCreationResults(result.Content);
     }
 }
 /// <inheritdoc />
 public async Task<HadoopJob> GetJob(string jobId)
 {
     JobPayloadConverter converter = new JobPayloadConverter();
     using (var client = ServiceLocator.Instance.Locate<IHDInsightJobSubmissionRestClientFactory>().Create(this.credentials))
     {
         var result = await client.GetJobDetail(dnsName, location, jobId);
         var retval = converter.DeserializeJobDetails(result.Content, jobId);
         return retval;
     }
 }
 public void ICanSerializeAndDeserialzeCreationResults()
 {
     JobCreationResults expected = new JobCreationResults() { HttpStatusCode = HttpStatusCode.Accepted, JobId = "job123" };
     JobPayloadServerConverter ser = new JobPayloadServerConverter();
     JobPayloadConverter deser = new JobPayloadConverter();
     var payload = ser.SerializeJobCreationResults(expected);
     var actual = deser.DeserializeJobCreationResults(payload);
 }
 public void TheValueOfTheSerializedOutputShouldBeEquivalentWithTheOrignal()
 {
     var clientConverter = new JobPayloadConverter();
     var serverConverter = new JobPayloadServerConverter();
     JobList asList = this.transferObject.As<JobList>();
     if (asList.IsNotNull())
     {
         JobList actual = clientConverter.DeserializeJobList(this.serializedForm);
         Assert.AreEqual(asList.ErrorCode, actual.ErrorCode);
         Assert.AreEqual(asList.HttpStatusCode, actual.HttpStatusCode);
         Assert.IsTrue(asList.Jobs.Select(j => j.JobId).SequenceEqual(actual.Jobs.Select(j => j.JobId)));
         return;
     }
     var asJob = this.transferObject.As<Hadoop.Client.JobDetails>();
     if (asJob.IsNotNull())
     {
         var actual = clientConverter.DeserializeJobDetails(this.serializedForm, asJob.JobId);
         Assert.AreEqual(asJob.ErrorCode, actual.ErrorCode);
         Assert.AreEqual(asJob.HttpStatusCode, actual.HttpStatusCode);
         Assert.AreEqual(asJob.ErrorOutputPath, actual.ErrorOutputPath);
         Assert.AreEqual(asJob.ExitCode, actual.ExitCode);
         Assert.AreEqual(asJob.JobId, actual.JobId);
         Assert.AreEqual(asJob.LogicalOutputPath, actual.LogicalOutputPath);
         Assert.AreEqual(asJob.Name, actual.Name);
         Assert.AreEqual(new Uri(asJob.PhysicalOutputPath), new Uri(actual.PhysicalOutputPath));
         Assert.AreEqual(asJob.Query, actual.Query);
         Assert.AreEqual(asJob.StatusCode, actual.StatusCode);
         Assert.AreEqual(asJob.SubmissionTime, actual.SubmissionTime);
         Assert.AreEqual(asJob.Callback, actual.Callback);
         return;
     }
     var asMapReduce = this.transferObject.As<MapReduceJobCreateParameters>();
     if (asMapReduce.IsNotNull())
     {
         MapReduceJobCreateParameters actual = serverConverter.DeserializeMapReduceJobCreationDetails(this.serializedForm);
         Assert.AreEqual(asMapReduce.ClassName, actual.ClassName);
         Assert.IsTrue(asMapReduce.Arguments.SequenceEqual(actual.Arguments));
         Assert.AreEqual(asMapReduce.JarFile, actual.JarFile);
         Assert.AreEqual(asMapReduce.JobName, actual.JobName);
         Assert.AreEqual(asMapReduce.StatusFolder, actual.StatusFolder);
         Assert.IsTrue(asMapReduce.Defines.SequenceEqual(actual.Defines));
         Assert.IsTrue(asMapReduce.Files.SequenceEqual(actual.Files));
         return;
     }
     var asHive = this.transferObject.As<HiveJobCreateParameters>();
     if (asHive.IsNotNull())
     {
         HiveJobCreateParameters actual = serverConverter.DeserializeHiveJobCreationDetails(this.serializedForm);
         Assert.AreEqual(asHive.JobName, actual.JobName);
         Assert.AreEqual(asHive.StatusFolder, actual.StatusFolder);
         Assert.IsTrue(asHive.Defines.SequenceEqual(actual.Defines));
         Assert.AreEqual(asHive.Query, actual.Query);
         Assert.IsTrue(asHive.Files.SequenceEqual(actual.Files));
         return;
     }
     Assert.Fail("Unable to recognize the object type.");
 }
 public void WhenISerializeTheListOfJobIds()
 {
     var serverConverter = new JobPayloadServerConverter();
     var clientConverter = new JobPayloadConverter();
     var asList = this.transferObject.As<JobList>();
     if (asList.IsNotNull())
     {
         this.serializedForm = serverConverter.SerializeJobList(asList);
         return;
     }
     var asDetail = this.transferObject.As<Hadoop.Client.JobDetails>();
     if (asDetail.IsNotNull())
     {
         this.serializedForm = serverConverter.SerializeJobDetails(asDetail);
         return;
     }
     var asRequest = this.transferObject.As<JobCreateParameters>();
     if (asRequest.IsNotNull())
     {
         this.serializedForm = clientConverter.SerializeJobCreationDetails(asRequest);
         return;
     }
     Assert.Fail("Unable to recognize the object type.");
 }