|
@@ -77,6 +77,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
|
|
|
+import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
|
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
|
import org.apache.hadoop.yarn.api.records.Container;
|
|
import org.apache.hadoop.yarn.api.records.Container;
|
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
|
@@ -258,6 +259,28 @@ public class TestClientRMService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void testGetApplicationResourceUsageReportDummy() throws YarnException,
|
|
|
|
+ IOException {
|
|
|
|
+ ApplicationAttemptId attemptId = getApplicationAttemptId(1);
|
|
|
|
+ YarnScheduler yarnScheduler = mockYarnScheduler();
|
|
|
|
+ RMContext rmContext = mock(RMContext.class);
|
|
|
|
+ mockRMContext(yarnScheduler, rmContext);
|
|
|
|
+ when(rmContext.getDispatcher().getEventHandler()).thenReturn(
|
|
|
|
+ new EventHandler<Event>() {
|
|
|
|
+ public void handle(Event event) {
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ ApplicationSubmissionContext asContext =
|
|
|
|
+ mock(ApplicationSubmissionContext.class);
|
|
|
|
+ YarnConfiguration config = new YarnConfiguration();
|
|
|
|
+ RMAppAttemptImpl rmAppAttemptImpl = new RMAppAttemptImpl(attemptId,
|
|
|
|
+ rmContext, yarnScheduler, null, asContext, config, false);
|
|
|
|
+ ApplicationResourceUsageReport report = rmAppAttemptImpl
|
|
|
|
+ .getApplicationResourceUsageReport();
|
|
|
|
+ assertEquals(report, RMServerUtils.DUMMY_APPLICATION_RESOURCE_USAGE_REPORT);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void testGetApplicationAttempts() throws YarnException, IOException {
|
|
public void testGetApplicationAttempts() throws YarnException, IOException {
|
|
ClientRMService rmService = createRMService();
|
|
ClientRMService rmService = createRMService();
|
|
@@ -964,6 +987,8 @@ public class TestClientRMService {
|
|
Arrays.asList(getApplicationAttemptId(101), getApplicationAttemptId(102)));
|
|
Arrays.asList(getApplicationAttemptId(101), getApplicationAttemptId(102)));
|
|
when(yarnScheduler.getAppsInQueue(QUEUE_2)).thenReturn(
|
|
when(yarnScheduler.getAppsInQueue(QUEUE_2)).thenReturn(
|
|
Arrays.asList(getApplicationAttemptId(103)));
|
|
Arrays.asList(getApplicationAttemptId(103)));
|
|
|
|
+ ApplicationAttemptId attemptId = getApplicationAttemptId(1);
|
|
|
|
+ when(yarnScheduler.getAppResourceUsageReport(attemptId)).thenReturn(null);
|
|
return yarnScheduler;
|
|
return yarnScheduler;
|
|
}
|
|
}
|
|
}
|
|
}
|