when(app.getTrackingUrl()).thenReturn("http://host:123"); when(app.getState()).thenReturn(RMAppState.FAILED); when(app.getApplicationId()).thenReturn(APP_ID);
when(app.getTrackingUrl()).thenReturn("http://host:123"); when(app.getState()).thenReturn(RMAppState.FAILED); when(app.getApplicationId()).thenReturn(APP_ID);
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; }
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; }
this.schemePrefix = schemePrefix; if (app != null) { String trackingUrl = app.getTrackingUrl(); this.state = app.createApplicationState(); this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty()
this.schemePrefix = schemePrefix; if (app != null) { String trackingUrl = app.getTrackingUrl(); this.state = app.createApplicationState(); this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty()
this.schemePrefix = schemePrefix; if (app != null) { String trackingUrl = app.getTrackingUrl(); this.state = app.createApplicationState(); this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty()
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()); }