public void testUpdateJobSlots() throws Exception {
JGDI jgdi = super.createJGDI();
try {
ClusterQueue testObj = jgdi.getClusterQueue("all.q");
testObj.setName("new.q");
jgdi.addClusterQueue(testObj);
try {
ClusterQueue retObj = jgdi.getClusterQueue(testObj.getName());
String host = TestValueFactory.getNextHostname();
retObj.putJobSlots(host, 10);
jgdi.updateClusterQueue(retObj);
ClusterQueue updatedObj = jgdi.getClusterQueue(testObj.getName());
// TODO: problem with short/long hostnames as keys -> failure of test even for correct result
// workaround is correct hostname in Testvalues*.properties
// System.out.println("retObj.getJobSlots(host) " + retObj.getJobSlots(host) + "(" + host + ")");
// System.out.println("updateObj.getJobSlots(host) " + updatedObj.getJobSlots(host) + "(" + host + ")");
// System.out.println("updateObj.getJobSlotsKeys() " + updatedObj.getJobSlotsKeys());
assertEquals(retObj.getJobSlots(host), updatedObj.getJobSlots(host));
retObj.removeJobSlots(host);
Logger logger = Logger.getLogger("com.sun.grid.jgdi");
Level orgLevel = logger.getLevel();
logger.setLevel(Level.FINE);
jgdi.updateClusterQueue(retObj);
updatedObj = jgdi.getClusterQueue(testObj.getName());
logger.setLevel(orgLevel);
Set hostnames = updatedObj.getJobSlotsKeys();
assertFalse(hostnames.contains(host));
} finally {
jgdi.deleteClusterQueue(testObj);
}