Merge branch 'stable-2.13'

* stable-2.13:
  Use path.toFile().exists() instead of Files.exists(path)
  Fix possible NPE flagged by SonarQube

Change-Id: I34a90f9f26b80a884e393f8c47e94bb9dec70b5c
diff --git a/.buckconfig b/.buckconfig
index 5c0ead0..b8cdcdb 100644
--- a/.buckconfig
+++ b/.buckconfig
@@ -6,6 +6,8 @@
 [java]
   jar_spool_mode = direct_to_jar
   src_roots = java, resources
+  source_level = 8
+  target_level = 8
 
 [project]
   ignore = .git, eclipse-out/
diff --git a/BUCK b/BUCK
index 8232c2b..fd220a9 100644
--- a/BUCK
+++ b/BUCK
@@ -9,6 +9,12 @@
   ':high-availability__plugin',
   ':mockito',
   ':wiremock',
+# bazlets include those 3 bouncycastle jars in plugin API so this is temporary
+# until this plugin is built with bazel.
+# see https://gerrit-review.googlesource.com/#/c/102670/ for more info.
+  ':bouncycastle_bcprov',
+  ':bouncycastle_bcpg',
+  ':bouncycastle_bcpkix',
 ]
 
 gerrit_plugin(
@@ -79,3 +85,23 @@
   license = 'DO_NOT_DISTRIBUTE',
   attach_source = False,
 )
+
+BC_VERS = '1.56'
+
+maven_jar(
+  name = 'bouncycastle_bcprov',
+  id = 'org.bouncycastle:bcprov-jdk15on:' + BC_VERS,
+  sha1 = 'a153c6f9744a3e9dd6feab5e210e1c9861362ec7',
+)
+
+maven_jar(
+  name = 'bouncycastle_bcpg',
+  id = 'org.bouncycastle:bcpg-jdk15on:' + BC_VERS,
+  sha1 = '9c3f2e7072c8cc1152079b5c25291a9f462631f1',
+)
+
+maven_jar(
+  name = 'bouncycastle_bcpkix',
+  id = 'org.bouncycastle:bcpkix-jdk15on:' + BC_VERS,
+  sha1 = '4648af70268b6fdb24674fb1fd7c1fcc73db1231',
+)
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
index 8a21820..8d5f0e9 100644
--- a/lib/gerrit/BUCK
+++ b/lib/gerrit/BUCK
@@ -1,12 +1,11 @@
 include_defs('//bucklets/maven_jar.bucklet')
 
-VER = '2.13.6'
-REPO = MAVEN_CENTRAL
+VER = '2.14-SNAPSHOT'
+REPO = MAVEN_LOCAL
 
 maven_jar(
   name = 'acceptance-framework',
   id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
-  sha1 = '53a5ffbc3ce6842b7145fd11abcc1dc8503b124f',
   license = 'Apache2.0',
   attach_source = False,
   repository = REPO,
@@ -15,7 +14,6 @@
 maven_jar(
   name = 'plugin-api',
   id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
-  sha1 = '1a5d650c72ebc36f4ad522d5481d5ed690bec8bf',
   license = 'Apache2.0',
   attach_source = False,
   repository = REPO,
diff --git a/src/test/java/com/ericsson/gerrit/plugins/highavailability/cache/CacheEvictionIT.java b/src/test/java/com/ericsson/gerrit/plugins/highavailability/cache/CacheEvictionIT.java
index 7e13e37..6eef10c 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/highavailability/cache/CacheEvictionIT.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/highavailability/cache/CacheEvictionIT.java
@@ -23,9 +23,10 @@
 import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
 
 import com.google.gerrit.acceptance.GerritConfig;
-import com.google.gerrit.acceptance.GerritConfigs;
+import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
 import com.google.gerrit.acceptance.NoHttpd;
-import com.google.gerrit.acceptance.PluginDaemonTest;
+import com.google.gerrit.acceptance.TestPlugin;
+import com.google.gerrit.acceptance.UseSsh;
 
 import com.github.tomakehurst.wiremock.http.Request;
 import com.github.tomakehurst.wiremock.http.RequestListener;
@@ -39,15 +40,22 @@
 import java.util.concurrent.TimeUnit;
 
 @NoHttpd
-public class CacheEvictionIT extends PluginDaemonTest {
+@UseSsh
+@TestPlugin(
+    name = "high-availability",
+    sysModule = "com.ericsson.gerrit.plugins.highavailability.Module",
+    httpModule = "com.ericsson.gerrit.plugins.highavailability.HttpModule"
+)
+public class CacheEvictionIT extends LightweightPluginDaemonTest {
+  private static final int PORT = 18888;
+  private static final String URL = "http://localhost:" + PORT;
 
   @Rule
-  public WireMockRule wireMockRule = new WireMockRule(options().port(18888), false);
+  public WireMockRule wireMockRule = new WireMockRule(options().port(PORT), false);
 
   @Test
-  @GerritConfigs({
-      @GerritConfig(name = "plugin.high-availability.url", value = "http://localhost:18888"),
-      @GerritConfig(name = "plugin.high-availability.user", value = "admin")})
+  @GerritConfig(name = "plugin.high-availability.url", value = URL)
+  @GerritConfig(name = "plugin.high-availability`.user", value = "admin")
   public void flushAndSendPost() throws Exception {
     final String flushRequest =
         "/plugins/high-availability/cache/" + Constants.PROJECT_LIST;