// Path: src/main/java/org/apache/hadoop/mapred/HFSPScheduler.java
// enum QueueType {
//   TRAIN, SIZE_BASED
// };


import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
import org.apache.hadoop.mapred.HFSPScheduler.QueueType;
import org.apache.hadoop.mapred.UtilsForTests.FakeClock;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Test;
    assertTrue(this.scheduler.getJobs(null).iterator().next()
        .equals(submittedJIP));

    List<Task> tasks = this.scheduler.assignTasks(tracker("tt1"));
    assertTrue(tasks.size() == 2);
  }

  /**
   * Complete 1 task of 2 and check that the job is marked as ready and removed
   * from training
   */
  @Test
  public void testTrainToSizeBased() throws IOException {
    this.advanceTime(1000);

    JobInProgress jip = this.submitJob(JobStatus.RUNNING, 2, 2);

    assertTrue(!this.scheduler.isJobReadyForSizeBased(jip, TaskType.MAP));
    assertTrue(this.scheduler.getJob(jip.getJobID(), QueueType.TRAIN,
        TaskType.MAP).equals(jip));
    assertTrue(this.scheduler.getJob(jip.getJobID(), QueueType.SIZE_BASED,
        TaskType.MAP).equals(jip));

    List<Task> tasks = this.scheduler.assignTasks(tracker("tt1"));
    this.taskTrackerManager.finishTask("tt1", tasks.get(0).getTaskID(), 1000,
        2000);

    this.scheduler.update();

    assertTrue(this.scheduler.isJobReadyForSizeBased(jip, TaskType.MAP));
// Path: src/main/java/org/apache/hadoop/mapred/HFSPScheduler.java
// enum QueueType {
//   TRAIN, SIZE_BASED
// };


// Path: src/test/java/org/apache/hadoop/mapred/TestHFSP.java
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
import org.apache.hadoop.mapred.HFSPScheduler.QueueType;
import org.apache.hadoop.mapred.UtilsForTests.FakeClock;
import org.apache.hadoop.mapreduce.TaskType;
import org.apache.hadoop.mapreduce.server.jobtracker.TaskTracker;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Test;

    assertTrue(this.scheduler.getJobs(null).iterator().next()
        .equals(submittedJIP));

    List<Task> tasks = this.scheduler.assignTasks(tracker("tt1"));
    assertTrue(tasks.size() == 2);
  }

  /**
   * Complete 1 task of 2 and check that the job is marked as ready and removed
   * from training
   */
  @Test
  public void testTrainToSizeBased() throws IOException {
    this.advanceTime(1000);

    JobInProgress jip = this.submitJob(JobStatus.RUNNING, 2, 2);

    assertTrue(!this.scheduler.isJobReadyForSizeBased(jip, TaskType.MAP));
    assertTrue(this.scheduler.getJob(jip.getJobID(), QueueType.TRAIN,
        TaskType.MAP).equals(jip));
    assertTrue(this.scheduler.getJob(jip.getJobID(), QueueType.SIZE_BASED,
        TaskType.MAP).equals(jip));

    List<Task> tasks = this.scheduler.assignTasks(tracker("tt1"));
    this.taskTrackerManager.finishTask("tt1", tasks.get(0).getTaskID(), 1000,
        2000);

    this.scheduler.update();

    assertTrue(this.scheduler.isJobReadyForSizeBased(jip, TaskType.MAP));
    assertTrue(this.scheduler.getJob(jip.getJobID(), QueueType.TRAIN,