}
@Test
@Transactional
public void testUpdateConfigGroup() throws Exception {
ConfigGroup configGroup = createConfigGroup();
Assert.assertNotNull(configGroup);
ConfigGroupEntity configGroupEntity = configGroupDAO.findById(configGroup.getId());
Assert.assertNotNull(configGroupEntity);
configGroup = configGroupFactory.createExisting(cluster, configGroupEntity);
// Add new host
Host host = clusters.getHost("h2");
configGroup.addHost(host);
Assert.assertEquals(2, configGroup.getHosts().values().size());
// Create a new config
Map<String, String> properties = new HashMap<String, String>();
properties.put("key1", "value1");
Config config = new ConfigImpl("test-site");
config.setProperties(properties);
config.setVersionTag("version100");
configGroup.addConfiguration(config);
Assert.assertEquals(2, configGroup.getConfigurations().values().size());
configGroup.setName("NewName");
configGroup.setDescription("NewDesc");
configGroup.setTag("NewTag");
// Save
configGroup.persist();
configGroupEntity = configGroupDAO.findByName("NewName");
Assert.assertNotNull(configGroupEntity);
Assert.assertEquals(2, configGroupEntity