@Test
public void testComponents() throws Exception,
    InvalidStateTransitionException {

  ComponentsResponse expected = new ComponentsResponse();
  StackId dummyStackId = new StackId(DummyStackId);
  Map<String, Map<String, String>> dummyComponents = new HashMap<String, Map<String, String>>();
  Map<String, String> dummyCategoryMap = new HashMap<String, String>();
  dummyCategoryMap.put("PIG", "CLIENT");
  dummyComponents.put("PIG", dummyCategoryMap);
  dummyCategoryMap = new HashMap<String, String>();
  dummyCategoryMap.put("MAPREDUCE_CLIENT", "CLIENT");
  dummyCategoryMap.put("JOBTRACKER", "MASTER");
  dummyCategoryMap.put("TASKTRACKER", "SLAVE");
  dummyComponents.put("MAPREDUCE", dummyCategoryMap);
  dummyCategoryMap = new HashMap<String, String>();
  dummyCategoryMap.put("DATANODE2", "SLAVE");
  dummyCategoryMap.put("NAMENODE", "MASTER");
  dummyCategoryMap.put("HDFS_CLIENT", "CLIENT");
  dummyCategoryMap.put("DATANODE1", "SLAVE");
  dummyCategoryMap.put("SECONDARY_NAMENODE", "MASTER");
  dummyCategoryMap.put("DATANODE", "SLAVE");
  dummyComponents.put("HDFS", dummyCategoryMap);
  expected.setClusterName(DummyCluster);
  expected.setStackName(dummyStackId.getStackName());
  expected.setStackVersion(dummyStackId.getStackVersion());
  expected.setComponents(dummyComponents);
  heartbeatTestHelper.getDummyCluster();
  HeartBeatHandler handler = heartbeatTestHelper.getHeartBeatHandler(
      actionManagerTestHelper.getMockActionManager(),
      new ActionQueue());
  ComponentsResponse actual = handler.handleComponents(DummyCluster);
  if (log.isDebugEnabled()) {
    log.debug(actual.toString());
  }
  assertEquals(expected.getClusterName(), actual.getClusterName());
  assertEquals(expected.getStackName(), actual.getStackName());
  assertEquals(expected.getStackVersion(), actual.getStackVersion());
  assertEquals(expected.getComponents(), actual.getComponents());
}