CapacityReservationSystem extends AbstractReservationSystem { @Override public void reinitialize(Configuration conf, RMContext rmContext) throws YarnException { ResourceScheduler scheduler = rmContext.getScheduler(); if (!(scheduler instanceof CapacityScheduler)) { throw new YarnRuntimeException("Class " + scheduler.getClass().getCanonicalName() + " not instance of " + CapacityScheduler.class.getCanonicalName()); } capScheduler = (CapacityScheduler) scheduler; this.conf = conf; super.reinitialize(conf, rmContext); } CapacityReservationSystem(); @Override void reinitialize(Configuration conf, RMContext rmContext);  }
@Test public void testInitialize() { ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); CapacityScheduler capScheduler = null; try { capScheduler = testUtil.mockCapacityScheduler(10); } catch (IOException e) { Assert.fail(e.getMessage()); } CapacityReservationSystem reservationSystem = new CapacityReservationSystem(); reservationSystem.setRMContext(capScheduler.getRMContext()); try { reservationSystem.reinitialize(capScheduler.getConf(), capScheduler.getRMContext()); } catch (YarnException e) { Assert.fail(e.getMessage()); } String planQName = testUtil.getreservationQueueName(); ReservationSystemTestUtil.validateReservationQueue(reservationSystem, planQName); }
@Test public void testReinitialize() { ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); CapacityScheduler capScheduler = null; try { capScheduler = testUtil.mockCapacityScheduler(10); } catch (IOException e) { Assert.fail(e.getMessage()); } CapacityReservationSystem reservationSystem = new CapacityReservationSystem(); CapacitySchedulerConfiguration conf = capScheduler.getConfiguration(); RMContext mockContext = capScheduler.getRMContext(); reservationSystem.setRMContext(mockContext); try { reservationSystem.reinitialize(capScheduler.getConfiguration(), mockContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } String planQName = testUtil.getreservationQueueName(); ReservationSystemTestUtil.validateReservationQueue(reservationSystem, planQName); String newQ = "reservation"; Assert.assertNull(reservationSystem.getPlan(newQ)); testUtil.updateQueueConfiguration(conf, newQ); try { capScheduler.reinitialize(conf, mockContext); } catch (IOException e) { Assert.fail(e.getMessage()); } try { reservationSystem.reinitialize(conf, mockContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } ReservationSystemTestUtil.validateNewReservationQueue(reservationSystem, newQ); }