@Test @SuppressWarnings("unchecked") public void testLiveStatusUpdateAfterStopFailed() throws Exception { Cluster cluster = heartbeatTestHelper.getDummyCluster(); Service hdfs = cluster.addService(HDFS); hdfs.addServiceComponent(DATANODE); hdfs.getServiceComponent(DATANODE). addServiceComponentHost(DummyHostname1); hdfs.addServiceComponent(NAMENODE); hdfs.getServiceComponent(NAMENODE). addServiceComponentHost(DummyHostname1); ActionQueue aq = new ActionQueue(); ServiceComponentHost serviceComponentHost1 = clusters. getCluster(DummyCluster).getService(HDFS). getServiceComponent(DATANODE). getServiceComponentHost(DummyHostname1); ServiceComponentHost serviceComponentHost2 = clusters. getCluster(DummyCluster).getService(HDFS). getServiceComponent(NAMENODE). getServiceComponentHost(DummyHostname1); serviceComponentHost1.setState(State.STARTED); serviceComponentHost2.setState(State.STARTED); 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>(); ComponentStatus componentStatus1 = new ComponentStatus(); componentStatus1.setClusterName(DummyCluster); componentStatus1.setServiceName(HDFS); componentStatus1.setMessage(DummyHostStatus); componentStatus1.setStatus(State.STARTED.name()); componentStatus1.setSecurityState(SecurityState.UNSECURED.name()); componentStatus1.setComponentName(DATANODE); componentStatuses.add(componentStatus1); ComponentStatus componentStatus2 = new ComponentStatus(); componentStatus2.setClusterName(DummyCluster); componentStatus2.setServiceName(HDFS); componentStatus2.setMessage(DummyHostStatus); componentStatus2.setStatus(State.INSTALLED.name()); componentStatus2.setSecurityState(SecurityState.UNSECURED.name()); componentStatus2.setComponentName(NAMENODE); componentStatuses.add(componentStatus2); 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); add(command); }}); replay(am); HeartBeatHandler handler = heartbeatTestHelper.getHeartBeatHandler(am, aq); HeartbeatProcessor heartbeatProcessor = handler.getHeartbeatProcessor(); heartbeatProcessor.processHeartbeat(hb); State componentState1 = serviceComponentHost1.getState(); State componentState2 = serviceComponentHost2.getState(); assertEquals(State.STARTED, componentState1); assertEquals(State.INSTALLED, componentState2); }
public HeartbeatProcessor getHeartbeatProcessor() { return heartbeatProcessor; }
HeartBeatHandler { public HeartbeatProcessor getHeartbeatProcessor() { return heartbeatProcessor; } }
HeartBeatHandler { public HeartbeatProcessor getHeartbeatProcessor() { return heartbeatProcessor; } @Inject  HeartBeatHandler(Clusters fsm, ActionQueue aq, ActionManager am,
                          Injector injector); }
HeartBeatHandler { public HeartbeatProcessor getHeartbeatProcessor() { return heartbeatProcessor; } @Inject  HeartBeatHandler(Clusters fsm, ActionQueue aq, ActionManager am,
                          Injector injector); void start(); void setHeartbeatProcessor(HeartbeatProcessor heartbeatProcessor); HeartbeatProcessor getHeartbeatProcessor(); HeartBeatResponse handleHeartBeat(HeartBeat heartbeat); String getOsType(String os, String osRelease); RegistrationResponse handleRegistration(Register register); ComponentsResponse handleComponents(String clusterName); void stop(); }
HeartBeatHandler { public HeartbeatProcessor getHeartbeatProcessor() { return heartbeatProcessor; } @Inject  HeartBeatHandler(Clusters fsm, ActionQueue aq, ActionManager am,
                          Injector injector); void start(); void setHeartbeatProcessor(HeartbeatProcessor heartbeatProcessor); HeartbeatProcessor getHeartbeatProcessor(); HeartBeatResponse handleHeartBeat(HeartBeat heartbeat); String getOsType(String os, String osRelease); RegistrationResponse handleRegistration(Register register); ComponentsResponse handleComponents(String clusterName); void stop();  }