public void testRegisterNewNode()
throws AmbariException, InvalidStateTransitionException {
ActionManager am = getMockActionManager();
Clusters fsm = clusters;
fsm.addHost(DummyHostname1);
Host hostObject = clusters.getHost(DummyHostname1);
hostObject.setIPv4("ipv4");
hostObject.setIPv6("ipv6");
HeartBeatHandler handler = new HeartBeatHandler(fsm, new ActionQueue(), am,
injector);
Register reg = new Register();
HostInfo hi = new HostInfo();
hi.setHostName(DummyHostname1);
hi.setOS("redhat5");
reg.setHostname(DummyHostname1);
reg.setHardwareProfile(hi);
reg.setAgentVersion(metaInfo.getServerVersion());
RegistrationResponse response = handler.handleRegistration(reg);
assertEquals(hostObject.getState(), HostState.HEALTHY);
assertEquals("redhat5", hostObject.getOsType());
assertEquals(RegistrationStatus.OK, response.getResponseStatus());
assertEquals(0, response.getResponseId());
assertTrue(response.getStatusCommands().isEmpty());
}