Fixed a bug and unit tests with subtasks serialization

pull/14/head
Sam Bosley 12 years ago
parent ee0b5ddae4
commit 1ac305433c

@ -42,7 +42,7 @@ public abstract class AstridOrderedListUpdater<LIST> {
public Node(long taskId, Node parent, int indent) {
this.taskId = taskId;
this.uuid = RemoteModel.NO_UUID;
this.uuid = "-1"; //$NON-NLS-1$
this.parent = parent;
this.indent = indent;
}
@ -442,7 +442,10 @@ public abstract class AstridOrderedListUpdater<LIST> {
recursivelySerialize(child, branch, useUuid);
serializeTo.put(branch);
} else {
serializeTo.put(child.taskId);
if (useUuid)
serializeTo.put(child.uuid);
else
serializeTo.put(child.taskId);
}
}
}

@ -43,7 +43,7 @@ public class SubtasksHelperTest extends SubtasksTestCase {
// Default order: "[-1, [1, 2, [3, 4]], 5, 6]"
private static String EXPECTED_REMOTE = "[-1, [6, 4, [3, 1]], 2, 5]".replaceAll("\\s", "");
private static String EXPECTED_REMOTE = "[\"-1\", [\"6\", \"4\", [\"3\", \"1\"]], \"2\", \"5\"]".replaceAll("\\s", "");
public void testLocalToRemoteIdMapping() {
String mapped = SubtasksHelper.convertTreeToRemoteIds(DEFAULT_SERIALIZED_TREE).replaceAll("\\s", "");
assertEquals(EXPECTED_REMOTE, mapped);

Loading…
Cancel
Save