Merge branch 'stable-2.15' into stable-2.16

* stable-2.15:
  Upgrade bazlets to latest stable-2.14 to build with 2.14.20 API

Change-Id: I9dcd0fbfb2f96bba274b3f73616a51954a7d348a
diff --git a/WORKSPACE b/WORKSPACE
index 1c29a45..89eeeb3 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "8386b3fbf80e375f0a10c8386c0a8dfe260c5c1b",
+    commit = "c827ba79413585ab9dfc1bbd0d7f609eedd6aa80",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
diff --git a/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfig.java b/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfig.java
index 4031a4e..24d30e0 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfig.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatConfig.java
@@ -14,6 +14,7 @@
 
 package com.ericsson.gerrit.plugins.heartbeat;
 
+import com.google.common.flogger.FluentLogger;
 import com.google.gerrit.server.config.SitePaths;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -22,13 +23,11 @@
 import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.util.FS;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /** Plugin-specific config file data loader and holder. */
 @Singleton
 public class HeartbeatConfig {
-  private static final Logger logger = LoggerFactory.getLogger(HeartbeatConfig.class);
+  private static final FluentLogger logger = FluentLogger.forEnclosingClass();
 
   public static final int DEFAULT_DELAY = 15000;
   public static final String DELAY_KEY = "delay";
@@ -52,7 +51,7 @@
   private void load(File configPath) throws ConfigInvalidException, IOException {
     FileBasedConfig cfg = new FileBasedConfig(configPath, FS.DETECTED);
     if (!cfg.getFile().exists() || cfg.getFile().length() == 0) {
-      logger.debug("No {} or empty; using all default values", cfg.getFile());
+      logger.atFine().log("No %s or empty; using all default values", cfg.getFile());
       return;
     }
 
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 7752993..9115e0a 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemon.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemon.java
@@ -14,23 +14,22 @@
 
 package com.ericsson.gerrit.plugins.heartbeat;
 
-import com.google.gerrit.common.EventDispatcher;
+import com.google.common.flogger.FluentLogger;
 import com.google.gerrit.extensions.events.LifecycleListener;
 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;
 import java.util.TimerTask;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /** Timer-based daemon doing the actual heartbeat task. */
 @Singleton
 public class HeartbeatDaemon implements LifecycleListener {
 
-  private static final Logger logger = LoggerFactory.getLogger(HeartbeatDaemon.class);
+  private static final FluentLogger logger = FluentLogger.forEnclosingClass();
   private static final String HEARTBEAT_THREAD_NAME = "StreamEventHeartbeat";
   private final DynamicItem<EventDispatcher> dispatcher;
   private final HeartbeatConfig config;
@@ -52,13 +51,14 @@
   @Override
   public void start() {
     timer.schedule(new HeartbeatTask(), 0, config.getDelay());
-    logger.info("Initialized to send heartbeat event every {} milliseconds", config.getDelay());
+    logger.atInfo().log(
+        "Initialized to send heartbeat event every %d milliseconds", config.getDelay());
   }
 
   @Override
   public void stop() {
     timer.cancel();
-    logger.info("Stopped sending heartbeat event");
+    logger.atInfo().log("Stopped sending heartbeat event");
   }
 
   private class HeartbeatTask extends TimerTask {
@@ -67,7 +67,7 @@
       try {
         dispatcher.get().postEvent(new HeartbeatEvent());
       } catch (OrmException | PermissionBackendException e) {
-        logger.error("Failed to post heartbeat event: {}", e.getMessage(), e);
+        logger.atSevere().withCause(e).log("Failed to post heartbeat event");
       }
     }
   }
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 765daac..90de35b 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatDaemonTest.java
@@ -23,9 +23,9 @@
 import static org.easymock.EasyMock.reset;
 import static org.easymock.EasyMock.verify;
 
-import com.google.gerrit.common.EventDispatcher;
 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;
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 1b53bcd..f537fa2 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatIT.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/heartbeat/HeartbeatIT.java
@@ -21,11 +21,11 @@
 import com.google.gerrit.acceptance.NoHttpd;
 import com.google.gerrit.acceptance.TestPlugin;
 import com.google.gerrit.acceptance.UseLocalDisk;
-import com.google.gerrit.common.UserScopedEventListener;
 import com.google.gerrit.extensions.registration.DynamicSet;
 import com.google.gerrit.extensions.registration.RegistrationHandle;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.events.Event;
+import com.google.gerrit.server.events.UserScopedEventListener;
 import com.google.inject.Inject;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -44,6 +44,7 @@
     CountDownLatch expectedEventLatch = new CountDownLatch(1);
     RegistrationHandle handle =
         eventListeners.add(
+            "heartbeat",
             new UserScopedEventListener() {
               @Override
               public void onEvent(Event event) {