FairReservationSystem extends AbstractReservationSystem { @Override public void reinitialize(Configuration conf, RMContext rmContext) throws YarnException { ResourceScheduler scheduler = rmContext.getScheduler(); if (!(scheduler instanceof FairScheduler)) { throw new YarnRuntimeException("Class " + scheduler.getClass().getCanonicalName() + " not instance of " + FairScheduler.class.getCanonicalName()); } fairScheduler = (FairScheduler) scheduler; this.conf = conf; super.reinitialize(conf, rmContext); } FairReservationSystem(); @Override void reinitialize(Configuration conf, RMContext rmContext);  }
@Test public void testFairReservationSystemInitialize() throws IOException { ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); RMContext mockRMContext = testUtil.createRMContext(conf); scheduler = ReservationSystemTestUtil.setupFairScheduler(testUtil, mockRMContext, conf, 10); FairReservationSystem reservationSystem = new FairReservationSystem(); reservationSystem.setRMContext(mockRMContext); try { reservationSystem.reinitialize(scheduler.getConf(), mockRMContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } ReservationSystemTestUtil.validateReservationQueue(reservationSystem, testUtil.getFullReservationQueueName()); }
@Test public void testFairReservationSystemReinitialize() throws IOException { ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); RMContext mockRMContext = testUtil.createRMContext(conf); scheduler = ReservationSystemTestUtil.setupFairScheduler(testUtil, mockRMContext, conf, 10); FairReservationSystem reservationSystem = new FairReservationSystem(); reservationSystem.setRMContext(mockRMContext); try { reservationSystem.reinitialize(scheduler.getConf(), mockRMContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } final String planQNam = testUtil.getFullReservationQueueName(); ReservationSystemTestUtil.validateReservationQueue(reservationSystem, planQNam); ReservationSystemTestUtil.updateFSAllocationFile(ALLOC_FILE); scheduler.reinitialize(conf, mockRMContext); try { reservationSystem.reinitialize(conf, mockRMContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } String newQueue = "root.reservation"; ReservationSystemTestUtil.validateNewReservationQueue (reservationSystem, newQueue); }