Make persistent task keys stable

GSON was used to create json as the input for sha1 task keys, however
gson can order the json keys differently anytime. Use the values in a
specific order to create stable keys.

Bug: Issue 11760
Change-Id: I6900b5ddb3ba8ab7b5cf7803ae9dd551b5980a59
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
index cc1f10e..3b174a3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -116,7 +116,8 @@
     public Task(ReplicateRefUpdate update) {
       this.update = update;
       json = GSON.toJson(update) + "\n";
-      taskKey = sha1(json).name();
+      String key = update.project + "\n" + update.ref + "\n" + update.uri + "\n" + update.remote;
+      taskKey = sha1(key).name();
       file = refUpdates().resolve(taskKey);
     }