Merge branch 'stable-3.4' into stable-3.5

* stable-3.4:
  Set version to 3.4.8.4
  Configure the set of refs prefixes to be ignored by the global-refdb
  Bump the global-refdb version to 3.4.8.3
  Make SharedRefDatabaseWrapper a singleton
  Add warning when the GlobalRefDatabase is not injected
  Bump the global-refdb version to 3.4.8.2
  Add default implementation for the global-refdb logger

Change-Id: Ic19d0234ad2531d63f05e2c8122ecc6f8ca0526a
diff --git a/pom.xml b/pom.xml
index 701a08b..990edc6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
 
     <groupId>com.gerritforge</groupId>
     <artifactId>global-refdb</artifactId>
-    <version>3.4.8.4</version>
+    <version>3.5.4.2</version>
     <packaging>jar</packaging>
 
     <name>global-refdb</name>
@@ -38,7 +38,7 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <gerrit.version>3.4.8</gerrit.version>
+        <gerrit.version>3.5.4</gerrit.version>
     </properties>
 
     <dependencies>
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManager.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManager.java
index 0e21338..763aeb4 100644
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManager.java
+++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManager.java
@@ -17,6 +17,7 @@
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.ImmutableSet;
 import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.Project.NameKey;
 import com.google.gerrit.server.git.GitRepositoryManager;
 import com.google.gerrit.server.git.LocalDiskRepositoryManager;
 import com.google.gerrit.server.git.RepositoryCaseMismatchException;
@@ -113,6 +114,16 @@
     return repositoryManager().list();
   }
 
+  @Override
+  public Boolean canPerformGC() {
+    return repositoryManager().canPerformGC();
+  }
+
+  @Override
+  public Status getRepositoryStatus(NameKey name) {
+    return repositoryManager().getRepositoryStatus(name);
+  }
+
   private Repository wrap(Project.NameKey projectName, Repository projectRepo) {
     return sharedRefDbRepoFactory.create(projectName.get(), projectRepo, ignoredRefs);
   }
diff --git a/src/test/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManagerTest.java b/src/test/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManagerTest.java
index a6c7667..d31aac0 100644
--- a/src/test/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManagerTest.java
+++ b/src/test/java/com/gerritforge/gerrit/globalrefdb/validation/SharedRefDbGitRepositoryManagerTest.java
@@ -14,17 +14,20 @@
 
 package com.gerritforge.gerrit.globalrefdb.validation;
 
+import static com.google.common.truth.Truth.assertThat;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 
 import com.gerritforge.gerrit.globalrefdb.validation.dfsrefdb.RefFixture;
 import com.google.common.collect.ImmutableSet;
+import com.google.gerrit.server.git.GitRepositoryManager;
 import com.google.gerrit.server.git.LocalDiskRepositoryManager;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.TypeLiteral;
 import com.google.inject.name.Names;
+import java.util.Collections;
 import org.eclipse.jgit.lib.Repository;
 import org.junit.Before;
 import org.junit.Test;
@@ -110,6 +113,33 @@
     verifyThatSharedRefDbRepositoryWrapperHasBeenCreated(IGNORED_REFS);
   }
 
+  @Test
+  public void canPerformGCShouldDelegateToLocalDiskRepositoryManager() {
+    doReturn(true).when(localDiskRepositoryManagerMock).canPerformGC();
+
+    assertThat(msRepoMgr.canPerformGC()).isTrue();
+    verify(localDiskRepositoryManagerMock).canPerformGC();
+  }
+
+  @Test
+  public void getRepositoryStatusShouldDelegateToLocalDiskRepositoryManager() {
+    doReturn(GitRepositoryManager.Status.ACTIVE)
+        .when(localDiskRepositoryManagerMock)
+        .getRepositoryStatus(A_TEST_PROJECT_NAME_KEY);
+
+    assertThat(msRepoMgr.getRepositoryStatus(A_TEST_PROJECT_NAME_KEY))
+        .isEqualTo(GitRepositoryManager.Status.ACTIVE);
+    verify(localDiskRepositoryManagerMock).getRepositoryStatus(A_TEST_PROJECT_NAME_KEY);
+  }
+
+  @Test
+  public void listShouldDelegateToLocalDiskRepositoryManager() {
+    doReturn(Collections.emptySortedSet()).when(localDiskRepositoryManagerMock).list();
+
+    assertThat(msRepoMgr.list()).isEqualTo(Collections.emptySortedSet());
+    verify(localDiskRepositoryManagerMock).list();
+  }
+
   private Injector getInjector(ImmutableSet<String> ignoredRefs) {
     return Guice.createInjector(
         new AbstractModule() {