Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  Upgrade bazlets to latest stable-2.16 to build with 2.16.22 API

Change-Id: Id7ec16d0ac1344ea3516642916a2c47a6dbb36e8
diff --git a/.bazelversion b/.bazelversion
index fd2a018..47b322c 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-3.1.0
+3.4.1
diff --git a/WORKSPACE b/WORKSPACE
index 47e15d3..93c5b1c 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,24 +3,13 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "8ad33887665f4f6adf7cb465a03f6bd81b95e01d",
+    commit = "7a9ae377b519934c87184cc05845663ed708b69c",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
-# Snapshot Plugin API
-#load(
-#    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-#    "gerrit_api_maven_local",
-#)
-
-# Load snapshot Plugin API
-#gerrit_api_maven_local()
-
-# Release Plugin API
 load(
     "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
     "gerrit_api",
 )
 
-# Load release Plugin API
 gerrit_api()
diff --git a/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemon.java b/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemon.java
index 9115e0a..3def212 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemon.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemon.java
@@ -19,7 +19,6 @@
 import com.google.gerrit.extensions.registration.DynamicItem;
 import com.google.gerrit.server.events.EventDispatcher;
 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.util.Timer;
@@ -66,7 +65,7 @@
     public void run() {
       try {
         dispatcher.get().postEvent(new HeartbeatEvent());
-      } catch (OrmException | PermissionBackendException e) {
+      } catch (PermissionBackendException e) {
         logger.atSevere().withCause(e).log("Failed to post heartbeat event");
       }
     }
diff --git a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfigTest.java b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfigTest.java
index 08821a7..273fcc8 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfigTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfigTest.java
@@ -17,8 +17,6 @@
 import static org.junit.Assert.assertEquals;
 
 import com.google.gerrit.server.config.SitePaths;
-import com.google.gwtorm.client.KeyUtil;
-import com.google.gwtorm.server.StandardKeyEncoder;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -29,11 +27,6 @@
 import org.junit.Test;
 
 public class HeartbeatConfigTest {
-
-  static {
-    KeyUtil.setEncoderImpl(new StandardKeyEncoder());
-  }
-
   private SitePaths sitePaths;
   private HeartbeatConfig heartbeatConfig;
 
diff --git a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
index 90de35b..35c8347 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
@@ -24,21 +24,12 @@
 import static org.easymock.EasyMock.verify;
 
 import com.google.gerrit.extensions.registration.DynamicItem;
-import com.google.gerrit.reviewdb.server.ReviewDb;
 import com.google.gerrit.server.events.EventDispatcher;
-import com.google.gwtorm.client.KeyUtil;
-import com.google.gwtorm.server.SchemaFactory;
-import com.google.gwtorm.server.StandardKeyEncoder;
 import java.util.concurrent.TimeUnit;
 import org.junit.Before;
 import org.junit.Test;
 
 public class HeartbeatDaemonTest {
-
-  static {
-    KeyUtil.setEncoderImpl(new StandardKeyEncoder());
-  }
-
   private EventDispatcher eventDispatcherMock;
   private HeartbeatDaemon heartbeatDaemon;
 
@@ -53,9 +44,6 @@
     HeartbeatConfig heartbeatConfigMock = createMock(HeartbeatConfig.class);
     expect(heartbeatConfigMock.getDelay()).andReturn(1).anyTimes();
     replay(heartbeatConfigMock);
-    SchemaFactory<ReviewDb> schemaFactoryMock = createNiceMock(SchemaFactory.class);
-    expect(schemaFactoryMock.open()).andReturn(createNiceMock(ReviewDb.class)).anyTimes();
-    replay(schemaFactoryMock);
     heartbeatDaemon = new HeartbeatDaemon(dynamicEventDispatcherMock, heartbeatConfigMock);
   }
 
diff --git a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatIT.java b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatIT.java
index f537fa2..98d87ad 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatIT.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatIT.java
@@ -55,7 +55,7 @@
 
               @Override
               public CurrentUser getUser() {
-                return identifiedUserFactory.create(user.id);
+                return identifiedUserFactory.create(user.id());
               }
             });
     assertWithMessage("heartbeat event received")