Ejemplo n.º 1
0
        public void ICanDeserializeJobListWithListJobsPayloadWithMultipleItemsOneValidOnePartial()
        {
            var converter = new PayloadConverter();
            var jobList   = converter.DeserializeListJobResult(ListJobsPayloadWithMultipleItemsOneValidOnePartial);

            Assert.IsNotNull(jobList);
            Assert.IsNotNull(jobList.Jobs);
            var jobs = jobList.Jobs.ToList();

            Assert.AreEqual(2, jobs.Count);

            var firstJob = jobs[0];

            Assert.AreEqual("job_002", firstJob.JobId);
            Assert.AreEqual(0, firstJob.ExitCode);
            Assert.AreEqual(unixEpoch.AddMilliseconds(1375484358898).ToLocalTime(), firstJob.SubmissionTime);
            Assert.AreEqual("TestJob1", firstJob.Name);
            Assert.AreEqual(JobStatusCode.Completed, firstJob.StatusCode);
            Assert.AreEqual("/some/place", firstJob.StatusDirectory);
            Assert.AreEqual("some query", firstJob.Query);

            var secondJob = jobs[1];

            Assert.AreEqual("job_004", secondJob.JobId);
            Assert.AreEqual(0, secondJob.ExitCode);
            Assert.AreEqual(unixEpoch.AddMilliseconds(1475484358898).ToLocalTime(), secondJob.SubmissionTime);
            Assert.AreEqual("TestJob2", secondJob.Name);
            Assert.AreEqual(JobStatusCode.Unknown, secondJob.StatusCode);
            Assert.AreEqual(string.Empty, secondJob.StatusDirectory);
            Assert.AreEqual("some query", secondJob.Query);
        }
        /// <inheritdoc />
        public async Task <JobList> ListJobs()
        {
            //NEIN: Any code modification here should add unit tests for this class
            var converter = new PayloadConverter();
            var client    = ServiceLocator.Instance.Locate <IHadoopRemoteJobSubmissionRestClientFactory>().Create(this.credentials, this.context, this.ignoreSslErrors, this.GetUserAgentString());
            var result    = await client.ListJobs();

            return(converter.DeserializeListJobResult(result.Content));
        }
Ejemplo n.º 3
0
        public void ICanDeserializeJobListWithNoValidJobDetails()
        {
            var converter = new PayloadConverter();
            var jobList   = converter.DeserializeListJobResult(JobListWithNoValidJobDetails);

            Assert.IsNotNull(jobList);
            Assert.IsNotNull(jobList.Jobs);
            var jobs = jobList.Jobs.ToList();

            Assert.AreEqual(0, jobs.Count);
        }
Ejemplo n.º 4
0
        public void ICanDeserializeEmptyJobList()
        {
            var converter = new PayloadConverter();
            var jobList   = converter.DeserializeListJobResult(EmptyJsonArray);

            Assert.IsNotNull(jobList);
            Assert.IsNotNull(jobList.Jobs);
            var jobs = jobList.Jobs.ToList();

            Assert.AreEqual(0, jobs.Count);
        }
Ejemplo n.º 5
0
        public void ICanDeserializeJobListWithOneItemFromRawJson()
        {
            var converter = new PayloadConverter();
            var jobList   = converter.DeserializeListJobResult(RawAllFieldsListJobsPayloadWithOneItem);

            Assert.AreEqual(1, jobList.Jobs.Count);
            var jobDetails = jobList.Jobs.First();

            Assert.AreEqual("job_002", jobDetails.JobId);
            Assert.AreEqual(0, jobDetails.ExitCode);
            Assert.AreEqual(unixEpoch.AddMilliseconds(1375484358898).ToLocalTime(), jobDetails.SubmissionTime);
            Assert.AreEqual("TestJob1", jobDetails.Name);
            Assert.AreEqual(JobStatusCode.Completed, jobDetails.StatusCode);
            Assert.AreEqual("/some/place", jobDetails.StatusDirectory);
            Assert.AreEqual("some query", jobDetails.Query);
            Assert.AreEqual("map 100% reduce 100%", jobDetails.PercentComplete);
        }
Ejemplo n.º 6
0
        public void ICanDeserializeJobListWithListJobsPayloadWithOneValidAndOneEmptyObject()
        {
            var converter = new PayloadConverter();
            var jobList   = converter.DeserializeListJobResult(ValidAllFieldsListJobsPayloadWithOneValidAndOneEmptyObject);

            Assert.IsNotNull(jobList);
            Assert.IsNotNull(jobList.Jobs);
            var jobs = jobList.Jobs.ToList();

            Assert.AreEqual(1, jobs.Count);

            var firstJob = jobs[0];

            Assert.AreEqual("job_002", firstJob.JobId);
            Assert.AreEqual(0, firstJob.ExitCode);
            Assert.AreEqual(unixEpoch.AddMilliseconds(1375484358898).ToLocalTime(), firstJob.SubmissionTime);
            Assert.AreEqual("TestJob1", firstJob.Name);
            Assert.AreEqual(JobStatusCode.Completed, firstJob.StatusCode);
            Assert.AreEqual("/some/place", firstJob.StatusDirectory);
            Assert.AreEqual("some query", firstJob.Query);
        }