public AppInfo(App app, AppContext context) { this.appId = context.getApplicationID().toString(); this.name = context.getApplicationName().toString(); this.user = context.getUser().toString(); this.startedOn = context.getStartTime(); this.elapsedTime = Times.elapsed(this.startedOn, 0); }
public AppInfo(App app, AppContext context) { this.appId = context.getApplicationID().toString(); this.name = context.getApplicationName().toString(); this.user = context.getUser().toString(); this.startedOn = context.getStartTime(); this.elapsedTime = Times.elapsed(this.startedOn, 0); }
public AppInfo(App app, AppContext context) { this.appId = context.getApplicationID().toString(); this.name = context.getApplicationName().toString(); this.user = context.getUser().toString(); this.startedOn = context.getStartTime(); this.elapsedTime = Times.elapsed(this.startedOn, 0); }
@Before public void setUp() throws IOException { AppContext context = mock(AppContext.class); when(context.getApplicationID()).thenReturn( ApplicationId.newInstance(0, 0)); when(context.getApplicationName()).thenReturn("AppName"); when(context.getUser()).thenReturn("User"); when(context.getStartTime()).thenReturn(System.currentTimeMillis()); job = mock(Job.class); Task task = mock(Task.class); when(job.getTask(any(TaskId.class))).thenReturn(task); when(job.loadConfFile()).thenReturn(new Configuration()); when(job.getConfFile()).thenReturn(new Path("/")); JobId jobID = MRApps.toJobID("job_01_01"); when(context.getJob(jobID)).thenReturn(job); when(job.checkAccess(any(UserGroupInformation.class), any(JobACL.class))) .thenReturn(true); App app = new App(context); Configuration configuration = new Configuration(); ctx = mock(RequestContext.class); appController = new AppControllerForTest(app, configuration, ctx); appController.getProperty().put(AMParams.JOB_ID, "job_01_01"); appController.getProperty().put(AMParams.TASK_ID, taskId); }
public void verifyAMInfoGeneric(AppContext ctx, String id, String user, String name, long startedOn, long elapsedTime) { WebServicesTestUtils.checkStringMatch("id", ctx.getApplicationID() .toString(), id); WebServicesTestUtils.checkStringMatch("user", ctx.getUser().toString(), user); WebServicesTestUtils.checkStringMatch("name", ctx.getApplicationName(), name); assertEquals("startedOn incorrect", ctx.getStartTime(), startedOn); assertTrue("elapsedTime not greater then 0", (elapsedTime > 0)); }