@Before public void setUp() throws Exception { conf = createConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); // Setup rmContext = TestUtils.getMockRMContext(); spyRMContext = spy(rmContext); fs = ReservationSystemTestUtil.setupFairScheduler(spyRMContext, conf, 125); scheduler = fs; ConcurrentMap<ApplicationId, RMApp> spyApps = spy(new ConcurrentHashMap<ApplicationId, RMApp>()); RMApp rmApp = mock(RMApp.class); when(rmApp.getRMAppAttempt((ApplicationAttemptId) Matchers.any())) .thenReturn(null); Mockito.doReturn(rmApp).when(spyApps).get((ApplicationId) Matchers.any()); when(spyRMContext.getRMApps()).thenReturn(spyApps); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); setupPlanFollower(); }
private FairScheduler initializeFairScheduler() throws IOException { Configuration conf = createFSConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); // Setup mockRMContext = ReservationSystemTestUtil.createRMContext(conf); return ReservationSystemTestUtil .setupFairScheduler(mockRMContext, conf, 10); } }
@Before public void setUp() throws Exception { conf = createConfiguration(); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); // Setup rmContext = TestUtils.getMockRMContext(); spyRMContext = spy(rmContext); fs = ReservationSystemTestUtil.setupFairScheduler(testUtil, spyRMContext, conf, 125); scheduler = fs; ConcurrentMap<ApplicationId, RMApp> spyApps = spy(new ConcurrentHashMap<ApplicationId, RMApp>()); RMApp rmApp = mock(RMApp.class); when(rmApp.getRMAppAttempt((ApplicationAttemptId) Matchers.any())) .thenReturn(null); Mockito.doReturn(rmApp).when(spyApps).get((ApplicationId) Matchers.any()); when(spyRMContext.getRMApps()).thenReturn(spyApps); ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); setupPlanFollower(); }
@Test public void testFairReservationSystemInitialize() throws IOException { ReservationSystemTestUtil.setupFSAllocationFile(ALLOC_FILE); ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil(); // Setup 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()); }
scheduler = ReservationSystemTestUtil.setupFairScheduler(testUtil, mockRMContext, conf, 10);