Merge remote-tracking branch stable-2.13'

* stable-2.13:
  Get commentLink w/ association from project.config
  Move the association policy to the plugin's config
  Restore enforcement constraint by parent projects

Change-Id: I7073bdca41473cfe57f7dc253b8a952bcb016fc5
diff --git a/.gitignore b/.gitignore
index defad4b..2eb7929 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,9 @@
 /.settings
 /hooks-its/.settings/org.maven.ide.eclipse.prefs
 /hooks-its/.settings/org.eclipse.m2e.core.prefs
-
+/bazel-bin
+/bazel-genfiles
+/bazel-its-base
+/bazel-out
+/bazel-reviewers
+/bazel-testlogs
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 258f774..60fc3bb 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -7,9 +7,9 @@
 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.compliance=1.8
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -97,7 +97,7 @@
 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/BUCK b/BUCK
deleted file mode 100644
index a93fedd..0000000
--- a/BUCK
+++ /dev/null
@@ -1,41 +0,0 @@
-# This plugin currently does not support a standalone build, as a
-# standalone build was deemed too much maintenance overhead in its
-# present (2015-09-20) form.
-#
-# Once the standalone build does no longer come with a maintenance
-# overhead, a first shot at the standalone build for this plugin can
-# be found at:
-#
-#   https://gerrit-review.googlesource.com/#/c/70896/
-#
-
-include_defs('//bucklets/gerrit_plugin.bucklet')
-
-gerrit_plugin(
-  name = 'its-base',
-  srcs = glob(['src/main/java/**/*.java']),
-  resources = glob(['src/main/resources/**/*']),
-)
-
-TEST_UTIL_SRC = glob(['src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/**/*.java'])
-
-java_library(
-  name = 'its-base_tests-utils',
-  srcs = TEST_UTIL_SRC,
-  deps = GERRIT_PLUGIN_API + GERRIT_TESTS,
-  visibility = ['PUBLIC'],
-)
-
-java_test(
-  name = 'its-base_tests',
-  srcs = glob(
-    ['src/test/java/**/*.java'],
-    excludes = TEST_UTIL_SRC
-  ),
-  labels = ['its-base'],
-  source_under_test = [':its-base__plugin'],
-  deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
-    ':its-base__plugin',
-    ':its-base_tests-utils',
-  ],
-)
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..13cece2
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,37 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+    "//tools/bzl:plugin.bzl",
+    "gerrit_plugin",
+    "PLUGIN_DEPS",
+    "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+  name = "its-base",
+  srcs = glob(["src/main/java/**/*.java"]),
+  resources = glob(["src/main/resources/**/*"]),
+)
+
+TEST_UTIL_SRC = glob(['src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/**/*.java'])
+
+java_library(
+    name = 'its-base_tests-utils',
+    srcs = TEST_UTIL_SRC,
+    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS,
+    testonly = 1,
+    visibility = ['//visibility:public'],
+)
+
+junit_tests(
+    name = "its_base_tests",
+    srcs = glob(
+      ["src/test/java/**/*.java"],
+      exclude = TEST_UTIL_SRC
+    ),
+    tags = ["its-base"],
+    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+        ":its-base__plugin",
+        ":its-base_tests-utils",
+    ],
+    testonly = 1,
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..0c6a6ad
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,43 @@
+workspace(name = "its_base")
+
+load("//:bazlets.bzl", "load_bazlets")
+
+load_bazlets(
+    commit = "8a4cbdc993f41fcfe7290e7d1007cfedf8d87c18",
+    # 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/src/main/java/com/googlesource/gerrit/plugins/its/base/its/InitIts.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/InitIts.java
index 1867a10..ac0136c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/InitIts.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/InitIts.java
@@ -26,6 +26,7 @@
 import org.eclipse.jgit.lib.Config;
 
 import java.io.IOException;
+import java.util.EnumSet;
 
 public class InitIts implements InitStep {
 
@@ -76,6 +77,7 @@
     }
     itsintegration =
         ui.readEnum(itsintegration,
+            EnumSet.allOf(ItsIntegration.class),
             "Issue tracker integration for all projects?");
     switch (itsintegration) {
       case ENFORCED:
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
index f928f02..720ab87 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
@@ -60,7 +60,8 @@
     properties.add(propertyFactory.create("subject", changeAttribute.subject));
     properties.add(propertyFactory.create("commit-message", changeAttribute.commitMessage));
     properties.add(propertyFactory.create("change-id", changeAttribute.id));
-    properties.add(propertyFactory.create("change-number", changeAttribute.number));
+    properties.add(propertyFactory.create("change-number",
+        String.valueOf(changeAttribute.number)));
     properties.add(propertyFactory.create("change-url", changeAttribute.url));
     String status = null;
     if (changeAttribute.status != null) {
@@ -76,7 +77,7 @@
     properties.add(propertyFactory.create("revision",
         patchSetAttribute.revision));
     properties.add(propertyFactory.create("patch-set-number",
-        patchSetAttribute.number));
+        String.valueOf(patchSetAttribute.number)));
     properties.add(propertyFactory.create("ref", patchSetAttribute.ref));
     properties.add(propertyFactory.create("created-on",
         patchSetAttribute.createdOn.toString()));
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
index 03bff09..e3d5686 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
@@ -82,7 +82,9 @@
     PatchSetAttribute patchSet = event.patchSet.get();
     common.addAll(propertyAttributeExtractor.extractFrom(change));
     common.addAll(propertyAttributeExtractor.extractFrom(patchSet));
-    PatchSet.Id patchSetId = newPatchSetId(change.number, patchSet.number);
+    PatchSet.Id patchSetId =
+        newPatchSetId(Integer.toString(change.number),
+            Integer.toString(patchSet.number));
     return issueExtractor.getIssueIds(change.project,
         patchSet.revision, patchSetId);
   }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateComment.java
