@Test
public void testFindSelected() throws Exception {

  createEntity(1L, "h1", "global", "version1");
  HostConfigMapping coreSiteConfigV1 = createEntity(1L, "h1", "core-site", "version1");
  HostEntity hostEntity = hostDAO.findByName("h1");
  
  Set<HostConfigMapping> targets = hostConfigMappingDAO.findSelected(1L, hostEntity.getHostId());
  Assert.assertEquals("Expected two entities", 2, targets.size());
  coreSiteConfigV1.setSelected(0);
  hostConfigMappingDAO.merge(coreSiteConfigV1);
  
  createEntity(1L, "h1", "core-site", "version2");
  targets = hostConfigMappingDAO.findSelected(1L, hostEntity.getHostId());
  Assert.assertEquals("Expected two entities", 2, targets.size());
}