(rmApp.getApplicationType() == null)? "" : rmApp.getApplicationType(), 100.0 * rmApp.getProgress(), (mclock.getTime() - rmApp.getStartTime()) / 1000));
public static ClientRMService mockClientRMService(RMContext rmContext) { ClientRMService clientRMService = mock(ClientRMService.class); List<ApplicationReport> appReports = new ArrayList<ApplicationReport>(); for (RMApp app : rmContext.getRMApps().values()) { ApplicationReport appReport = ApplicationReport.newInstance( app.getApplicationId(), (ApplicationAttemptId) null, app.getUser(), app.getQueue(), app.getName(), (String) null, 0, (Token) null, app.createApplicationState(), app.getDiagnostics().toString(), (String) null, app.getStartTime(), app.getLaunchTime(), app.getFinishTime(), app.getFinalApplicationStatus(), (ApplicationResourceUsageReport) null, app.getTrackingUrl(), app.getProgress(), app.getApplicationType(), (Token) null); appReports.add(appReport); } GetApplicationsResponse response = mock(GetApplicationsResponse.class); when(response.getApplicationList()).thenReturn(appReports); try { when(clientRMService.getApplications(any(GetApplicationsRequest.class))) .thenReturn(response); } catch (YarnException e) { Assert.fail("Exception is not expected."); } return clientRMService; }
public static ClientRMService mockClientRMService(RMContext rmContext) { ClientRMService clientRMService = mock(ClientRMService.class); List<ApplicationReport> appReports = new ArrayList<ApplicationReport>(); for (RMApp app : rmContext.getRMApps().values()) { ApplicationReport appReport = ApplicationReport.newInstance( app.getApplicationId(), (ApplicationAttemptId) null, app.getUser(), app.getQueue(), app.getName(), (String) null, 0, (Token) null, app.createApplicationState(), app.getDiagnostics().toString(), (String) null, app.getStartTime(), app.getFinishTime(), app.getFinalApplicationStatus(), (ApplicationResourceUsageReport) null, app.getTrackingUrl(), app.getProgress(), app.getApplicationType(), (Token) null); appReports.add(appReport); } GetApplicationsResponse response = mock(GetApplicationsResponse.class); when(response.getApplicationList()).thenReturn(appReports); try { when(clientRMService.getApplications(any(GetApplicationsRequest.class))) .thenReturn(response); } catch (YarnException e) { Assert.fail("Exception is not expteced."); } return clientRMService; }
this.name = app.getName().toString(); this.queue = app.getQueue().toString(); this.progress = app.getProgress() * 100; this.diagnostics = app.getDiagnostics().toString(); if (diagnostics == null || diagnostics.isEmpty()) {
this.name = app.getName().toString(); this.queue = app.getQueue().toString(); this.progress = app.getProgress() * 100; this.diagnostics = app.getDiagnostics().toString(); if (diagnostics == null || diagnostics.isEmpty()) {
}; Assert.assertEquals(0.0, rmApp.getProgress(), 0.0); Assert.assertEquals(0.05f, rmApp.getProgress(), 0.001f); rm.drainEvents(); Assert.assertEquals(0.14f, job.getProgress(), 0.001f); Assert.assertEquals(0.14f, rmApp.getProgress(), 0.001f); rm.drainEvents(); Assert.assertEquals(0.59f, job.getProgress(), 0.001f); Assert.assertEquals(0.59f, rmApp.getProgress(), 0.001f); rm.drainEvents(); Assert.assertEquals(0.95f, job.getProgress(), 0.001f); Assert.assertEquals(0.95f, rmApp.getProgress(), 0.001f);
this.priority = app.getApplicationPriority().getPriority(); this.progress = app.getProgress() * 100; this.diagnostics = app.getDiagnostics().toString(); if (diagnostics == null || diagnostics.isEmpty()) {
}; Assert.assertEquals(0.0, rmApp.getProgress(), 0.0); Assert.assertEquals(0.05f, rmApp.getProgress(), 0.001f); rm.drainEvents(); Assert.assertEquals(0.095f, job.getProgress(), 0.001f); Assert.assertEquals(0.095f, rmApp.getProgress(), 0.001f); rm.drainEvents(); Assert.assertEquals(0.41f, job.getProgress(), 0.001f); Assert.assertEquals(0.41f, rmApp.getProgress(), 0.001f); rm.drainEvents(); Assert.assertEquals(0.59f, job.getProgress(), 0.001f); Assert.assertEquals(0.59f, rmApp.getProgress(), 0.001f); Assert.assertEquals(0.95f, rmApp.getProgress(), 0.001f);
private static void testAppStartState(ApplicationId applicationId, String user, String name, String queue, RMApp application) { Assert.assertTrue("application start time is not greater than 0", application.getStartTime() > 0); Assert.assertTrue("application start time is before currentTime", application.getStartTime() <= System.currentTimeMillis()); Assert.assertEquals("application user is not correct", user, application.getUser()); Assert.assertEquals("application id is not correct", applicationId, application.getApplicationId()); Assert.assertEquals("application progress is not correct", (float)0.0, application.getProgress(), (float)0.0); Assert.assertEquals("application queue is not correct", queue, application.getQueue()); Assert.assertEquals("application name is not correct", name, application.getName()); Assert.assertEquals("application finish time is not 0 and should be", 0, application.getFinishTime()); Assert.assertEquals("application tracking url is not correct", null, application.getTrackingUrl()); StringBuilder diag = application.getDiagnostics(); Assert.assertEquals("application diagnostics is not correct", 0, diag.length()); }
private static void testAppStartState(ApplicationId applicationId, String user, String name, String queue, RMApp application) { Assert.assertTrue("application start time is not greater than 0", application.getStartTime() > 0); Assert.assertTrue("application start time is before currentTime", application.getStartTime() <= System.currentTimeMillis()); Assert.assertEquals("application user is not correct", user, application.getUser()); Assert.assertEquals("application id is not correct", applicationId, application.getApplicationId()); Assert.assertEquals("application progress is not correct", (float)0.0, application.getProgress(), (float)0.0); Assert.assertEquals("application queue is not correct", queue, application.getQueue()); Assert.assertEquals("application name is not correct", name, application.getName()); Assert.assertEquals("application finish time is not 0 and should be", 0, application.getFinishTime()); Assert.assertEquals("application tracking url is not correct", null, application.getTrackingUrl()); StringBuilder diag = application.getDiagnostics(); Assert.assertEquals("application diagnostics is not correct", 0, diag.length()); }