injector.getInstance(PersistService.class).stop();
}
@Test
public void testHostInfoImport() throws AmbariException{
HostInfo info = new HostInfo();
info.setMemorySize(100);
info.setProcessorCount(10);
info.setPhysicalProcessorCount(2);
List<DiskInfo> mounts = new ArrayList<DiskInfo>();
mounts.add(new DiskInfo("/dev/sda", "/mnt/disk1",
"5000000", "4000000", "10%", "size", "fstype"));
info.setMounts(mounts);
info.setHostName("foo");
info.setInterfaces("fip_4");
info.setArchitecture("os_arch");
info.setOS("os_type");
info.setMemoryTotal(10);
clusters.addHost("foo");
Host host = clusters.getHost("foo");
host.importHostInfo(info);
Assert.assertEquals(info.getHostName(), host.getHostName());
Assert.assertEquals(info.getFreeMemory(), host.getAvailableMemBytes());
Assert.assertEquals(info.getMemoryTotal(), host.getTotalMemBytes());
Assert.assertEquals(info.getProcessorCount(), host.getCpuCount());
Assert.assertEquals(info.getPhysicalProcessorCount(), host.getPhCpuCount());
Assert.assertEquals(info.getMounts().size(), host.getDisksInfo().size());
Assert.assertEquals(info.getArchitecture(), host.getOsArch());
Assert.assertEquals(info.getOS(), host.getOsType());
}