Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  bazlets: Replace native.git_repository with skylark rule
  Upgrade bazlets to latest stable-2.14 to build with 2.14.15 API

Change-Id: I96b6bb26df0ee238f896e0333a76ec708fb54118
diff --git a/WORKSPACE b/WORKSPACE
index c67adf0..d51d148 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "0cdf281f110834b71ae134afe0a7e3fe346f0078",
+    commit = "6d3fd710ea4ca44805bb8c858d72b53bd3a500f3",
     # local_path = "/home/<user>/projects/bazlets",
 )
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
index d7193fd..99fe80c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
@@ -28,7 +28,6 @@
 import com.google.gerrit.server.events.ChangeMergedEvent;
 import com.google.gerrit.server.events.ChangeRestoredEvent;
 import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
 import com.google.gerrit.server.events.Event;
 import com.google.gerrit.server.events.PatchSetCreatedEvent;
 import com.google.gerrit.server.events.RefUpdatedEvent;
@@ -93,9 +92,6 @@
     } else if (event instanceof ChangeRestoredEvent) {
       ChangeRestoredEvent e = (ChangeRestoredEvent) event;
       return isEnabled(e.getProjectNameKey(), e.getRefName());
-    } else if (event instanceof DraftPublishedEvent) {
-      DraftPublishedEvent e = (DraftPublishedEvent) event;
-      return isEnabled(e.getProjectNameKey(), e.getRefName());
     } else if (event instanceof RefUpdatedEvent) {
       RefUpdatedEvent e = (RefUpdatedEvent) event;
       return isEnabled(e.getProjectNameKey(), e.getRefName());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractor.java
index 572cffd..17f83c8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractor.java
@@ -3,11 +3,16 @@
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import com.google.gerrit.extensions.api.GerritApi;
+import com.google.gerrit.extensions.client.ListChangesOption;
+import com.google.gerrit.extensions.common.ChangeInfo;
+import com.google.gerrit.extensions.common.RevisionInfo;
+import com.google.gerrit.extensions.restapi.RestApiException;
 import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.server.ReviewDb;
-import com.google.gwtorm.server.OrmException;
+import com.google.inject.ImplementedBy;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.its.base.its.ItsConfig;
+import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
@@ -20,11 +25,45 @@
   private static final Logger log = LoggerFactory.getLogger(IssueExtractor.class);
 
   private final CommitMessageFetcher commitMessageFetcher;
-  private final ReviewDb db;
+  private final PatchSetDb db;
   private final ItsConfig itsConfig;
 
+  @ImplementedBy(PatchSetDbImpl.class)
+  public interface PatchSetDb {
+    public String getRevision(PatchSet.Id patchSetId);
+  }
+
+  public static class PatchSetDbImpl implements PatchSetDb {
+    private final GerritApi gApi;
+
+    @Inject
+    public PatchSetDbImpl(GerritApi gApi) {
+      this.gApi = gApi;
+    }
+
+    @Override
+    public String getRevision(PatchSet.Id patchSetId) {
+      try {
+        ChangeInfo info =
+            gApi.changes()
+                .id(patchSetId.getParentKey().get())
+                .get(EnumSet.of(ListChangesOption.ALL_REVISIONS));
+        for (Map.Entry<String, RevisionInfo> e : info.revisions.entrySet()) {
+          if (e.getValue()._number == patchSetId.get()) {
+            return e.getKey();
+          }
+        }
+        return null;
+      } catch (RestApiException e) {
+        // previous is still empty to indicate that there was no previous
+        // accessible patch set. We treat every occurrence as added.
+      }
+      return null;
+    }
+  }
+
   @Inject
-  IssueExtractor(ItsConfig itsConfig, CommitMessageFetcher commitMessageFetcher, ReviewDb db) {
+  IssueExtractor(ItsConfig itsConfig, CommitMessageFetcher commitMessageFetcher, PatchSetDb db) {
     this.commitMessageFetcher = commitMessageFetcher;
     this.db = db;
     this.itsConfig = itsConfig;
@@ -179,14 +218,9 @@
       if (patchSetId.get() != 1) {
         PatchSet.Id previousPatchSetId =
             new PatchSet.Id(patchSetId.getParentKey(), patchSetId.get() - 1);
-        try {
-          PatchSet previousPatchSet = db.patchSets().get(previousPatchSetId);
-          if (previousPatchSet != null) {
-            previous = getIssueIds(projectName, previousPatchSet.getRevision().get());
-          }
-        } catch (OrmException e) {
-          // previous is still empty to indicate that there was no previous
-          // accessible patch set. We treat every occurrence as added.
+        String previousPatchSet = db.getRevision(previousPatchSetId);
+        if (previousPatchSet != null) {
+          previous = getIssueIds(projectName, previousPatchSet);
         }
       }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
index 98c593a..3b95144 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
@@ -113,10 +113,6 @@
         propertyFactory.create("deletions", Integer.toString(patchSetAttribute.sizeDeletions)));
     properties.add(
         propertyFactory.create("insertions", Integer.toString(patchSetAttribute.sizeInsertions)));
-    // deprecated, to be removed soon. migrate to ones without dash.
-    properties.add(propertyFactory.create("is-draft", Boolean.toString(patchSetAttribute.isDraft)));
-    // New style configs for vm and soy
-    properties.add(propertyFactory.create("isDraft", Boolean.toString(patchSetAttribute.isDraft)));
     properties.addAll(extractFrom(patchSetAttribute.uploader, "uploader"));
     properties.addAll(extractFrom(patchSetAttribute.author, "author"));
     return properties;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
index f9c589d..b04bcb0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
@@ -27,7 +27,6 @@
 import com.google.gerrit.server.events.ChangeMergedEvent;
 import com.google.gerrit.server.events.ChangeRestoredEvent;
 import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
 import com.google.gerrit.server.events.Event;
 import com.google.gerrit.server.events.PatchSetCreatedEvent;
 import com.google.gerrit.server.events.PatchSetEvent;
@@ -102,11 +101,6 @@
     return extractFrom((PatchSetEvent) event, common);
   }
 
-  private Map<String, Set<String>> extractFrom(DraftPublishedEvent event, Set<Property> common) {
-    common.addAll(propertyAttributeExtractor.extractFrom(event.uploader.get(), "uploader"));
-    return extractFrom((PatchSetEvent) event, common);
-  }
-
   private Map<String, Set<String>> extractFrom(RefUpdatedEvent event, Set<Property> common) {
     common.add(propertyFactory.create("event-type", event.type));
     if (event.submitter != null) {
@@ -190,8 +184,6 @@
       associations = extractFrom((ChangeRestoredEvent) event, common);
     } else if (event instanceof CommentAddedEvent) {
       associations = extractFrom((CommentAddedEvent) event, common);
-    } else if (event instanceof DraftPublishedEvent) {
-      associations = extractFrom((DraftPublishedEvent) event, common);
     } else if (event instanceof PatchSetCreatedEvent) {
       associations = extractFrom((PatchSetCreatedEvent) event, common);
     } else if (event instanceof RefUpdatedEvent) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
index 8a7a09f..eb8c4a6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
@@ -41,6 +41,16 @@
     this.its = its;
   }
 
+  private String formatPerson(String prefix, Map<String, String> map) {
+    String ret = Strings.nullToEmpty(map.get(prefix + "-name"));
+    ret = Strings.nullToEmpty(map.get(prefix + "Name"));
+    if (ret.isEmpty()) {
+      ret = Strings.nullToEmpty(map.get(prefix + "-username"));
+      ret = Strings.nullToEmpty(map.get(prefix + "Username"));
+    }
+    return ret;
+  }
+
   private String getCommentChangeEvent(String action, String prefix, Map<String, String> map) {
     String ret = "";
     String changeNumber = getValueFromMap(map, "", "change-number", "changeNumber");
diff --git a/src/main/resources/Documentation/config-rulebase-common.md b/src/main/resources/Documentation/config-rulebase-common.md
index 8f1da31..16f2de5 100644
--- a/src/main/resources/Documentation/config-rulebase-common.md
+++ b/src/main/resources/Documentation/config-rulebase-common.md
@@ -160,7 +160,6 @@
 * [ChangeMergedEvent][event-properties-ChangeMergedEvent]
 * [ChangeRestoredEvent][event-properties-ChangeRestoredEvent]
 * [CommentAddedEvent][event-properties-CommentAddedEvent]
-* [DraftPublishedEvent][event-properties-DraftPublishedEvent]
 * [PatchSetCreatedEvent][event-properties-PatchSetCreatedEvent]
 * [RefUpdatedEvent][event-properties-RefUpdatedEvent]
 * [Common properties for events on a change][event-properties-change]
@@ -332,19 +331,6 @@
 properties for the [Change][event-properties-change] the comment was
 added for, and it's most recent [Patch Set][event-properties-patch-set].
 
-[event-properties-DraftPublishedEvent]: #event-properties-DraftPublishedEvent
-### <a name="event-properties-DraftPublishedEvent">DraftPublishedEvent</a>
-
-`event`
-: `com.google.gerrit.server.events.DraftPublishedEvent`
-
-`event-type`
-: `draft-published`
-
-In addition to the above properties, the event also provides
-properties for the uploaded [Patch Set][event-properties-patch-set],
-and the [Change][event-properties-change] it belongs to.
-
 [event-properties-PatchSetCreatedEvent]: #event-properties-PatchSetCreatedEvent
 ### <a name="event-properties-PatchSetCreatedEvent">PatchSetCreatedEvent</a>
 
@@ -426,8 +412,8 @@
 : full commit message of the most recent patch set
 
 `status`
-:   status of the change (`null`, `NEW`, `SUBMITTED`, `DRAFT`, `MERGED`,
-    or `ABANDONED` )
+:	status of the change (`null`, `NEW`, `SUBMITTED`, `MERGED`,
+	or `ABANDONED` )
 
 `topic`
 : name of the topic the change belongs to.
@@ -453,9 +439,6 @@
 `insertions`
 : number of lines inserted by the patch set.
 
-`isDraft`
-: 'true', if the patch set is a draft patch set, 'false' otherwise.
-
 `parents`
 : A list of git commit hashes that are parents to the patch set.
 
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
index 8f349b3..6561d00 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
@@ -28,7 +28,6 @@
 import com.google.gerrit.server.events.ChangeMergedEvent;
 import com.google.gerrit.server.events.ChangeRestoredEvent;
 import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
 import com.google.gerrit.server.events.Event;
 import com.google.gerrit.server.events.PatchSetCreatedEvent;
 import com.google.gerrit.server.events.RefUpdatedEvent;
@@ -452,19 +451,6 @@
     assertTrue(itsConfig.isEnabled(event));
   }
 
-  public void testIsEnabledDraftPublishedEvent() {
-    String[] branches = {};
-    setupIsEnabled("true", null, branches);
-
-    DraftPublishedEvent event = new DraftPublishedEvent(testChange("testProject", "testBranch"));
-
-    ItsConfig itsConfig = createItsConfig();
-
-    replayMocks();
-
-    assertTrue(itsConfig.isEnabled(event));
-  }
-
   public void testIsEnabledRefUpdatedEvent() {
     String[] branches = {};
     setupIsEnabled("true", null, branches);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java
index 2c61666..80cbfd3 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/IssueExtractorTest.java
@@ -21,13 +21,11 @@
 import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.reviewdb.client.PatchSet;
 import com.google.gerrit.reviewdb.client.RevId;
-import com.google.gerrit.reviewdb.server.PatchSetAccess;
-import com.google.gerrit.reviewdb.server.ReviewDb;
-import com.google.gwtorm.server.OrmException;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.googlesource.gerrit.plugins.its.base.its.ItsConfig;
 import com.googlesource.gerrit.plugins.its.base.testutil.LoggingMockingTestCase;
+import com.googlesource.gerrit.plugins.its.base.util.IssueExtractor.PatchSetDb;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -43,7 +41,7 @@
   private Injector injector;
   private ItsConfig itsConfig;
   private CommitMessageFetcher commitMessageFetcher;
-  private ReviewDb db;
+  private PatchSetDb db;
 
   public void testIssueIdsNullPattern() {
     IssueExtractor issueExtractor = injector.getInstance(IssueExtractor.class);
@@ -803,7 +801,7 @@
     assertLogMessageContains("Matching");
   }
 
-  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondEmpty() throws OrmException {
+  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondEmpty() {
     expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
     expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
 
@@ -817,22 +815,14 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = new PatchSet.Id(changeId, 1);
-    RevId previousRevId = createMock(RevId.class);
-    expect(previousRevId.get()).andReturn("9876543211987654321298765432139876543214").anyTimes();
-
-    PatchSet previousPatchSet = createMock(PatchSet.class);
-    expect(previousPatchSet.getRevision()).andReturn(previousRevId).anyTimes();
-
-    PatchSetAccess patchSetAccess = createMock(PatchSetAccess.class);
-    expect(patchSetAccess.get(previousPatchSetId)).andReturn(previousPatchSet);
+    expect(db.getRevision(previousPatchSetId))
+        .andReturn("9876543211987654321298765432139876543214");
 
     expect(
             commitMessageFetcher.fetchGuarded(
                 "testProject", "9876543211987654321298765432139876543214"))
         .andReturn("subject\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.patchSets()).andReturn(patchSetAccess);
-
     PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
     expect(currentPatchSetId.get()).andReturn(2).anyTimes();
     expect(currentPatchSetId.getParentKey()).andReturn(changeId).anyTimes();
@@ -860,7 +850,7 @@
     assertLogMessageContains("Matching");
   }
 
-  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondSame() throws OrmException {
+  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondSame() {
     expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
     expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
 
@@ -874,21 +864,13 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = new PatchSet.Id(changeId, 1);
-    RevId previousRevId = createMock(RevId.class);
-    expect(previousRevId.get()).andReturn("9876543211987654321298765432139876543214").anyTimes();
-
-    PatchSet previousPatchSet = createMock(PatchSet.class);
-    expect(previousPatchSet.getRevision()).andReturn(previousRevId).anyTimes();
-
-    PatchSetAccess patchSetAccess = createMock(PatchSetAccess.class);
-    expect(patchSetAccess.get(previousPatchSetId)).andReturn(previousPatchSet);
-
     expect(
             commitMessageFetcher.fetchGuarded(
                 "testProject", "9876543211987654321298765432139876543214"))
         .andReturn("bug#42\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.patchSets()).andReturn(patchSetAccess);
+    expect(db.getRevision(previousPatchSetId))
+        .andReturn("9876543211987654321298765432139876543214");
 
     PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
     expect(currentPatchSetId.get()).andReturn(2).anyTimes();
@@ -917,7 +899,7 @@
     assertLogMessageContains("Matching");
   }
 
-  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondBody() throws OrmException {
+  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondBody() {
     expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
     expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
 
@@ -931,15 +913,6 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = new PatchSet.Id(changeId, 1);
-    RevId previousRevId = createMock(RevId.class);
-    expect(previousRevId.get()).andReturn("9876543211987654321298765432139876543214").anyTimes();
-
-    PatchSet previousPatchSet = createMock(PatchSet.class);
-    expect(previousPatchSet.getRevision()).andReturn(previousRevId).anyTimes();
-
-    PatchSetAccess patchSetAccess = createMock(PatchSetAccess.class);
-    expect(patchSetAccess.get(previousPatchSetId)).andReturn(previousPatchSet);
-
     expect(
             commitMessageFetcher.fetchGuarded(
                 "testProject", "9876543211987654321298765432139876543214"))
@@ -949,7 +922,8 @@
                 + "\n"
                 + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.patchSets()).andReturn(patchSetAccess);
+    expect(db.getRevision(previousPatchSetId))
+        .andReturn("9876543211987654321298765432139876543214");
 
     PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
     expect(currentPatchSetId.get()).andReturn(2).anyTimes();
@@ -978,7 +952,7 @@
     assertLogMessageContains("Matching");
   }
 
-  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondFooter() throws OrmException {
+  public void testIssueIdsCommitWAddedSingleSubjectIssueSecondFooter() {
     expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
     expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
 
@@ -996,21 +970,13 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = new PatchSet.Id(changeId, 1);
-    RevId previousRevId = createMock(RevId.class);
-    expect(previousRevId.get()).andReturn("9876543211987654321298765432139876543214").anyTimes();
-
-    PatchSet previousPatchSet = createMock(PatchSet.class);
-    expect(previousPatchSet.getRevision()).andReturn(previousRevId).anyTimes();
-
-    PatchSetAccess patchSetAccess = createMock(PatchSetAccess.class);
-    expect(patchSetAccess.get(previousPatchSetId)).andReturn(previousPatchSet);
-
     expect(
             commitMessageFetcher.fetchGuarded(
                 "testProject", "9876543211987654321298765432139876543214"))
         .andReturn("bug#42\n" + "\n" + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.patchSets()).andReturn(patchSetAccess);
+    expect(db.getRevision(previousPatchSetId))
+        .andReturn("9876543211987654321298765432139876543214");
 
     PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
     expect(currentPatchSetId.get()).andReturn(2).anyTimes();
@@ -1042,7 +1008,7 @@
     assertLogMessageContains("Matching");
   }
 
-  public void testIssueIdsCommitWAddedSubjectFooter() throws OrmException {
+  public void testIssueIdsCommitWAddedSubjectFooter() {
     expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
     expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
 
@@ -1062,15 +1028,6 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = new PatchSet.Id(changeId, 1);
-    RevId previousRevId = createMock(RevId.class);
-    expect(previousRevId.get()).andReturn("9876543211987654321298765432139876543214").anyTimes();
-
-    PatchSet previousPatchSet = createMock(PatchSet.class);
-    expect(previousPatchSet.getRevision()).andReturn(previousRevId).anyTimes();
-
-    PatchSetAccess patchSetAccess = createMock(PatchSetAccess.class);
-    expect(patchSetAccess.get(previousPatchSetId)).andReturn(previousPatchSet);
-
     expect(
             commitMessageFetcher.fetchGuarded(
                 "testProject", "9876543211987654321298765432139876543214"))
@@ -1080,7 +1037,8 @@
                 + "\n"
                 + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.patchSets()).andReturn(patchSetAccess);
+    expect(db.getRevision(previousPatchSetId))
+        .andReturn("9876543211987654321298765432139876543214");
 
     PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
     expect(currentPatchSetId.get()).andReturn(2).anyTimes();
@@ -1120,7 +1078,7 @@
     assertLogMessageContains("Matching");
   }
 
-  public void testIssueIdsCommitWAddedMultiple() throws OrmException {
+  public void testIssueIdsCommitWAddedMultiple() {
     expect(itsConfig.getIssuePattern()).andReturn(Pattern.compile("bug#(\\d+)")).atLeastOnce();
     expect(itsConfig.getIssuePatternGroupIndex()).andReturn(1).atLeastOnce();
 
@@ -1140,15 +1098,6 @@
 
     // Call for previous patch set
     PatchSet.Id previousPatchSetId = new PatchSet.Id(changeId, 1);
-    RevId previousRevId = createMock(RevId.class);
-    expect(previousRevId.get()).andReturn("9876543211987654321298765432139876543214").anyTimes();
-
-    PatchSet previousPatchSet = createMock(PatchSet.class);
-    expect(previousPatchSet.getRevision()).andReturn(previousRevId).anyTimes();
-
-    PatchSetAccess patchSetAccess = createMock(PatchSetAccess.class);
-    expect(patchSetAccess.get(previousPatchSetId)).andReturn(previousPatchSet);
-
     expect(
             commitMessageFetcher.fetchGuarded(
                 "testProject", "9876543211987654321298765432139876543214"))
@@ -1159,7 +1108,8 @@
                 + "Bug: bug#16\n"
                 + "Change-Id: I9876543211987654321298765432139876543214");
 
-    expect(db.patchSets()).andReturn(patchSetAccess);
+    expect(db.getRevision(previousPatchSetId))
+        .andReturn("9876543211987654321298765432139876543214");
 
     PatchSet.Id currentPatchSetId = createMock(PatchSet.Id.class);
     expect(currentPatchSetId.get()).andReturn(2).anyTimes();
@@ -1217,8 +1167,8 @@
       commitMessageFetcher = createMock(CommitMessageFetcher.class);
       bind(CommitMessageFetcher.class).toInstance(commitMessageFetcher);
 
-      db = createMock(ReviewDb.class);
-      bind(ReviewDb.class).toInstance(db);
+      db = createMock(PatchSetDb.class);
+      bind(PatchSetDb.class).toInstance(db);
     }
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
index 0df6abb..69d8196 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
@@ -351,7 +351,6 @@
     patchSetAttribute.parents = Lists.newArrayList("parent1", "parent2");
     patchSetAttribute.sizeDeletions = 7;
     patchSetAttribute.sizeInsertions = 12;
-    patchSetAttribute.isDraft = true;
     patchSetAttribute.uploader = uploader;
     patchSetAttribute.author = author;
 
@@ -383,12 +382,6 @@
     Property propertyInsertions = createMock(Property.class);
     expect(propertyFactory.create("insertions", "12")).andReturn(propertyInsertions);
 
-    Property propertyIsDraft = createMock(Property.class);
-    expect(propertyFactory.create("is-draft", "true")).andReturn(propertyIsDraft);
-
-    Property propertyIsDraft2 = createMock(Property.class);
-    expect(propertyFactory.create("isDraft", "true")).andReturn(propertyIsDraft2);
-
     Property propertyUploaderEmail = createMock(Property.class);
     expect(propertyFactory.create("uploaderEmail", "testEmail1")).andReturn(propertyUploaderEmail);
 
@@ -446,8 +439,6 @@
     expected.add(propertyParents);
     expected.add(propertyDeletions);
     expected.add(propertyInsertions);
-    expected.add(propertyIsDraft);
-    expected.add(propertyIsDraft2);
     expected.add(propertyUploaderEmail);
     expected.add(propertyUploaderName);
     expected.add(propertyUploaderUsername);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
index 10cac7b..0b900c0 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
@@ -31,7 +31,6 @@
 import com.google.gerrit.server.events.ChangeMergedEvent;
 import com.google.gerrit.server.events.ChangeRestoredEvent;
 import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
 import com.google.gerrit.server.events.Event;
 import com.google.gerrit.server.events.PatchSetCreatedEvent;
 import com.google.gerrit.server.events.RefUpdatedEvent;
@@ -271,40 +270,6 @@
     eventHelper(event, "CommentAddedEvent", "comment-added", common, true);
   }
 
-  public void testDraftPublishedEvent() {
-    DraftPublishedEvent event = new DraftPublishedEvent(testChange("testProject", "testBranch"));
-
-    ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
-    event.change = Suppliers.ofInstance(changeAttribute);
-    Property propertyChange = createMock(Property.class);
-    expect(propertyAttributeExtractor.extractFrom(changeAttribute))
-        .andReturn(Sets.newHashSet(propertyChange));
-
-    AccountAttribute accountAttribute = createMock(AccountAttribute.class);
-    event.uploader = Suppliers.ofInstance(accountAttribute);
-    Property propertySubmitter = createMock(Property.class);
-    expect(propertyAttributeExtractor.extractFrom(accountAttribute, "uploader"))
-        .andReturn(Sets.newHashSet(propertySubmitter));
-
-    PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
-    event.patchSet = Suppliers.ofInstance(patchSetAttribute);
-    Property propertyPatchSet = createMock(Property.class);
-    expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
-        .andReturn(Sets.newHashSet(propertyPatchSet));
-
-    changeAttribute.project = "testProject";
-    changeAttribute.number = 176;
-    patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = 3;
-
-    Set<Property> common = Sets.newHashSet();
-    common.add(propertyChange);
-    common.add(propertySubmitter);
-    common.add(propertyPatchSet);
-
-    eventHelper(event, "DraftPublishedEvent", "draft-published", common, true);
-  }
-
   public void testPatchSetCreatedEvent() {
     PatchSetCreatedEvent event = new PatchSetCreatedEvent(testChange("testProject", "testBranch"));