Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  Change bazel-genfiles to bazel-bin as per Bazel 0.25
  AccountIT#deletePreferredEmail: Make assertions more explicit
  Avoid evaluating submit rules twice for open changes

Change-Id: I399da0d5f3e3f144b1048a06d4243ec175e9801d
This commit is contained in:
Marco Miller
2019-06-10 15:56:58 -04:00
3 changed files with 24 additions and 7 deletions

View File

@@ -158,7 +158,7 @@ The output archive that contains Java binaries, Java sources and
Java docs will be placed in:
----
bazel-genfiles/api.zip
bazel-bin/api.zip
----
Install {extension,plugin,acceptance-framework}-api to the local
@@ -183,13 +183,13 @@ Install gerrit.war to the local maven repository:
The output JAR files for individual plugins will be placed in:
----
bazel-genfiles/plugins/<name>/<name>.jar
bazel-bin/plugins/<name>/<name>.jar
----
The JAR files will also be packaged in:
----
bazel-genfiles/plugins/core.zip
bazel-bin/plugins/core.zip
----
To build a specific plugin:
@@ -201,7 +201,7 @@ To build a specific plugin:
The output JAR file will be be placed in:
----
bazel-genfiles/plugins/<name>/<name>.jar
bazel-bin/plugins/<name>/<name>.jar
----
Note that when building an individual plugin, the `core.zip` package

View File

@@ -832,7 +832,7 @@ public class ChangeData {
}
public List<SubmitRecord> submitRecords(SubmitRuleOptions options) {
List<SubmitRecord> records = submitRecords.get(options);
List<SubmitRecord> records = getCachedSubmitRecord(options);
if (records == null) {
if (!lazyLoad) {
return Collections.emptyList();
@@ -845,7 +845,21 @@ public class ChangeData {
@Nullable
public List<SubmitRecord> getSubmitRecords(SubmitRuleOptions options) {
return submitRecords.get(options);
return getCachedSubmitRecord(options);
}
private List<SubmitRecord> getCachedSubmitRecord(SubmitRuleOptions options) {
List<SubmitRecord> records = submitRecords.get(options);
if (records != null) {
return records;
}
if (options.allowClosed() && change != null && change.getStatus().isOpen()) {
SubmitRuleOptions openSubmitRuleOptions = options.toBuilder().allowClosed(false).build();
return submitRecords.get(openSubmitRuleOptions);
}
return null;
}
public void setSubmitRecords(SubmitRuleOptions options, List<SubmitRecord> records) {

View File

@@ -1074,6 +1074,7 @@ public class AccountIT extends AbstractDaemonTest {
@Test
public void deletePreferredEmail() throws Exception {
String previous = gApi.accounts().self().get().email;
String email = "foo.bar.baz@example.com";
EmailInput input = new EmailInput();
input.email = email;
@@ -1085,6 +1086,7 @@ public class AccountIT extends AbstractDaemonTest {
// and then again on setting the email preferred.
accountIndexedCounter.assertReindexOf(admin, 2);
// The new preferred email is set
assertThat(gApi.accounts().self().get().email).isEqualTo(email);
accountIndexedCounter.clear();
@@ -1092,7 +1094,8 @@ public class AccountIT extends AbstractDaemonTest {
accountIndexedCounter.assertReindexOf(admin);
requestScopeOperations.resetCurrentApiUser();
assertThat(getEmails()).doesNotContain(email);
assertThat(getEmails()).containsExactly(previous);
assertThat(gApi.accounts().self().get().email).isNull();
}
@Test