Merge branch 'stable-3.4' into stable-3.5

* stable-3.4:
  Rename config.md to metrics.md
  Add the ability to fail healthcheck by creating a fail file

Change-Id: Ic07ffce0ce556b8c22b72a616acf11818b4cf520
diff --git a/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AuthHealthCheck.java b/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AuthHealthCheck.java
index ce9f8d9..c2b0f3e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AuthHealthCheck.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/healthcheck/check/AuthHealthCheck.java
@@ -36,6 +36,7 @@
   private final AccountCache byIdCache;
   private final String username;
   private final String password;
+  private final AuthRequest.Factory authRequestFactory;
 
   @Inject
   public AuthHealthCheck(
@@ -43,6 +44,7 @@
       HealthCheckConfig config,
       Realm realm,
       AccountCache byIdCache,
+      AuthRequest.Factory authRequestFactory,
       HealthCheckMetrics.Factory healthCheckMetricsFactory) {
     super(executor, config, AUTH, healthCheckMetricsFactory);
 
@@ -50,11 +52,12 @@
     this.byIdCache = byIdCache;
     this.username = config.getUsername(AUTH);
     this.password = config.getPassword(AUTH);
+    this.authRequestFactory = authRequestFactory;
   }
 
   @Override
   protected Result doCheck() throws Exception {
-    AuthRequest authRequest = AuthRequest.forUser(username);
+    AuthRequest authRequest = authRequestFactory.createForUser(username);
     authRequest.setPassword(password);
     realm.authenticate(authRequest);
 
diff --git a/src/resources/Documentation/metrics.md b/src/main/resources/Documentation/metrics.md
similarity index 100%
rename from src/resources/Documentation/metrics.md
rename to src/main/resources/Documentation/metrics.md
diff --git a/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java b/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java
index 3c0adae..5c1fd73 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/healthcheck/JGitHealthCheckTest.java
@@ -32,7 +32,7 @@
 import com.googlesource.gerrit.plugins.healthcheck.check.JGitHealthCheck;
 import java.io.IOException;
 import java.util.Collections;
-import java.util.SortedSet;
+import java.util.NavigableSet;
 import org.eclipse.jgit.errors.RepositoryNotFoundException;
 import org.eclipse.jgit.lib.CommitBuilder;
 import org.eclipse.jgit.lib.Constants;
@@ -102,6 +102,11 @@
     return new GitRepositoryManager() {
 
       @Override
+      public Status getRepositoryStatus(Project.NameKey name) {
+        return Status.ACTIVE;
+      }
+
+      @Override
       public Repository openRepository(Project.NameKey name)
           throws RepositoryNotFoundException, IOException {
         throw new RepositoryNotFoundException("Can't find repository " + name);
@@ -114,8 +119,8 @@
       }
 
       @Override
-      public SortedSet<Project.NameKey> list() {
-        return Collections.emptySortedSet();
+      public NavigableSet<Project.NameKey> list() {
+        return Collections.emptyNavigableSet();
       }
     };
   }