slfan1989 commented on code in PR #4892:
URL: https://github.com/apache/hadoop/pull/4892#discussion_r977763916


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestableFederationInterceptorREST.java:
##########
@@ -51,4 +70,48 @@ protected void registerBadSubCluster(SubClusterId badSC) {
     interceptor.setRunning(false);
   }
 
+  protected void setupResourceManager() throws IOException {
+    try {
+      if (mockRM != null) {
+        return;
+      }
+
+      DefaultMetricsSystem.setMiniClusterMode(true);
+      CapacitySchedulerConfiguration conf = new 
CapacitySchedulerConfiguration();
+
+      // Define default queue
+      conf.setCapacity(QUEUE_DEFAULT_FULL, 20);
+      // Define dedicated queues
+      String[] queues = new String[]{QUEUE_DEFAULT, QUEUE_DEDICATED};
+      conf.setQueues(CapacitySchedulerConfiguration.ROOT, queues);
+      conf.setCapacity(QUEUE_DEDICATED_FULL, 80);
+      conf.setReservable(QUEUE_DEDICATED_FULL, true);
+
+      conf.setClass(YarnConfiguration.RM_SCHEDULER,
+          CapacityScheduler.class, ResourceScheduler.class);
+      conf.setBoolean(YarnConfiguration.RM_RESERVATION_SYSTEM_ENABLE, true);
+      conf.setBoolean(YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, 
false);
+
+      mockRM = new MockRM(conf);
+      mockRM.start();
+      mockRM.registerNode("127.0.0.1:5678", 100*1024, 100);
+
+      Map<SubClusterId, DefaultRequestInterceptorREST> interceptors = 
super.getInterceptors();
+      for (DefaultRequestInterceptorREST item : interceptors.values()) {
+        MockDefaultRequestInterceptorREST interceptor = 
(MockDefaultRequestInterceptorREST) item;
+        interceptor.setMockRM(mockRM);
+      }
+    } catch (Exception e) {
+      LOG.error("setupResourceManager failed.", e);
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public void shutdown() {
+    if (mockRM != null) {
+      mockRM.stop();

Review Comment:
   I will fix it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to