Merge branch 'stable-2.13'
* stable-2.13:
Disable IT tests
Refactor validateNewProject to reduce complexity
Extract duplicated string into a constant
Commit "Disable IT tests" is reverted in this merge, IT tests are
working on this branch.
Change-Id: I7ac70cfc8e846e7ddaf0e1c237ec3f0481e9383f
diff --git a/BUCK b/BUCK
index dfd8810..84af6a0 100644
--- a/BUCK
+++ b/BUCK
@@ -1,11 +1,18 @@
include_defs('//bucklets/gerrit_plugin.bucklet')
include_defs('//bucklets/java_sources.bucklet')
+include_defs('//bucklets/maven_jar.bucklet')
SOURCES = glob(['src/main/java/**/*.java'])
RESOURCES = glob(['src/main/resources/**/*'])
TEST_DEPS = GERRIT_TESTS + GERRIT_PLUGIN_API + [
':project-group-structure__plugin',
+ # 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(
@@ -40,3 +47,22 @@
deps = TEST_DEPS,
)
+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/BUILD b/BUILD
new file mode 100644
index 0000000..cfd259d
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,28 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+ "//tools/bzl:plugin.bzl",
+ "gerrit_plugin",
+ "PLUGIN_DEPS",
+ "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+ name = "project-group-structure",
+ srcs = glob(["src/main/java/**/*.java"]),
+ resources = glob(["src/main/resources/**/*"]),
+ manifest_entries = [
+ "Gerrit-PluginName: project-group-structure",
+ "Gerrit-Module: com.ericsson.gerrit.plugins.projectgroupstructure.Module",
+ "Implementation-Title: project-group-structure plugin",
+ "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/project-group-structure",
+ ],
+)
+
+junit_tests(
+ name = "project_group_structure_tests",
+ srcs = glob(["src/test/java/**/*.java"]),
+ tags = ["project-group-structure"],
+ deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+ ":project-group-structure__plugin",
+ ],
+)
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
index 950a90d..934d087 100644
--- a/lib/gerrit/BUCK
+++ b/lib/gerrit/BUCK
@@ -1,12 +1,11 @@
include_defs('//bucklets/maven_jar.bucklet')
-VER = '2.13'
-REPO = MAVEN_CENTRAL
+VER = '2.14-SNAPSHOT'
+REPO = MAVEN_LOCAL
maven_jar(
name = 'plugin-api',
id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
- sha1 = 'e25d55b8f41627c4ae6b9d2069ec398638b219a3',
license = 'Apache2.0',
attach_source = False,
repository = REPO,
@@ -14,7 +13,6 @@
maven_jar(
name = 'acceptance-framework',
id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
- sha1 = 'a6913a61196a8fccdb45e761f43a0b7e21867c90',
license = 'Apache2.0',
attach_source = False,
repository = REPO,
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index bedf322..935077b 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,72 +1,34 @@
Build
=====
-This plugin is built with Buck.
+This @PLUGIN@ plugin is built with Bazel.
-Buck
-----
+Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree.
-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
-----------------
-
-Clone bucklets library:
+Then issue
```
- git clone https://gerrit.googlesource.com/bucklets
-
-```
-and link it to @PLUGIN@ plugin directory:
-
-```
- cd @PLUGIN@ && ln -s ../bucklets .
+ bazel build plugins/@PLUGIN@
```
-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
-```
+in the root of Gerrit's source tree to build
The output is created in
```
- buck-out/gen/@PLUGIN@.jar
+ bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
```
-Build in Gerrit tree
---------------------
-
-Clone or link this plugin to the plugins directory of Gerrit's source
-tree, and issue the command:
-
-```
- buck build plugins/@PLUGIN@
-```
-
-The output is created in
-
-```
- buck-out/gen/plugins/@PLUGIN@/@PLUGIN@.jar
-```
-
-This project can be imported into the Eclipse IDE:
+This project can be imported into the Eclipse IDE.
+Add the plugin name to the `CUSTOM_PLUGINS` set in
+Gerrit core in `tools/bzl/plugins.bzl`, and execute:
```
./tools/eclipse/project.py
```
+
+To execute the tests run:
+
+```
+ bazel test plugins/@PLUGIN@:project_group_structure_tests
+```
diff --git a/src/test/java/com/ericsson/gerrit/plugins/projectgroupstructure/ProjectCreationValidatorTest.java b/src/test/java/com/ericsson/gerrit/plugins/projectgroupstructure/ProjectCreationValidatorIT.java
similarity index 95%
rename from src/test/java/com/ericsson/gerrit/plugins/projectgroupstructure/ProjectCreationValidatorTest.java
rename to src/test/java/com/ericsson/gerrit/plugins/projectgroupstructure/ProjectCreationValidatorIT.java
index d3cb1e1..f62d8ce 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/projectgroupstructure/ProjectCreationValidatorTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/projectgroupstructure/ProjectCreationValidatorIT.java
@@ -20,8 +20,9 @@
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.hash.Hashing;
-import com.google.gerrit.acceptance.PluginDaemonTest;
+import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
import com.google.gerrit.acceptance.RestResponse;
+import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.extensions.api.groups.GroupApi;
import com.google.gerrit.extensions.api.projects.ProjectInput;
@@ -31,14 +32,17 @@
import com.google.gerrit.server.project.ProjectState;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
-@Ignore
-public class ProjectCreationValidatorTest extends PluginDaemonTest {
+@TestPlugin(
+ name = "project-group-structure",
+ sysModule = "com.ericsson.gerrit.plugins.projectgroupstructure.Module"
+)
+public class ProjectCreationValidatorIT extends LightweightPluginDaemonTest {
@Before
public void setUp() throws Exception {
+ super.setUp();
// These access rights are mandatory configuration for this plugin as
// documented in config.md
allowGlobalCapabilities(REGISTERED_USERS, GlobalCapability.CREATE_GROUP);