QueuePlacementPolicy { private static PlacementRule getParentRule(Element parent, FairScheduler fs) throws AllocationConfigurationException { LOG.debug("Creating new parent rule: {}", parent.getAttribute("name")); PlacementRule parentRule = createRule(parent); try { parentRule.initialize(fs); } catch (IOException ioe) { throw new AllocationConfigurationException( "Parent Rule initialisation failed with exception", ioe); } return parentRule; } private  QueuePlacementPolicy();   }
@Test public void testMultipleParentRules() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("<queuePlacementPolicy>"); sb.append(" <rule name='nestedUserQueue'>"); sb.append(" <rule name='primaryGroup'/>"); sb.append(" <rule name='default'/>"); sb.append(" </rule>"); sb.append("</queuePlacementPolicy>"); createPolicy(sb.toString()); PlacementRule nested = placementManager.getPlacementRules().get(0); if (nested instanceof UserPlacementRule) { PlacementRule parent = ((FSPlacementRule)nested).getParentRule(); assertTrue("Nested rule should have been Default rule", parent instanceof DefaultPlacementRule); } else { fail("Policy parsing failed: rule with multiple parents not set"); } }