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 testGetExistRuleText() {
    final String exists = DefaultPlacementRule.class.getCanonicalName();
    PlacementRule rule = null;
    try {
      rule = PlacementFactory.getPlacementRule(exists, null);
    } catch (ClassNotFoundException cnfe) {
      fail("Class should have been found");
    }
    assertNotNull("Rule object is null", rule);
    assertEquals("Names not equal", rule.getName(), exists);
  }