Merge branch 'stable-2.13' into stable-2.14

* stable-2.13:
  Add configurable support for in-progress status
  Add config option to control jobs panel position
  Add config option for panels jobs ordering

Change-Id: I90c7d4faa2275f00be715c345075e557ada220b5
diff --git a/.buckconfig b/.buckconfig
deleted file mode 100644
index 0941191..0000000
--- a/.buckconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-[alias]
-  verify-status = //:verify-status
-  plugin = //:verify-status
-
-[java]
-  src_roots = java, resources
-
-[project]
-  ignore = .git
-
-[cache]
-  mode = dir
-  dir = buck-out/cache
diff --git a/.gitignore b/.gitignore
index 5e2d355..737b856 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,8 @@
 .buckversion
 .watchmanconfig
 /bucklets
+bazel-bin
+bazel-genfiles
+bazel-out
+bazel-testlogs
+bazel-verify-status
diff --git a/BUCK b/BUCK
deleted file mode 100644
index ea66a49..0000000
--- a/BUCK
+++ /dev/null
@@ -1,39 +0,0 @@
-include_defs('//bucklets/gerrit_plugin.bucklet')
-
-MODULE = 'com.googlesource.gerrit.plugins.verifystatus.VerifyStatusForm'
-
-gerrit_plugin(
-  name = 'verify-status',
-  srcs = glob(['src/main/java/**/*.java']),
-  resources = glob(['src/main/**/*']),
-  gwt_module = MODULE,
-  manifest_entries = [
-    'Gerrit-PluginName: verify-status',
-    'Gerrit-Module: com.googlesource.gerrit.plugins.verifystatus.GlobalModule',
-    'Gerrit-HttpModule: com.googlesource.gerrit.plugins.verifystatus.HttpModule',
-    'Gerrit-SshModule: com.googlesource.gerrit.plugins.verifystatus.SshModule',
-    'Gerrit-InitStep: com.googlesource.gerrit.plugins.verifystatus.init.InitPlugin',
-    'Implementation-Title: Verify Status Plugin',
-    'Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/verify-status',
-  ],
-  provided_deps = [
-    '//lib/commons:dbcp',
-  ]
-)
-
-java_test(
-  name = 'verify-status_tests',
-  srcs = glob(['src/test/java/**/*IT.java']),
-  labels = ['verify-status'],
-  source_under_test = [':verify-status__plugin'],
-  deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
-    ':verify-status__plugin',
-  ],
-)
-
-java_library(
-  name = 'classpath',
-  deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
-    ':verify-status__plugin'
-  ],
-)
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..71c2c0d
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,36 @@
+load(
+    "//tools/bzl:plugin.bzl",
+    "gerrit_plugin",
+    "PLUGIN_DEPS",
+    "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+    name = "verify-status",
+    srcs = glob(["src/main/java/**/*.java"]),
+    gwt_module = "com.googlesource.gerrit.plugins.verifystatus.VerifyStatusForm",
+    manifest_entries = [
+        "Gerrit-PluginName: verify-status",
+        "Gerrit-Module: com.googlesource.gerrit.plugins.verifystatus.GlobalModule",
+        "Gerrit-HttpModule: com.googlesource.gerrit.plugins.verifystatus.HttpModule",
+        "Gerrit-SshModule: com.googlesource.gerrit.plugins.verifystatus.SshModule",
+        "Gerrit-InitStep: com.googlesource.gerrit.plugins.verifystatus.init.InitPlugin",
+        "Implementation-Title: Verify Status Plugin",
+        "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/verify-status",
+    ],
+    provided_deps = [
+        "@commons_dbcp//jar:neverlink",
+    ],
+    resources = glob(["src/main/**/*"]),
+)
+
+java_test(
+    name = "verify-status-tests",
+    size = "small",
+    srcs = ["src/test/java/com/googlesource/gerrit/plugins/verifystatus/VerifyStatusIT.java"],
+    test_class = "com.googlesource.gerrit.plugins.verifystatus.VerifyStatusIT",
+    tags = ["verify-status"],
+    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+        ":verify-status__plugin",
+    ],
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..65c1637
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,40 @@
+workspace(name = "verify_status")
+
+load("//:bazlets.bzl", "load_bazlets")
+
+load_bazlets(
+    commit = "696f59e1b591c23469433cd7a8e5933c738682c5",
+    # local_path = "/home/<user>/projects/bazlets",
+)
+
+# Snapshot Plugin API
+load(
+    "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
+    "gerrit_api_maven_local",
+)
+
+# Release Plugin API
+#load(
+#    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
+#    "gerrit_api",
+#)
+load(
+    "@com_googlesource_gerrit_bazlets//:gerrit_gwt.bzl",
+    "gerrit_gwt",
+)
+
+# Load release Plugin API
+#gerrit_api()
+
+# Load snapshot Plugin API
+gerrit_api_maven_local()
+
+gerrit_gwt()
+
+load("@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", "maven_jar")
+
+maven_jar(
+    name = "commons_dbcp",
+    artifact = "commons-dbcp:commons-dbcp:1.4",
+    sha1 = "30be73c965cc990b153a100aaaaafcf239f82d39",
+)
diff --git a/bazlets.bzl b/bazlets.bzl
new file mode 100644
index 0000000..e14e488
--- /dev/null
+++ b/bazlets.bzl
@@ -0,0 +1,17 @@
+NAME = "com_googlesource_gerrit_bazlets"
+
+def load_bazlets(
+    commit,
+    local_path = None
+  ):
+  if not local_path:
+      native.git_repository(
+          name = NAME,
+          remote = "https://gerrit.googlesource.com/bazlets",
+          commit = commit,
+      )
+  else:
+      native.local_repository(
+          name = NAME,
+          path = local_path,
+      )
diff --git a/lib/commons/BUCK b/lib/commons/BUCK
deleted file mode 100644
index 774de13..0000000
--- a/lib/commons/BUCK
+++ /dev/null
@@ -1,14 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-maven_jar(
-  name = 'dbcp',
-  id = 'commons-dbcp:commons-dbcp:1.4',
-  sha1 = '30be73c965cc990b153a100aaaaafcf239f82d39',
-  license = 'Apache2.0',
-  exclude = [
-    'META-INF/LICENSE.txt',
-    'META-INF/NOTICE.txt',
-    'testpool.jocl'
-  ],
-)
-
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
deleted file mode 100644
index 563d710..0000000
--- a/lib/gerrit/BUCK
+++ /dev/null
@@ -1,28 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-VER = '2.13-SNAPSHOT'
-REPO = MAVEN_LOCAL
-
-maven_jar(
-  name = 'plugin-api',
-  id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
-  license = 'Apache2.0',
-  attach_source = False,
-  repository = REPO,
-)
-
-maven_jar(
-  name = 'gwtui-api',
-  id = 'com.google.gerrit:gerrit-plugin-gwtui:' + VER,
-  license = 'Apache2.0',
-  attach_source = False,
-  repository = REPO,
-)
-
-maven_jar(
-  name = 'acceptance-framework',
-  id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
-  license = 'Apache2.0',
-  attach_source = False,
-  repository = REPO,
-)
diff --git a/lib/gwt/BUCK b/lib/gwt/BUCK
deleted file mode 100644
index b8d9491..0000000
--- a/lib/gwt/BUCK
+++ /dev/null
@@ -1,34 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-VERSION = '2.7.0'
-
-maven_jar(
-  name = 'user',
-  id = 'com.google.gwt:gwt-user:' + VERSION,
-  sha1 = 'bdc7af42581745d3d79c2efe0b514f432b998a5b',
-  license = 'Apache2.0',
-  attach_source = False,
-)
-
-maven_jar(
-  name = 'dev',
-  id = 'com.google.gwt:gwt-dev:' + VERSION,
-  sha1 = 'c2c3dd5baf648a0bb199047a818be5e560f48982',
-  license = 'Apache2.0',
-  deps = [
-    ':javax-validation',
-    ':javax-validation_src',
-  ],
-  attach_source = False,
-  exclude = ['org/eclipse/jetty/*'],
-)
-
-maven_jar(
-  name = 'javax-validation',
-  id = 'javax.validation:validation-api:1.0.0.GA',
-  bin_sha1 = 'b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e',
-  src_sha1 = '7a561191db2203550fbfa40d534d4997624cd369',
-  license = 'Apache2.0',
-  visibility = [],
-)
-
diff --git a/lib/ow2/BUCK b/lib/ow2/BUCK
deleted file mode 100644
index db6c76c..0000000
--- a/lib/ow2/BUCK
+++ /dev/null
@@ -1,32 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-VERSION = '5.0.3'
-
-maven_jar(
-  name = 'ow2-asm',
-  id = 'org.ow2.asm:asm:' + VERSION,
-  sha1 = 'dcc2193db20e19e1feca8b1240dbbc4e190824fa',
-  license = 'ow2',
-)
-
-maven_jar(
-  name = 'ow2-asm-analysis',
-  id = 'org.ow2.asm:asm-analysis:' + VERSION,
-  sha1 = 'c7126aded0e8e13fed5f913559a0dd7b770a10f3',
-  license = 'ow2',
-)
-
-maven_jar(
-  name = 'ow2-asm-tree',
-  id = 'org.ow2.asm:asm-tree:' + VERSION,
-  sha1 = '287749b48ba7162fb67c93a026d690b29f410bed',
-  license = 'ow2',
-)
-
-maven_jar(
-  name = 'ow2-asm-util',
-  id = 'org.ow2.asm:asm-util:' + VERSION,
-  sha1 = '1512e5571325854b05fb1efce1db75fcced54389',
-  license = 'ow2',
-)
-
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 05167b0..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-<!--
-Copyright (C) 2016 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>com.googlesource.gerrit.plugins</groupId>
-  <artifactId>verify-status</artifactId>
-  <packaging>jar</packaging>
-  <version>2.13-SNAPSHOT</version>
-  <name>Gerrit Verify Status Plugin</name>
-
-  <properties>
-    <Gerrit-ApiType>plugin</Gerrit-ApiType>
-    <Gerrit-ApiVersion>${project.version}</Gerrit-ApiVersion>
-  </properties>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.4</version>
-        <configuration>
-          <includes>
-            <include>**/*.*</include>
-          </includes>
-          <archive>
-            <manifestEntries>
-              <Gerrit-PluginName>verify-status</Gerrit-PluginName>
-              <Gerrit-Module>com.googlesource.gerrit.plugins.verifystatus.GlobalModule</Gerrit-Module>
-              <Gerrit-HttpModule>com.googlesource.gerrit.plugins.verifystatus.HttpModule</Gerrit-HttpModule>
-              <Gerrit-SshModule>com.googlesource.gerrit.plugins.verifystatus.SshModule</Gerrit-SshModule>
-              <Gerrit-InitStep>com.googlesource.gerrit.plugins.verifystatus.init.InitPlugin</Gerrit-InitStep>
-              <Implementation-Vendor>Gerrit Code Review</Implementation-Vendor>
-              <Implementation-URL>https://gerrit-review.googlesource.com/#/admin/projects/plugins/verify-status</Implementation-URL>
-
-              <Implementation-Title>${project.artifactId} ${Gerrit-ApiType}</Implementation-Title>
-              <Implementation-Version>${project.version}</Implementation-Version>
-
-              <Gerrit-ApiType>${Gerrit-ApiType}</Gerrit-ApiType>
-              <Gerrit-ApiVersion>${Gerrit-ApiVersion}</Gerrit-ApiVersion>
-            </manifestEntries>
-          </archive>
-        </configuration>
-      </plugin>
-
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.3.2</version>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-          <encoding>UTF-8</encoding>
-        </configuration>
-      </plugin>
-
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>gwt-maven-plugin</artifactId>
-        <version>2.7.0</version>
-        <configuration>
-          <module>com.googlesource.gerrit.plugins.verifystatus.VerifyStatusForm</module>
-          <disableClassMetadata>true</disableClassMetadata>
-          <disableCastChecking>true</disableCastChecking>
-          <webappDirectory>${project.build.directory}/classes/static</webappDirectory>
-        </configuration>
-        <executions>
-          <execution>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
- 
- <!--
- Maven IT tests is failing so commenting out for now.
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-failsafe-plugin</artifactId>
-        <version>2.19.1</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>integration-test</goal>
-              <goal>verify</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
--->
-
-    </plugins>
-  </build>
-
-  <dependencies>
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-${Gerrit-ApiType}-api</artifactId>
-      <version>${Gerrit-ApiVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-plugin-gwtui</artifactId>
-      <version>${Gerrit-ApiVersion}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.gwt</groupId>
-      <artifactId>gwt-user</artifactId>
-      <version>2.7.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.truth</groupId>
-      <artifactId>truth</artifactId>
-      <version>0.27</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.gerrit</groupId>
-      <artifactId>gerrit-acceptance-framework</artifactId>
-      <version>${Gerrit-ApiVersion}</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <repositories>
-    <repository>
-      <id>maven.org</id>
-      <url>http://repo1.maven.org/maven2</url>
-    </repository>
-    <repository>
-      <id>snapshot-repository</id>
-      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
-    </repository>
-  </repositories>
-</project>
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index b3a336a..46f11b1 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,9 +1,9 @@
 @PLUGIN@ Build
 ==============
 
-This plugin can be built with Buck or Maven.
+This plugin can be built with Bazel.
 
-Buck
+Bazel
 ----
 
 Two build modes are supported: Standalone and in Gerrit tree.
@@ -12,46 +12,22 @@
 
 ### Build standalone
 
-Clone bucklets library:
-
-```
-  git clone https://gerrit.googlesource.com/bucklets
-
-```
-and link it to @PLUGIN@ plugin directory:
-
-```
-  cd @PLUGIN@ && ln -s ../bucklets .
-```
-
-Add link to the .buckversion file:
-
-```
-  cd @PLUGIN@ && ln -s bucklets/buckversion .buckversion
-```
-
-Add link to the .watchmanconfig file:
-```
-  cd @PLUGIN@ && ln -s bucklets/watchmanconfig .watchmanconfig
-```
-
 To build the plugin, issue the following command:
 
-
 ```
-  buck build plugin
+  bazel build verify-status
 ```
 
 The output is created in
 
 ```
-  buck-out/gen/@PLUGIN@.jar
+  bazel-genfiles/@PLUGIN@.jar
 ```
 
 To execute the tests run:
 
 ```
-  buck test
+  bazel test verify_status_tests
 ```
 
 ### Build in Gerrit tree
@@ -60,41 +36,36 @@
 tree, and issue the command:
 
 ```
-  buck build plugins/@PLUGIN@
+  bazel build plugins/@PLUGIN@
 ```
 
 The output is created in
 
 ```
-  buck-out/gen/plugins/@PLUGIN@/@PLUGIN@.jar
+  bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
 ```
 
-This project can be imported into the Eclipse IDE:
+This project can be imported into the Eclipse IDE. List the plugin in the
+custom plugin list, in `gerrit/tools/bzl/plugins.bzl`:
 
 ```
-  ./tools/eclipse/project.py
+CUSTOM_PLUGINS = [
+  [...]
+  'verify-status',
+]
+```
+
+and issue the command:
+
+```
+  ./tools/eclipse/project_bzl.py
 ```
 
 To execute the tests run:
 
 ```
-  buck test --include @PLUGIN@
+  bazel test plugins/verify-status:verify_status_tests
 ```
 
-Maven
------
-
-Note that for compatibility reasons a Maven build is provided, but is considered
-to be deprecated and will be removed in a future version of this plugin.
-
-To build with Maven, change directory to the plugin folder and issue the
-command:
-
-```
-  mvn clean package
-```
-
-When building with Maven, the Gerrit Plugin API must be available.
-
 How to build the Gerrit Plugin API is described in the [Gerrit
-documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files).
+documentation](../../../Documentation/dev-bazel.html#_extension_and_plugin_api_jar_files).
diff --git a/src/main/resources/Documentation/database.md b/src/main/resources/Documentation/database.md
index 751b8d5..f45ae2d 100644
--- a/src/main/resources/Documentation/database.md
+++ b/src/main/resources/Documentation/database.md
@@ -71,7 +71,7 @@
 ### <a id="supported-dbs"> @PLUGIN@ supported databases
  * H2
  * Apache Derby
- * MySQL
+ * [MySQL](mysql-setup-example.md)
  * Oracle
  * PostgreSQL
 
@@ -122,6 +122,7 @@
 SEE ALSO
 --------
 
+* [Example Mysql Setup](mysql-setup-example.md)
 * [Database Setup](../../../Documentation/database-setup.html)
 * [Automatic Site Initialization](../../../Documentation/config-auto-site-initialization.html)
 * [Database Settings](../../../Documentation/config-gerrit.html#database)
diff --git a/src/main/resources/Documentation/mysql-setup-example.md b/src/main/resources/Documentation/mysql-setup-example.md
new file mode 100644
index 0000000..cf6301f
--- /dev/null
+++ b/src/main/resources/Documentation/mysql-setup-example.md
@@ -0,0 +1,98 @@
+# MySql example
+
+This is an example of how to install a fresh Gerrit with verify-status plugin.
+
+Create initial site (without verify-status)
+-------------------------------------------
+
+```
+  java -jar gerrit-stable-2.13.war init --batch --no-auto-start --install-all-plugins -d mysite
+```
+
+  *NOTE - This will create an H2 db for gerrit.
+
+
+Install verify status plugin
+----------------------------
+
+Copy verify-status.jar to mysite/plugins folder
+
+
+Setup MySql DB
+--------------
+
+```
+CREATE USER 'gerrit2'@'localhost' IDENTIFIED BY 'secret';
+create database reviewdb;
+GRANT ALL ON reviewdb.* TO 'gerrit2'@'localhost';
+create database cidata;
+GRANT ALL ON cidata.* TO 'gerrit2'@'localhost';
+FLUSH PRIVILEGES;
+```
+
+Update gerrit config
+--------------------
+
+Add the following to etc/gerrit.config file
+
+```
+[database]
+  type = mysql
+  database = reviewdb
+  username = gerrit2
+  password = secret
+  hostname = localhost
+
+[plugin "verify-status"]
+  dbType = mysql
+  database = cidata
+  username = gerrit2
+  password = secret
+  hostname = localhost
+```
+
+Delete git repos
+----------------
+
+*NOTE* - only do this if you've change reviewdb from H2 to mysql otherwise you may get the following error
+
+```
+ Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot initialize schema
+	at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:104)
+	at com.google.gerrit.pgm.init.BaseInit$SiteRun.upgradeSchema(BaseInit.java:367)
+	at com.google.gerrit.pgm.init.BaseInit.run(BaseInit.java:133)
+	at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
+	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+	at java.lang.reflect.Method.invoke(Method.java:606)
+	at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:163)
+	at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:104)
+	at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:59)
+	at Main.main(Main.java:25)
+ Caused by: java.io.IOException: Cannot update refs/meta/config in /Users/zaro0508/work-gerrit/gerrit-213/mysite/git/All-Projects.git: LOCK_FAILURE
+	at com.google.gerrit.server.git.VersionedMetaData$1.updateRef(VersionedMetaData.java:436)
+	at com.google.gerrit.server.git.VersionedMetaData$1.createRef(VersionedMetaData.java:335)
+	at com.google.gerrit.server.git.VersionedMetaData.commitToNewRef(VersionedMetaData.java:217)
+	at com.google.gerrit.server.schema.AllProjectsCreator.initAllProjects(AllProjectsCreator.java:180)
+	at com.google.gerrit.server.schema.AllProjectsCreator.create(AllProjectsCreator.java:100)
+	at com.google.gerrit.server.schema.SchemaCreator.create(SchemaCreator.java:86)
+	at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:102)
+	... 11 more
+```
+
+The 1st run of init syncs the git repos to H2 DB.  Now we want to setup git repos with mysql reviewdb.  We are setting
+up a new reviewdb this time so we need to sync with new git repos. Delete and next step will create new repos.
+
+```
+ rm -rf mysite/git/*
+```
+
+Setup Db tables for verify status
+----------------------------------
+
+Rerun init to setup tables for reviewdb and cidata
+
+```
+ java -jar gerrit-stable-2.13.war init --batch --no-auto-start --install-all-plugins -d mysite
+```
diff --git a/src/test/java/com/googlesource/gerrit/plugins/verifystatus/VerifyStatusIT.java b/src/test/java/com/googlesource/gerrit/plugins/verifystatus/VerifyStatusIT.java
index 3191401..dcdf255 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/verifystatus/VerifyStatusIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/verifystatus/VerifyStatusIT.java
@@ -18,9 +18,12 @@
 import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
 
 import com.google.common.collect.Iterables;
-import com.google.gerrit.acceptance.PluginDaemonTest;
+import com.google.gerrit.acceptance.GerritConfig;
+import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
 import com.google.gerrit.acceptance.PushOneCommit.Result;
 import com.google.gerrit.acceptance.RestResponse;
+import com.google.gerrit.acceptance.TestPlugin;
+import com.google.gerrit.acceptance.UseLocalDisk;
 import com.google.gson.reflect.TypeToken;
 import com.google.gwtorm.jdbc.SimpleDataSource;
 
@@ -36,7 +39,18 @@
 import java.util.Map;
 import java.util.Properties;
 
-public class VerifyStatusIT extends PluginDaemonTest {
+@TestPlugin(
+    name = "verify-status",
+    sysModule = "com.googlesource.gerrit.plugins.verifystatus.GlobalModule",
+    httpModule = "com.googlesource.gerrit.plugins.verifystatus.HttpModule",
+    sshModule = "com.googlesource.gerrit.plugins.verifystatus.SshModule"
+)
+public class VerifyStatusIT extends LightweightPluginDaemonTest {
+  private final static String NAME = "verify-status";
+  private final static String DB_TYPE_CONFIG = "plugin." + NAME + ".dbType";
+  private final static String DB_URL_CONFIG = "plugin." + NAME + ".dbUrl";
+  private final static String H2 = "h2";
+  private final static String URL = "jdbc:h2:mem:TestCiDB;DB_CLOSE_DELAY=-1";
   private final static String TABLE = "PATCH_SET_VERIFICATIONS";
   private static final String CREATE_TABLE =
       "CREATE       TABLE IF NOT EXISTS " + TABLE + " (" +
@@ -56,14 +70,16 @@
   private static final String DELETE_TABLE =
       "DELETE FROM " + TABLE;
 
+  @Before
   @Override
-  protected void beforeTestServerStarts() throws Exception {
-    String url = "jdbc:h2:mem:TestCiDB;DB_CLOSE_DELAY=-1";
+  public void setUp() throws Exception {
+    super.setUp();
+    allowGlobalCapabilities(REGISTERED_USERS,
+        SaveReportCapability.getName(NAME));
+
     Properties p = new Properties();
     p.setProperty("driver", "org.h2.Driver");
-    p.setProperty("url", url);
-    setPluginConfigString("dbType", "h2");
-    setPluginConfigString("dbUrl", url);
+    p.setProperty("url", URL);
 
     SimpleDataSource sds = new SimpleDataSource(p);
     try (Connection c = sds.getConnection();
@@ -74,13 +90,10 @@
     }
   }
 
-  @Before
-  public void setUp() throws Exception {
-    allowGlobalCapabilities(REGISTERED_USERS,
-        SaveReportCapability.getName(pluginName));
-  }
-
   @Test
+  @GerritConfig(name = DB_TYPE_CONFIG, value = H2)
+  @GerritConfig(name = DB_URL_CONFIG, value = URL)
+  @UseLocalDisk
   public void noVerificationTest() throws Exception {
     Result c = createChange();
     Map<String, VerificationInfo> infos = getVerifications(c, null);
@@ -88,6 +101,9 @@
   }
 
   @Test
+  @GerritConfig(name = DB_TYPE_CONFIG, value = H2)
+  @GerritConfig(name = DB_URL_CONFIG, value = URL)
+  @UseLocalDisk
   public void verificationOneTest() throws Exception {
     VerifyInput in = new VerifyInput();
     in.verifications = new HashMap<>();
@@ -113,6 +129,9 @@
   }
 
   @Test
+  @GerritConfig(name = DB_TYPE_CONFIG, value = H2)
+  @GerritConfig(name = DB_URL_CONFIG, value = URL)
+  @UseLocalDisk
   public void verificationTwoTest() throws Exception {
     VerifyInput in = new VerifyInput();
     in.verifications = new HashMap<>();
@@ -147,6 +166,9 @@
   }
 
   @Test
+  @GerritConfig(name = DB_TYPE_CONFIG, value = H2)
+  @GerritConfig(name = DB_URL_CONFIG, value = URL)
+  @UseLocalDisk
   public void verificationTestNullReporter() throws Exception {
     VerifyInput in = new VerifyInput();
     in.verifications = new HashMap<>();
diff --git a/tools/bazel.rc b/tools/bazel.rc
new file mode 100644
index 0000000..4ed16cf
--- /dev/null
+++ b/tools/bazel.rc
@@ -0,0 +1,2 @@
+build --workspace_status_command=./tools/workspace-status.sh
+test --build_tests_only
diff --git a/tools/bzl/BUILD b/tools/bzl/BUILD
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tools/bzl/BUILD
@@ -0,0 +1 @@
+
diff --git a/tools/bzl/junit.bzl b/tools/bzl/junit.bzl
new file mode 100644
index 0000000..3af7e58
--- /dev/null
+++ b/tools/bzl/junit.bzl
@@ -0,0 +1,4 @@
+load(
+    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
+    "junit_tests",
+)
diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl
new file mode 100644
index 0000000..a2e438f
--- /dev/null
+++ b/tools/bzl/plugin.bzl
@@ -0,0 +1,6 @@
+load(
+    "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl",
+    "gerrit_plugin",
+    "PLUGIN_DEPS",
+    "PLUGIN_TEST_DEPS",
+)
diff --git a/tools/workspace-status.sh b/tools/workspace-status.sh
new file mode 100755
index 0000000..2e97406
--- /dev/null
+++ b/tools/workspace-status.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# This script will be run by bazel when the build process starts to
+# generate key-value information that represents the status of the
+# workspace. The output should be like
+#
+# KEY1 VALUE1
+# KEY2 VALUE2
+#
+# If the script exits with non-zero code, it's considered as a failure
+# and the output will be discarded.
+
+function rev() {
+  cd $1; git describe --always --match "v[0-9].*" --dirty
+}
+
+echo "STABLE_BUILD_VERIFY-STATUS_LABEL" $(rev .)