@Test @SuppressWarnings("unchecked") public void testRestartRequiredAfterInstallClient() throws Exception { Cluster cluster = heartbeatTestHelper.getDummyCluster(); Service hdfs = cluster.addService(HDFS); hdfs.addServiceComponent(HDFS_CLIENT); hdfs.getServiceComponent(HDFS_CLIENT).addServiceComponentHost(DummyHostname1); ActionQueue aq = new ActionQueue(); ServiceComponentHost serviceComponentHost = clusters.getCluster(DummyCluster).getService(HDFS). getServiceComponent(HDFS_CLIENT).getServiceComponentHost(DummyHostname1); serviceComponentHost.setState(State.INSTALLED); serviceComponentHost.setRestartRequired(true); HeartBeat hb = new HeartBeat(); hb.setResponseId(0); hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus)); hb.setHostname(DummyHostname1); List<CommandReport> reports = new ArrayList<CommandReport>(); CommandReport cr = new CommandReport(); cr.setActionId(StageUtils.getActionId(requestId, stageId)); cr.setServiceName(HDFS); cr.setRoleCommand("INSTALL"); cr.setCustomCommand("EXECUTION_COMMAND"); cr.setTaskId(1); cr.setRole(HDFS_CLIENT); cr.setStatus("COMPLETED"); cr.setStdErr(""); cr.setStdOut(""); cr.setExitCode(215); cr.setClusterName(DummyCluster); cr.setConfigurationTags(new HashMap<String, Map<String, String>>() {{ put("global", new HashMap<String, String>() {{ put("tag", "version1"); }}); }}); reports.add(cr); hb.setReports(reports); 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); Assert.assertNotNull(serviceComponentHost.getActualConfigs()); Assert.assertFalse(serviceComponentHost.isRestartRequired()); Assert.assertEquals(serviceComponentHost.getActualConfigs().size(), 1); }
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);  }