@Test
@SuppressWarnings("unchecked")
public void testStatusHeartbeatWithAnnotation() throws Exception {

  Cluster cluster = heartbeatTestHelper.getDummyCluster();
  Service hdfs = cluster.addService(HDFS);
  hdfs.addServiceComponent(DATANODE);
  hdfs.addServiceComponent(NAMENODE);
  hdfs.addServiceComponent(SECONDARY_NAMENODE);
  ActionQueue aq = new ActionQueue();
  HeartBeat hb = new HeartBeat();
  hb.setTimestamp(System.currentTimeMillis());
  hb.setResponseId(0);
  hb.setHostname(DummyHostname1);
  hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
  hb.setReports(new ArrayList<CommandReport>());
  ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
  hb.setComponentStatus(componentStatuses);
  final HostRoleCommand command = hostRoleCommandFactory.create(DummyHostname1,
          Role.DATANODE, null, null);
  ActionManager am = actionManagerTestHelper.getMockActionManager();
  expect(am.getTasks(EasyMock.<List<Long>>anyObject())).andReturn(
          new ArrayList<HostRoleCommand>() {{
            add(command);
          }}).anyTimes();
  replay(am);
  HeartBeatHandler handler = heartbeatTestHelper.getHeartBeatHandler(am, aq);
  HeartBeatResponse resp = handler.handleHeartBeat(hb);
  Assert.assertFalse(resp.hasMappedComponents());
  hdfs.getServiceComponent(DATANODE).addServiceComponentHost(DummyHostname1);
  ServiceComponentHost serviceComponentHost1 = clusters.getCluster(DummyCluster).getService(HDFS).
      getServiceComponent(DATANODE).getServiceComponentHost(DummyHostname1);
  serviceComponentHost1.setState(State.INIT);
  hb = new HeartBeat();
  hb.setTimestamp(System.currentTimeMillis());
  hb.setResponseId(1);
  hb.setHostname(DummyHostname1);
  hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
  hb.setReports(new ArrayList<CommandReport>());
  hb.setComponentStatus(componentStatuses);
  resp = handler.handleHeartBeat(hb);
  Assert.assertTrue(resp.hasMappedComponents());
}