Exemple #1
0
 public virtual void TestEnums()
 {
     foreach (YarnApplicationState applicationState in YarnApplicationState.Values())
     {
         TypeConverter.FromYarn(applicationState, FinalApplicationStatus.Failed);
     }
     // ad hoc test of NEW_SAVING, which is newly added
     NUnit.Framework.Assert.AreEqual(JobStatus.State.Prep, TypeConverter.FromYarn(YarnApplicationState
                                                                                  .NewSaving, FinalApplicationStatus.Failed));
     foreach (TaskType taskType in TaskType.Values())
     {
         TypeConverter.FromYarn(taskType);
     }
     foreach (JobState jobState in JobState.Values())
     {
         TypeConverter.FromYarn(jobState);
     }
     foreach (QueueState queueState in QueueState.Values())
     {
         TypeConverter.FromYarn(queueState);
     }
     foreach (TaskState taskState in TaskState.Values())
     {
         TypeConverter.FromYarn(taskState);
     }
 }
Exemple #2
0
        public virtual void TestJobsQueryStateNone()
        {
            WebResource      r         = Resource();
            AList <JobState> JobStates = new AList <JobState>(Arrays.AsList(JobState.Values()));
            // find a state that isn't in use
            IDictionary <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job> jobsMap = appContext
                                                                                      .GetAllJobs();

            foreach (KeyValuePair <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job> entry in
                     jobsMap)
            {
                JobStates.Remove(entry.Value.GetState());
            }
            NUnit.Framework.Assert.IsTrue("No unused job states", JobStates.Count > 0);
            JobState       notInUse = JobStates[0];
            ClientResponse response = r.Path("ws").Path("v1").Path("history").Path("mapreduce"
                                                                                   ).Path("jobs").QueryParam("state", notInUse.ToString()).Accept(MediaType.ApplicationJson
                                                                                                                                                  ).Get <ClientResponse>();

            NUnit.Framework.Assert.AreEqual(MediaType.ApplicationJsonType, response.GetType()
                                            );
            JSONObject json = response.GetEntity <JSONObject>();

            NUnit.Framework.Assert.AreEqual("incorrect number of elements", 1, json.Length());
            NUnit.Framework.Assert.AreEqual("jobs is not null", JSONObject.Null, json.Get("jobs"
                                                                                          ));
        }
Exemple #3
0
 public virtual void CheckJobStateTypeConversion()
 {
     //verify that all states can be converted without
     // throwing an exception
     foreach (JobState state in JobState.Values())
     {
         TypeConverter.FromYarn(state);
     }
 }