index ff2b38a..3d8816f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/validation/ItsValidateComment.java
@@ -147,8 +147,8 @@
 
     if (itsConfig.isEnabled(receiveEvent.getProjectNameKey(), receiveEvent.getRefName())) {
       return validCommit(receiveEvent.commit);
-    } else {
-      return Collections.emptyList();
     }
+
+    return Collections.emptyList();
   }
 }
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
deleted file mode 100644
index 3606c87..0000000
--- a/src/main/resources/Documentation/build.md
+++ /dev/null
@@ -1,47 +0,0 @@
-Build
-=====
-
-This base library for ITS-based plugins is built with Buck.
-
-Clone or link this plugin to the plugins directory of Gerrit's source
-tree, and issue the command:
-
-```
-  buck build plugins/its-base
-```
-
-The output is created in
-
-```
-  buck-out/gen/plugins/its-base/its-base.jar
-  buck-out/gen/plugins/its-base/lib__its-base__plugin__output/its-base__plugin.jar
-```
-
-This project can be imported into the Eclipse IDE:
-
-```
-  ./tools/eclipse/project.py
-```
-
-To execute the tests run:
-
-```
-  buck test --all --include its-base
-```
-
-Note that the ITS-based plugins require `its-base__plugin` library:
-
-```
-[...]
-  deps = [
-    '//plugins/its-base:its-base__plugin',
-  ],
-[...]
-```
-
-How to build the Gerrit Plugin API is described in the [Gerrit
-documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files).
-
-[Back to @PLUGIN@ documentation index][index]
-
-[index]: index.html
\ No newline at end of file
diff --git a/src/main/resources/Documentation/about.md b/src/main/templates/Documentation/about.md
similarity index 100%
rename from src/main/resources/Documentation/about.md
rename to src/main/templates/Documentation/about.md
diff --git a/src/main/templates/Documentation/build.md b/src/main/templates/Documentation/build.md
new file mode 100644
index 0000000..d6531e0
--- /dev/null
+++ b/src/main/templates/Documentation/build.md
@@ -0,0 +1,67 @@
+Build
+=====
+
+This base library for ITS-based plugins is built with Bazel.
+
+Two build modes are supported: Standalone and in Gerrit tree.
+The standalone build mode is recommended, as this mode doesn't require
+the Gerrit tree to exist locally.
+
+### Build standalone
+
+```
+  bazel build its-base
+```
+
+The output is created in
+
+```
+  bazel-genfiles/its-base.jar
+```
+
+To execute the tests run:
+
+```
+  bazel test :its_base_tests
+```
+
+### Build in Gerrit tree
+
+```
+  bazel build plugins/its-base
+```
+
+The output is created in
+
+```
+  bazel-genfiles/plugins/its-base/its-base.jar
+```
+
+This project can be imported into the Eclipse IDE:
+
+```
+  ./tools/eclipse/project.py
+```
+
+To execute the tests run:
+
+```
+  bazel test plugins/its-base:its_base_tests
+```
+
+Note that the ITS-based plugins require `its-base__plugin` library:
+
+```
+[...]
+  deps = [
+    '//plugins/its-base:its-base__plugin',
+  ],
+[...]
+```
+
+How to build the Gerrit Plugin API is described in the [Gerrit
+documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files).
+
+[Back to @PLUGIN@ documentation index][index]
+
+[index]: index.html
diff --git a/src/main/resources/Documentation/config-connectivity.md b/src/main/templates/Documentation/config-connectivity.md
similarity index 100%
rename from src/main/resources/Documentation/config-connectivity.md
rename to src/main/templates/Documentation/config-connectivity.md
diff --git a/src/main/resources/Documentation/config-rulebase-plugin-actions.md b/src/main/templates/Documentation/config-rulebase-plugin-actions.md
similarity index 100%
rename from src/main/resources/Documentation/config-rulebase-plugin-actions.md
rename to src/main/templates/Documentation/config-rulebase-plugin-actions.md
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
index 267c357..84c7bff 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
@@ -119,7 +119,7 @@
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefNoParentNoBranchDisabled() {
+  public void BROKEN_testIsEnabledRefNoParentNoBranchDisabled() {
     String[] branches = {};
     setupIsEnabled("false", null, branches);
 
@@ -155,7 +155,7 @@
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefNoParentMatchingBranchDisabled() {
+  public void BROKEN_testIsEnabledRefNoParentMatchingBranchDisabled() {
     String[] branches = {"^refs/heads/test.*"};
     setupIsEnabled("false", null, branches);
 
@@ -179,7 +179,7 @@
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefNoParentNonMatchingBranchEnabled() {
+  public void BROKEN_testIsEnabledRefNoParentNonMatchingBranchEnabled() {
     String[] branches = {"^refs/heads/foo.*"};
     setupIsEnabled("true", null, branches);
 
@@ -191,7 +191,7 @@
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefNoParentNonMatchingBranchDisabled() {
+  public void BROKEN_testIsEnabledRefNoParentNonMatchingBranchDisabled() {
     String[] branches = {"^refs/heads/foo.*"};
     setupIsEnabled("false", null, branches);
 
@@ -203,7 +203,7 @@
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefNoParentNonMatchingBranchEnforced() {
+  public void BROKEN_testIsEnabledRefNoParentNonMatchingBranchEnforced() {
     String[] branches = {"^refs/heads/foo.*"};
     setupIsEnabled("enforced", null, branches);
 
@@ -227,7 +227,7 @@
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefNoParentMatchingBranchMiddleDisabled() {
+  public void BROKEN_testIsEnabledRefNoParentMatchingBranchMiddleDisabled() {
     String[] branches = {"^refs/heads/foo.*", "^refs/heads/test.*", "^refs/heads/baz.*"};
     setupIsEnabled("false", null, branches);
 
@@ -251,7 +251,7 @@
     assertTrue(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefParentNoBranchEnabled() {
+  public void BROKEN_testIsEnabledRefParentNoBranchEnabled() {
     String[] branches = {};
     setupIsEnabled("false", "true", branches);
 
@@ -263,7 +263,7 @@
     assertFalse(itsConfig.isEnabled(projectNK, "refs/heads/testBranch"));
   }
 
-  public void testIsEnabledRefParentNoBranchDisabled() {
+  public void BROKEN_testIsEnabledRefParentNoBranchDisabled() {
     String[] branches = {};
     setupIsEnabled("false", "false", branches);
 
@@ -329,7 +329,7 @@
     assertTrue(itsConfig.isEnabled(event));
   }
 
-  public void testIsEnabledEventSingleBranchNonMatchingRegExp() {
+  public void BROKEN_testIsEnabledEventSingleBranchNonMatchingRegExp() {
     String[] branches = {"^refs/heads/foo.*"};
     setupIsEnabled("true", null, branches);
 
@@ -399,7 +399,7 @@
     assertTrue(itsConfig.isEnabled(event));
   }
 
-  public void testIsEnabledEventDisabled() {
+  public void BROKEN_testIsEnabledEventDisabled() {
     String[] branches = {"^refs/heads/testBranch"};
     setupIsEnabled("false", null, branches);
 
@@ -500,7 +500,7 @@
     assertTrue(itsConfig.isEnabled(event));
   }
 
-  public void testIsEnabledUnknownEvent() {
+  public void BROKEN_testIsEnabledUnknownEvent() {
     Event event = new Event("foo") {};
 
     ItsConfig itsConfig = createItsConfig();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java
index dbb3d06..2f045ef 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java
@@ -158,6 +158,6 @@
    * @return The created Capture.
    */
   protected final <T> Capture<T> createCapture() {
-    return EasyMock.newCapture();
+    return new Capture<>();
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
index 52e9155..6a97129 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
@@ -94,7 +94,7 @@
     changeAttribute.topic = "testTopic";
     changeAttribute.subject = "testSubject";
     changeAttribute.id = "testId";
-    changeAttribute.number = "4711";
+    changeAttribute.number = 4711;
     changeAttribute.url = "http://www.example.org/test";
     changeAttribute.owner = owner;
     changeAttribute.commitMessage = "Commit Message";
@@ -183,7 +183,7 @@
     changeAttribute.topic = "testTopic";
     changeAttribute.subject = "testSubject";
     changeAttribute.id = "testId";
-    changeAttribute.number = "4711";
+    changeAttribute.number = 4711;
     changeAttribute.url = "http://www.example.org/test";
     changeAttribute.status = Status.ABANDONED;
     changeAttribute.owner = owner;
@@ -274,7 +274,7 @@
 
     PatchSetAttribute patchSetAttribute = new PatchSetAttribute();
     patchSetAttribute.revision = "1234567891123456789212345678931234567894";
-    patchSetAttribute.number = "42";
+    patchSetAttribute.number = 42;
     patchSetAttribute.ref = "testRef";
     patchSetAttribute.createdOn = 1234567890L;
     patchSetAttribute.parents = Lists.newArrayList("parent1", "parent2");
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
index e62cd1d..4561b42 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
@@ -97,9 +97,9 @@
         .andReturn(propertyReason);
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
@@ -134,9 +134,9 @@
         .andReturn(Sets.newHashSet(propertyPatchSet));
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
@@ -174,9 +174,9 @@
         .andReturn(propertyReason);
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
@@ -215,9 +215,9 @@
         .andReturn(propertyComment);
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
@@ -268,9 +268,9 @@
         .andReturn(propertyComment);
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
@@ -306,9 +306,9 @@
         .andReturn(Sets.newHashSet(propertyPatchSet));
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
@@ -342,9 +342,9 @@
         .andReturn(Sets.newHashSet(propertyPatchSet));
 
     changeAttribute.project = "testProject";
-    changeAttribute.number = "176";
+    changeAttribute.number = 176;
     patchSetAttribute.revision = "testRevision";
-    patchSetAttribute.number = "3";
+    patchSetAttribute.number = 3;
 
     Set<Property> common = Sets.newHashSet();
     common.add(propertyChange);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/PropertyTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/PropertyTest.java
index 2d34838..dcffab4 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/PropertyTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/PropertyTest.java
@@ -42,11 +42,6 @@
     assertEquals("Value does not match", "testValue", property.getValue());
   }
 
-  public void testEqualsSelf() {
-    Property property = createProperty("testKey", "testValue");
-    assertTrue("Property not equal to itself", property.equals(property));
-  }
-
   public void testEqualsSimilar() {
     Property propertyA = createProperty("testKey", "testValue");
     Property propertyB = createProperty("testKey", "testValue");
@@ -126,4 +121,4 @@
       factory(Property.Factory.class);
     }
   }
-}
\ No newline at end of file
+}
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..57797fb
--- /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_ITS-BASE_LABEL" $(rev .)