Add utility for updating group name notes in bulk

This is intended to be used in combination with GroupRebuilder to batch
many rebuilds together, hence the combined test, but it doesn't actually
need to live in the same class.

Change-Id: I8c2673774f2bf29e726d1cd5cf87837cb46954b5
This commit is contained in:
Dave Borowitz
2017-11-14 16:53:27 -05:00
parent 0e415693ef
commit ffe1dc0337
10 changed files with 461 additions and 33 deletions

View File

@@ -8,5 +8,6 @@ java_library(
"//java/com/google/gerrit/extensions/client/testing:client-test-util",
"//java/com/google/gerrit/truth",
"//lib:truth",
"//lib/jgit/org.eclipse.jgit:jgit",
],
)

View File

@@ -24,6 +24,8 @@ import com.google.common.truth.Subject;
import com.google.common.truth.Truth;
import com.google.gerrit.extensions.common.GitPerson;
import java.sql.Timestamp;
import java.util.Date;
import org.eclipse.jgit.lib.PersonIdent;
public class GitPersonSubject extends Subject<GitPersonSubject, GitPerson> {
@@ -65,4 +67,14 @@ public class GitPersonSubject extends Subject<GitPersonSubject, GitPerson> {
date().isEqualTo(other.date);
tz().isEqualTo(other.tz);
}
public void matches(PersonIdent ident) {
isNotNull();
name().isEqualTo(ident.getName());
email().isEqualTo(ident.getEmailAddress());
Truth.assertThat(new Date(actual().date.getTime()))
.named("rounded date")
.isEqualTo(ident.getWhen());
tz().isEqualTo(ident.getTimeZoneOffset());
}
}