PlacementManager { @VisibleForTesting public List<PlacementRule> getPlacementRules() { return rules; } PlacementManager(); void updateRules(List<PlacementRule> rules); ApplicationPlacementContext placeApplication(
      ApplicationSubmissionContext asc, String user); @VisibleForTesting List<PlacementRule> getPlacementRules();  }
@Test public void testPlacementRuleUpdationOrder() throws Exception { List<QueueMapping> queueMappings = new ArrayList<>(); QueueMapping userQueueMapping = QueueMappingBuilder.create() .type(MappingType.USER).source(USER1) .queue(getQueueMapping(PARENT_QUEUE, USER1)).build(); UserGroupMappingPlacementRule ugRule = new UserGroupMappingPlacementRule( false, Arrays.asList(userQueueMapping), null); conf.set(YarnConfiguration.QUEUE_PLACEMENT_RULES, ugRule.getName()); queueMappings.add(userQueueMapping); conf.setQueueMappings(queueMappings); mockRM = new MockRM(conf); CapacityScheduler cs = (CapacityScheduler) mockRM.getResourceScheduler(); mockRM.start(); PlacementManager pm = cs.getRMContext().getQueuePlacementManager(); Assert.assertEquals(1, pm.getPlacementRules().size()); Assert.assertEquals(ugRule.getName(), pm.getPlacementRules().get(0).getName()); }