host.setOsType("centos5");
host.persist();
c1.setDesiredStackVersion(new StackId("HDP-0.1"));
clusters.mapHostToCluster("h1", "c1");
HostEntity entity = hostDAO.findByName("h1");
HostStateEntity stateEntity = entity.getHostStateEntity();
Assert.assertNull(stateEntity.getMaintenanceState());
Assert.assertEquals(MaintenanceState.OFF, host.getMaintenanceState(c1.getClusterId()));
host.setMaintenanceState(c1.getClusterId(), MaintenanceState.ON);
entity = hostDAO.findByName("h1");
stateEntity = entity.getHostStateEntity();
Assert.assertNotNull(stateEntity.getMaintenanceState());
Assert.assertEquals(MaintenanceState.ON, host.getMaintenanceState(c1.getClusterId()));
}