@Test
public void testGetRequiredHostGroups___multipleGroups() throws Exception {

  Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
  Map<String, String> coreSiteMap = new HashMap<String, String>();
  properties.put("core-site", coreSiteMap);
  coreSiteMap.put("fs.defaultFS", "localhost");
  Configuration clusterConfig = new Configuration(properties,
      Collections.<String, Map<String, Map<String, String>>>emptyMap());
  expect(stack.getCardinality("NAMENODE")).andReturn(new Cardinality("1")).anyTimes();
  Collection<String> hgComponents1 = new HashSet<String>();
  hgComponents1.add("HIVE_SERVER");
  hgComponents1.add("NAMENODE");
  TestHostGroup group1 = new TestHostGroup("group1", hgComponents1, Collections.singleton("host1"));
  Collection<String> hgComponents2 = new HashSet<String>();
  hgComponents2.add("NAMENODE");
  hgComponents2.add("DATANODE");
  TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("host2"));
  Collection<TestHostGroup> hostGroups = new ArrayList<TestHostGroup>();
  hostGroups.add(group1);
  hostGroups.add(group2);
  ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
  BlueprintConfigurationProcessor updater = new BlueprintConfigurationProcessor(topology);
  // call top-level export method
  Collection<String> requiredGroups = updater.getRequiredHostGroups();
  assertEquals(2, requiredGroups.size());
  assertTrue(requiredGroups.containsAll(Arrays.asList("group1", "group2")));
}