@Test @SuppressWarnings("unchecked") public void testHeartBeatWithAlertAndInvalidCluster() throws Exception { ActionManager am = actionManagerTestHelper.getMockActionManager(); expect(am.getTasks(EasyMock.<List<Long>>anyObject())).andReturn( new ArrayList<HostRoleCommand>()); replay(am); Cluster cluster = heartbeatTestHelper.getDummyCluster(); Clusters fsm = clusters; Host hostObject = clusters.getHost(DummyHostname1); hostObject.setIPv4("ipv4"); hostObject.setIPv6("ipv6"); hostObject.setOsType(DummyOsType); ActionQueue aq = new ActionQueue(); HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector); Register reg = new Register(); HostInfo hi = new HostInfo(); hi.setHostName(DummyHostname1); hi.setOS(DummyOs); hi.setOSRelease(DummyOSRelease); reg.setHostname(DummyHostname1); reg.setHardwareProfile(hi); reg.setAgentVersion(metaInfo.getServerVersion()); handler.handleRegistration(reg); hostObject.setState(HostState.UNHEALTHY); ExecutionCommand execCmd = new ExecutionCommand(); execCmd.setRequestAndStage(2, 34); execCmd.setHostname(DummyHostname1); aq.enqueue(DummyHostname1, new ExecutionCommand()); HeartBeat hb = new HeartBeat(); HostStatus hs = new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus); hb.setResponseId(0); hb.setNodeStatus(hs); hb.setHostname(DummyHostname1); Alert alert = new Alert("foo", "bar", "baz", "foobar", "foobarbaz", AlertState.OK); alert.setCluster("BADCLUSTER"); List<Alert> alerts = Collections.singletonList(alert); hb.setAlerts(alerts); handler.getHeartbeatProcessor().processHeartbeat(hb); }
public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); processStatusReports(heartbeat); processCommandReports(heartbeat, now); processHostStatus(heartbeat); }
HeartbeatProcessor extends AbstractService { public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); processStatusReports(heartbeat); processCommandReports(heartbeat, now); processHostStatus(heartbeat); } }
HeartbeatProcessor extends AbstractService { public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); processStatusReports(heartbeat); processCommandReports(heartbeat, now); processHostStatus(heartbeat); } @Inject  HeartbeatProcessor(Clusters clusterFsm, ActionManager am, HeartbeatMonitor heartbeatMonitor,
                            Injector injector); }
HeartbeatProcessor extends AbstractService { public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); processStatusReports(heartbeat); processCommandReports(heartbeat, now); processHostStatus(heartbeat); } @Inject  HeartbeatProcessor(Clusters clusterFsm, ActionManager am, HeartbeatMonitor heartbeatMonitor,
                            Injector injector); void addHeartbeat(HeartBeat heartBeat); void processHeartbeat(HeartBeat heartbeat); }
HeartbeatProcessor extends AbstractService { public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); processStatusReports(heartbeat); processCommandReports(heartbeat, now); processHostStatus(heartbeat); } @Inject  HeartbeatProcessor(Clusters clusterFsm, ActionManager am, HeartbeatMonitor heartbeatMonitor,
                            Injector injector); void addHeartbeat(HeartBeat heartBeat); void processHeartbeat(HeartBeat heartbeat);  }