{
logon(TEST_ADMIN_USER);
final String prefix = "GantChartTest";
final TaskTree taskTree = taskDao.getTaskTree();
final TaskDO rootTask = initTestDB.addTask(prefix, "root");
final DateHolder dh = new DateHolder();
dh.setDate(2010, Calendar.AUGUST, 3);
taskDao.update(initTestDB.addTask(prefix + "1", prefix).setStartDate(dh.getDate()).setDuration(BigDecimal.TEN));
initTestDB.addTask(prefix + "1.1", prefix + "1");
taskDao.update(initTestDB.addTask(prefix + "2", prefix).setGanttPredecessor(getTask(prefix + "1")).setDuration(BigDecimal.ONE));
taskDao.update(initTestDB.addTask(prefix + "3", prefix).setGanttPredecessor(getTask(prefix + "2")).setGanttPredecessorOffset(10)
.setDuration(BigDecimal.TEN));
final GanttChartData data = Task2GanttTaskConverter.convertToGanttObjectTree(taskTree, rootTask);
final GanttTask rootObject = data.getRootObject();
final GanttChartDO ganttChartDO = new GanttChartDO().setTask(rootTask);
ganttChartDao.writeGanttObjects(ganttChartDO, rootObject);
assertEquals("No output because there is no further information in the GanttObject tree.", "", ganttChartDO.getGanttObjectsAsXml());
findById(rootObject, getTask(prefix + "2").getId()).setPredecessorOffset(5).setDuration(new BigDecimal("12"));
findById(rootObject, getTask(prefix + "1.1").getId()).setDuration(new BigDecimal("2"));
ganttChartDao.writeGanttObjects(ganttChartDO, rootObject);
String xml = transform(prefix, "<ganttObject id='{}'>"
+ "<children>"
+ "<ganttObject id='{1}'>"
+ "<children>"
+ "<ganttObject id='{1.1}' duration='2'/>"
+ "</children>"
+ "</ganttObject>"
+ "<ganttObject id='{2}' predecessorOffset='5' duration='12'/></children></ganttObject>");
assertEquals("3 has no further information.", xml, ganttChartDO.getGanttObjectsAsXml());
GanttTask ganttObject = ganttChartDao.readGanttObjects(ganttChartDO).getRootObject();
ganttChartDao.writeGanttObjects(ganttChartDO, ganttObject);
assertEquals(xml, ganttChartDO.getGanttObjectsAsXml());
assertEquals("duration", BigDecimal.TEN, findById(ganttObject, getTask(prefix + "1").getId()).getDuration());
assertEquals("startDate", dh.getDate(), findById(ganttObject, getTask(prefix + "1").getId()).getStartDate());
initTestDB.addTask(prefix + "II", "root");
taskDao.update(getTask(prefix + "1.1").setParentTask(getTask(prefix))); // One level higher
taskDao.update(getTask(prefix + "2").setParentTask(getTask(prefix + "II"))); // Moved anywhere.
taskDao.update(getTask(prefix + "3").setParentTask(getTask(prefix + "II"))); // Moved anywhere.