public static PlacementRule getPlacementRule(String ruleStr,
      Configuration conf)
      throws ClassNotFoundException {
    Class<? extends PlacementRule> ruleClass = Class.forName(ruleStr)
        .asSubclass(PlacementRule.class);
    LOG.info("Using PlacementRule implementation - " + ruleClass);
    return ReflectionUtils.newInstance(ruleClass, conf);
  }
@Test
  public void testGetRuleClass() {
    PlacementRule rule = PlacementFactory.getPlacementRule(
        DefaultPlacementRule.class, null);
    assertNotNull("Rule object is null", rule);
    // Should take anything as the second object: ignores unknown types in the
    // default implementation.
    rule = PlacementFactory.getPlacementRule(
        DefaultPlacementRule.class, "");
    assertNotNull("Rule object is null", rule);
  }