Examples of AppForTest


Examples of org.apache.hadoop.mapreduce.v2.app.webapp.AppForTest

    Map<TaskId, Task> tasks = new HashMap<TaskId, Task>();
    tasks.put(task.getID(), task);

    AppContext ctx = mock(AppContext.class);
    AppForTest app = new AppForTest(ctx);
    Job job = mock(Job.class);
    when(job.getTasks()).thenReturn(tasks);

    app.setJob(job);

    HsTasksBlockForTest block = new HsTasksBlockForTest(app);

    block.addParameter(AMParams.TASK_TYPE, "r");
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.webapp.AppForTest

   * test AttemptsBlock's rendering.
   */
  @Test
  public void testAttemptsBlock() {
    AppContext ctx = mock(AppContext.class);
    AppForTest app = new AppForTest(ctx);

    Task task = getTask();
    Map<TaskAttemptId, TaskAttempt> attempts = new HashMap<TaskAttemptId, TaskAttempt>();
    TaskAttempt attempt = mock(TaskAttempt.class);
    TaskAttemptId taId = new TaskAttemptIdPBImpl();
    taId.setId(0);
    taId.setTaskId(task.getID());
    when(attempt.getID()).thenReturn(taId);
    when(attempt.getNodeHttpAddress()).thenReturn("Node address");

    ContainerId containerId = new ContainerIdPBImpl();
    containerId.setId(1);
    ApplicationAttemptId appAId = new ApplicationAttemptIdPBImpl();
    appAId.setAttemptId(1);
    ApplicationId appId = new ApplicationIdPBImpl();
    appId.setClusterTimestamp(System.currentTimeMillis());
    appId.setId(5);
    appAId.setApplicationId(appId);
    containerId.setApplicationAttemptId(appAId);
    when(attempt.getAssignedContainerID()).thenReturn(containerId);

    when(attempt.getAssignedContainerMgrAddress()).thenReturn(
            "assignedContainerMgrAddress");
    when(attempt.getNodeRackName()).thenReturn("nodeRackName");
    when(attempt.getLaunchTime()).thenReturn(100002L);
    when(attempt.getFinishTime()).thenReturn(100012L);
    when(attempt.getShuffleFinishTime()).thenReturn(100010L);
    when(attempt.getSortFinishTime()).thenReturn(100011L);
    when(attempt.getState()).thenReturn(TaskAttemptState.SUCCEEDED);

    attempts.put(taId, attempt);
    when(task.getAttempts()).thenReturn(attempts);

    app.setTask(task);
    Job job = mock(Job.class);
    when(job.getUserName()).thenReturn("User");
    app.setJob(job);

    AttemptsBlockForTest block = new AttemptsBlockForTest(app);
    block.addParameter(AMParams.TASK_TYPE, "r");

    PrintWriter pWriter = new PrintWriter(data);
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.webapp.AppForTest

    ApplicationId appId = new ApplicationIdPBImpl();
    appId.setClusterTimestamp(System.currentTimeMillis());
    appId.setId(5);
    when(ctx.getApplicationID()).thenReturn(appId);

    AppForTest app = new AppForTest(ctx);
    Configuration config = new Configuration();
    RequestContext requestCtx = mock(RequestContext.class);
    HsControllerForTest controller = new HsControllerForTest(app, config,
            requestCtx);
    controller.index();
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.webapp.AppForTest

    Map<TaskId, Task> tasks = new HashMap<TaskId, Task>();
    tasks.put(task.getID(), task);

    AppContext ctx = mock(AppContext.class);
    AppForTest app = new AppForTest(ctx);
    Job job = mock(Job.class);
    when(job.getTasks()).thenReturn(tasks);

    app.setJob(job);

    HsTasksBlockForTest block = new HsTasksBlockForTest(app);

    block.addParameter(AMParams.TASK_TYPE, "r");
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.webapp.AppForTest

   * test AttemptsBlock's rendering.
   */
  @Test
  public void testAttemptsBlock() {
    AppContext ctx = mock(AppContext.class);
    AppForTest app = new AppForTest(ctx);

    Task task = getTask(0);
    Map<TaskAttemptId, TaskAttempt> attempts = new HashMap<TaskAttemptId, TaskAttempt>();
    TaskAttempt attempt = mock(TaskAttempt.class);
    TaskAttemptId taId = new TaskAttemptIdPBImpl();
    taId.setId(0);
    taId.setTaskId(task.getID());
    when(attempt.getID()).thenReturn(taId);
    when(attempt.getNodeHttpAddress()).thenReturn("Node address");

    ApplicationId appId = ApplicationIdPBImpl.newInstance(0, 5);
    ApplicationAttemptId appAttemptId = ApplicationAttemptIdPBImpl.newInstance(appId, 1);

    ContainerId containerId = ContainerIdPBImpl.newInstance(appAttemptId, 1);
    when(attempt.getAssignedContainerID()).thenReturn(containerId);

    when(attempt.getAssignedContainerMgrAddress()).thenReturn(
            "assignedContainerMgrAddress");
    when(attempt.getNodeRackName()).thenReturn("nodeRackName");

    final long taStartTime = 100002L;
    final long taFinishTime = 100012L;
    final long taShuffleFinishTime = 100010L;
    final long taSortFinishTime = 100011L;
    final TaskAttemptState taState = TaskAttemptState.SUCCEEDED;

    when(attempt.getLaunchTime()).thenReturn(taStartTime);
    when(attempt.getFinishTime()).thenReturn(taFinishTime);
    when(attempt.getShuffleFinishTime()).thenReturn(taShuffleFinishTime);
    when(attempt.getSortFinishTime()).thenReturn(taSortFinishTime);
    when(attempt.getState()).thenReturn(taState);

    TaskAttemptReport taReport = mock(TaskAttemptReport.class);
    when(taReport.getStartTime()).thenReturn(taStartTime);
    when(taReport.getFinishTime()).thenReturn(taFinishTime);
    when(taReport.getShuffleFinishTime()).thenReturn(taShuffleFinishTime);
    when(taReport.getSortFinishTime()).thenReturn(taSortFinishTime);
    when(taReport.getContainerId()).thenReturn(containerId);
    when(taReport.getProgress()).thenReturn(1.0f);
    when(taReport.getStateString()).thenReturn("Processed 128/128 records");
    when(taReport.getTaskAttemptState()).thenReturn(taState);
    when(taReport.getDiagnosticInfo()).thenReturn("");

    when(attempt.getReport()).thenReturn(taReport);

    attempts.put(taId, attempt);
    when(task.getAttempts()).thenReturn(attempts);

    app.setTask(task);
    Job job = mock(Job.class);
    when(job.getUserName()).thenReturn("User");
    app.setJob(job);

    AttemptsBlockForTest block = new AttemptsBlockForTest(app);
    block.addParameter(AMParams.TASK_TYPE, "r");

    PrintWriter pWriter = new PrintWriter(data);
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.app.webapp.AppForTest

    AppContext ctx = mock(AppContext.class);
    ApplicationId appId = ApplicationIdPBImpl.newInstance(0,5);
   
    when(ctx.getApplicationID()).thenReturn(appId);

    AppForTest app = new AppForTest(ctx);
    Configuration config = new Configuration();
    RequestContext requestCtx = mock(RequestContext.class);
    HsControllerForTest controller = new HsControllerForTest(app, config,
            requestCtx);
    controller.index();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.