Merge branch 'stable-2.15'

* stable-2.15:
  ChangeIT: Move reflog test to ReflogIT
  ReflogIT: Move to com.google.gerrit.acceptance.server.project
  ReflogIT: Remove unneeded setUp method
  ChangeIT: Fix and expand reflog test
  ProjectState: Remove unnecessary 'final' modifiers from constructor
  ConfigInfo: Annotate MaxObjectSizeLimitInfo fields as nullable
  ConfigInfo: Add Javadoc for MaxObjectSizeLimitInfo fields
  Upgrade JGit to v4.5.4.201711221230-r
  Fix deprecation warnings from latest JGit update
  Upgrade JGit to 4.3.0.201604071810-r
  Set version to 2.12.9-SNAPSHOT
  Buck: Fix typo in gerrit_plugin.bucklet
  Remove min width from autocomplete container
  ConfigInfoImpl: Factor out initialization of MaxObjectSizeLimitInfo to a method
  Rename instances of TransferConfig to transferConfig
  Clarify inherited_value in documentation of MaxObjectSizeLimitInfo
  Reword docmentation of project specific object size limit for clarity
  PutConfig: Reload project config before returning response
  Fix partially hidden plugin configuration in the UI
  Upgrade PostgreSQL JDBC driver
  SiteProgram: Extract local variable
  SiteProgram: Extract constant
  SiteProgram: Inline variable to avoid hiding field
  DataSourceProvider: Rename local variable to avoid hiding field
  DataSourceProvider: Remove unneeded finals
  DataSourceProvider: Replace inner class with lambda
  DataSourceProvider: Extract constant
  Add current patchset to json when a review is public/ready
  Migrate `tools/bazel.rc` to `.bazelrc`
  ProjectIT: Add tests for maxObjectSize configuration
  EventRecorder: Add assertNoRefUpdatedEvents helper method
  ProjectIT: Rename 'config' method to 'submitType'

Change-Id: I83eee5496f538daff37c936dcb1cc19f13b27705
This commit is contained in:
David Pursehouse
2018-08-15 13:39:59 +01:00
24 changed files with 277 additions and 92 deletions

View File

@@ -18,13 +18,19 @@ import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.RevisionInfo;
import com.google.gerrit.extensions.events.PrivateStateChangedListener;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.server.GpgException;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.patch.PatchListNotAvailableException;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.io.IOException;
import java.sql.Timestamp;
@Singleton
@@ -40,12 +46,17 @@ public class PrivateStateChanged {
this.util = util;
}
public void fire(Change change, AccountState account, Timestamp when) {
public void fire(Change change, PatchSet patchSet, AccountState account, Timestamp when) {
if (!listeners.iterator().hasNext()) {
return;
}
try {
Event event = new Event(util.changeInfo(change), util.accountInfo(account), when);
Event event =
new Event(
util.changeInfo(change),
util.revisionInfo(change.getProject(), patchSet),
util.accountInfo(account),
when);
for (PrivateStateChangedListener l : listeners) {
try {
l.onPrivateStateChanged(event);
@@ -53,16 +64,20 @@ public class PrivateStateChanged {
util.logEventListenerError(event, l, e);
}
}
} catch (OrmException e) {
} catch (OrmException
| PatchListNotAvailableException
| GpgException
| IOException
| PermissionBackendException e) {
logger.atSevere().withCause(e).log("Couldn't fire event");
}
}
private static class Event extends AbstractChangeEvent
private static class Event extends AbstractRevisionEvent
implements PrivateStateChangedListener.Event {
protected Event(ChangeInfo change, AccountInfo who, Timestamp when) {
super(change, who, when, NotifyHandling.ALL);
protected Event(ChangeInfo change, RevisionInfo revision, AccountInfo who, Timestamp when) {
super(change, revision, who, when, NotifyHandling.ALL);
}
}
}

View File

@@ -18,13 +18,19 @@ import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.RevisionInfo;
import com.google.gerrit.extensions.events.WorkInProgressStateChangedListener;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.server.GpgException;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.patch.PatchListNotAvailableException;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.io.IOException;
import java.sql.Timestamp;
@Singleton
@@ -41,12 +47,17 @@ public class WorkInProgressStateChanged {
this.util = util;
}
public void fire(Change change, AccountState account, Timestamp when) {
public void fire(Change change, PatchSet patchSet, AccountState account, Timestamp when) {
if (!listeners.iterator().hasNext()) {
return;
}
try {
Event event = new Event(util.changeInfo(change), util.accountInfo(account), when);
Event event =
new Event(
util.changeInfo(change),
util.revisionInfo(change.getProject(), patchSet),
util.accountInfo(account),
when);
for (WorkInProgressStateChangedListener l : listeners) {
try {
l.onWorkInProgressStateChanged(event);
@@ -54,16 +65,20 @@ public class WorkInProgressStateChanged {
util.logEventListenerError(event, l, e);
}
}
} catch (OrmException e) {
} catch (OrmException
| PatchListNotAvailableException
| GpgException
| IOException
| PermissionBackendException e) {
logger.atSevere().withCause(e).log("Couldn't fire event");
}
}
private static class Event extends AbstractChangeEvent
private static class Event extends AbstractRevisionEvent
implements WorkInProgressStateChangedListener.Event {
protected Event(ChangeInfo change, AccountInfo who, Timestamp when) {
super(change, who, when, NotifyHandling.ALL);
protected Event(ChangeInfo change, RevisionInfo revision, AccountInfo who, Timestamp when) {
super(change, revision, who, when, NotifyHandling.ALL);
}
}
}