959 Commits

Author SHA1 Message Date
Paladox none
54bd23bb4c Switch from pegdown to flexmark-java
The pegdown project is no longer maintained and has been deprecated
in favour of flexmark [1].  Furthermore, flexmark has more features
than pegdown and has better performance [2].

[1] https://github.com/sirthias/pegdown
[2] https://github.com/vsch/flexmark-java#feature-comparison

Change-Id: Ie3c20a7fffb0f6917bd3de353a9d7b46eeaa818f
2018-08-22 15:21:26 +00:00
Dave Borowitz
de3e936507 Add missing runtime_deps to gwtorm
Change-Id: I41c547837c8275eef563bea31711e9b5a0b72189
2018-08-07 08:51:12 -07:00
David Pursehouse
3d9574e6c3 Upgrade JGit to 5.0.2.201807311906-r
This release contains the following fixes since 5.0.1.201806211838-r:

A fix for issue 9153:

  - ResolveMerger: Fix encoding with string; use bytes

And several fixes related to cleanup of ref directories after running
GC:

  - Delete all loose refs empty directories
  - Use java.nio to delete path to get detailed errors
  - GC: Remove empty references folders
  - Do not ignore path deletion errors

Bug: Issue 9153
Change-Id: I38d57c20475345626e277c7734fd0e109070d69e
2018-08-02 21:07:22 +02:00
David Ostrovsky
e27a404a3e Bump args4j version to 2.0.29
There is pending upgrade for review for years now to version 2.33: [1],
that appears to be too introusive change. There are two issues:

* Collision with rules_closure's and closure-templates's args4j version
* Non trivial changes in gerrit core to adapt to newer args4j version

Dismantle those issues, by upgrading to intermediate version: 2.0.29.

Re-fetch args4j twice: one for rules_closure to work properly with
ancient args4j version, while renaming the internal one to the more
recent version: args4j-intern.

Needless to say, that we have uploaded these PRs to both projects:
rules_closure and closure-templates that were more or less rejected,
so that we don't hope that args4j is going to be upgraded upstream,
thus keeping this status quo of double fetching: [2],[3].

The reason we need this change is dependency of gitblit-plugin on more
recent version so that we are getting classpath collision. Another
alternative that was considered (but abandoned) is to downgrade args4j
version in gitblit to the same ancient version used by gerrit core.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/67793
[2] https://github.com/bazelbuild/rules_closure/pull/262
[3] https://github.com/google/closure-templates/pull/155

Change-Id: I5ec6645b92d54fccc03a723b7b50c50a99393d57
2018-08-01 11:09:56 +02:00
Dave Borowitz
f7ac3ec16f Merge "Upgrade Truth to 0.42" 2018-07-27 21:50:00 +00:00
David Pursehouse
d9d9e6a992 Merge branch 'stable-2.15'
* stable-2.15:
  Adjust file mode of Roboto fonts
  Remove SourceCodePro font files
  PutConfig: add cause to ResourceConflictException
  RestSession: Remove unnecessary utility methods

Change-Id: Ie6591ef397d9c580fe423983381d11603e015cfa
2018-07-25 10:29:13 +01:00
David Pursehouse
cb8c06c580 Merge "Adjust file mode of Roboto fonts" into stable-2.15 2018-07-25 07:30:06 +00:00
Gert van Dijk
1d7fc21b83 Adjust file mode of Roboto fonts
The fonts added in I7588e9aa1ef0b2e4ccd / 00a23600a8 were added with
deviating file modes compared to others in this folder. This change aligns
them.

Change-Id: Ic5db038e9d3d942f41a6f4789dd76f053556d6c4
2018-07-25 08:54:16 +02:00
Gert van Dijk
2d7cbe2f8d Remove SourceCodePro font files
The font has been replaced by Roboto in I7588e9aa1ef0b2e4ccd / 00a23600a8.
SourceCodePro font files were dereferenced with that change, but the font
files itself appear not to have been removed.

Change-Id: I525f18e3f6b61e475fe8c3082af6a3c9a80350e8
2018-07-25 08:53:17 +02:00
David Pursehouse
d0da502645 Upgrade Truth to 0.42
The 'fail' method is deprecated. Replace it as necessary.

The new version includes a dependency on diffutils; add it.

Change-Id: I80527c9ea41eb752710bed64cdb1621d4216ee46
2018-07-24 10:57:18 +01:00
Paladox none
41ff059837 Mention how to download closure-compiler to build highlight.js
Change-Id: If3d6fd2ff4c3af927b1c7b677dee07b5b7293fae
2018-07-23 17:18:46 +00:00
Paladox none
739311c403 Update highlight.js build documentation
highlight.js has got a new maintainer and under a
new name highlightjs/highlight.js

Change-Id: Ic7589d186db86c5c3c1cffabd94ca1df4dc19682
2018-07-23 13:34:40 +00:00
David Pursehouse
e978e864e6 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  GerritServer: save gerrit.config before site init
  ReindexIT: remove unnecessary method throws clause
  RestSession#postWithHeader: Make parameter order consistent with #putWithHeader
  Bump guice version to 4.2.0

Change-Id: Ibdedb3281414a140b214cb8c9006754cff542d25
2018-07-22 09:48:32 +01:00
David Ostrovsky
c3536a0650 Bump guice version to 4.2.0
The new version provides better support for Java 9 and improves
performance. Multibindings artifact is now included in the guice
core artifact. The full release notes is here: [1].

[1] https://github.com/google/guice/wiki/Guice42

Change-Id: I208d53ce1cf9b99ed8f03ae34470e95c3b8f71ce
(cherry picked from commit 1fa7774d237d0ea864b9f03b6551fd1ebef0c619)
2018-07-19 08:42:40 +09:00
Viktar Donich
ee7b2a218b Replace vulcanize with bundle_assets build rule
New rule uses polymer-bundler instead of deprecated vulcanize.
Also use this rule to package UI plugins.
Also for combining PolyGerrit UI.

Feature: Issue 7144
Change-Id: I17380c670fe4a980dc9748b356e7df18aebdb4ca
2018-07-18 11:20:14 -07:00
David Pursehouse
d798193755 JGit: Use Javadoc from 5.0.1.201806211838-r
When we upgraded to 5.0.1.201806211838-r the Javadoc was not
available, so the previous version was used.

Now it's available, so we can use it.

Change-Id: Ic1b244177964d6a15d0179e3bf5223ff7fc07cd8
2018-07-12 18:16:38 +09:00
Han-Wen Nienhuys
200506a00f Merge "Apply buildifier to .bzl files." 2018-07-11 08:01:34 +00:00
David Pursehouse
8b3324c69e Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Apply buildifier to .bzl files.
  Update Bower to 1.8.2
  Bump commons-io version to 2.2

Change-Id: Ic90865db76a0e34f0f8fef33b83ec7b2fd75c875
2018-07-11 08:35:07 +09:00
Wyatt Allen
b71c49d488 Restore HLJS build from before db8691a96
Bug: Issue 9408
Change-Id: Id8520fcadc2e03f2d816ca6e2a0da9fa1e15faa0
2018-07-10 13:01:15 -07:00
Han-Wen Nienhuys
b6a4048986 Apply buildifier to .bzl files.
Buildifier is now also used for formatting .bzl files.

This change was created by running buildifier 0.12 over our source tree.

Change-Id: I9f15112d4fe23e5cec0700cfe47f1ca649f61d2a
2018-07-10 20:38:52 +09:00
Han-Wen Nienhuys
a667b4c439 Apply buildifier to .bzl files.
Buildifier is now also used for formatting .bzl files.

This change was created by running buildifier 0.12 over our source tree.

Change-Id: I9f15112d4fe23e5cec0700cfe47f1ca649f61d2a
2018-07-10 12:39:26 +02:00
Matthias Sohn
d68c1bba9d Update JGit to 5.0.1.201806211838-r
Fixes:
- 'Respect "unshallow" lines in protocol v2'

Release notes:
https://projects.eclipse.org/projects/technology.jgit/releases/5.0.1/review

Change-Id: I01d8083dc355124bf3809bed2e9f0a954f100c20
2018-06-23 01:02:09 +02:00
Matthias Sohn
fb947fe174 Update JGit to 5.0.0.201806131550-r
JGit 5.0.0 introduces some new features (including support for the
git protocol v2), performance improvements, and bug fixes.

It also includes a number of deprecations, some of which cause
warnings in the gerrit project. These are not fixed in this commit,
but will be fixed in follow-ups.

See the release notes [1] for full details of the release.

[1] https://projects.eclipse.org/projects/technology.jgit/releases/5.0.0

Change-Id: I62200941b34ebcfa58934be531a2486b1fef3d01
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-06-21 13:46:36 +09:00
David Pursehouse
e31b257f3f Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Format WORKSPACE and BUILD files with buildifier version 0.12.0
  Move commons-io from lib/BUILD to lib/commons/BUILD

Change-Id: I6130353f0cceed80b370e5566d329acd7e0829b3
2018-06-14 16:55:29 +09:00
David Pursehouse
fe0735cfaa Move commons-io from lib/BUILD to lib/commons/BUILD
All the commons-* libraries are defined in lib/commons/BUILD with
the exception of commons-io which is in lib/BUILD.

Move it to lib/commons/BUILD to make it consistent.

Change-Id: If2541eba2a4a9e9b5e7a777940bfce923478808b
2018-06-13 20:01:44 +09:00
David Ostrovsky
d2f001b0c4 Bazel: Disambiguate codemirror-minified repository
This repository is used twice: for GWT and for PG toolchains, under
different names:

* codemirror_minified for GWT
* codemirror-minified for PG

In I1e75690fe1 the external repository names were harmonized, but
renaming of codemirror_minified to codemirror-minified was undone
to avoid collision between the two external repositories.

Make them unique and rename codemirror_minified to
codemirror-minified-gwt to avoid collision.

Change-Id: I14c2f319d0ca451dea9424af9f5080d89dc704ad
2018-06-13 07:45:46 +00:00
David Ostrovsky
e1359a35e1 Bazel: Harmonize names of external repositories
Recent Bazel versions support dash character in external repository
names. Consistently use them with one exception: javax_inject. This is
needed to match the name in the rules_closure.

Change-Id: I1e75690fe1ee2ab32fffe07c0c30dbed84753960
2018-06-13 11:38:03 +09:00
David Pursehouse
293e329a9b Merge "Update CodeMirror to 5.37.0" 2018-06-12 23:26:27 +00:00
David Pursehouse
a5d14bdd0a Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Add integration test classes for "ssh index" commands
  Bazel: Harmonize names of external repositories

Change-Id: I081bb8c1fc148f7a86b82586a47ac445f521d8bb
2018-06-12 10:10:44 +09:00
David Pursehouse
db5daaf46c Upgrade JGit to 4.9.2.201712150930-r.15-g5fe8e31d4
This is a snapshot built from the head of JGit's stable-4.9 branch and
includes the following commits since the currently used version:

  5fe8e31d4 Ensure DirectoryStream is closed promptly
  d13918310 Retry stale file handles on .git/config file
  185e53bce Fix ssh host name handling for Jsch
  891103609 Jsch overrides the port in the URI with the one in ~/.ssh/config
  3d6455331 Minor fixes in three error messages
  bea3b4667 Revert handling of ssh IdentityFile to pre-4.9 behavior
  279eaf069 Strings#convertGlob: fix escaping of patterns like [\[].

The one we're interested in is:

  5fe8e31d4 Ensure DirectoryStream is closed promptly

which fixes a leak of file handles when running GC.

Bug: Issue 8915
Change-Id: I9571d9df7ee0df2bae788ef10442e2c9e28797e9
2018-06-09 19:19:47 +09:00
David Ostrovsky
f98a60b35f Bazel: Harmonize names of external repositories
Recent Bazel versions support dash character in external repository
names. Consistently use them with one exception: javax_inject. This is
needed to match the name in the rules_closure.

Change-Id: I1e75690fe1ee2ab32fffe07c0c30dbed84753960
2018-06-08 19:33:01 +09:00
David Pursehouse
b989f3d421 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  AbstractElasticIndex: fix index name of delete request and add coverage
  Bazel: Remove unused commons-lang3
  DropWizardMetricMaker: Move sanitizeMetricName to MetricMaker base class

Change-Id: I5e03191d329c6893ba9823fd20676aeefe0fb653
2018-06-08 10:33:15 +09:00
David Ostrovsky
589af813cc Bazel: Remove unused commons-lang3
After removing Elasticsearch and Jest REST client library, commons lang3
is not used any more in Gerrit core. Given that we have forgotten to
remove it and stil expose it in plugin API only confused the plugins
that depend on it, because the build pass, but then the plugin cannot
work, because the required dependency is missing.

Change-Id: I7af2f9f6cb90e8e52d7ed2efaf4c3af85b47a9e2
2018-06-07 06:45:45 +02:00
David Pursehouse
a0ba6b2e69 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Update git submodules
  AsciiDoctor: Format with google-java-format version 1.6

Change-Id: If4ec4dd0f74a1acfb05e0746c7cc64d22ebe9e36
2018-06-07 08:34:22 +09:00
Wyatt Allen
db8691a96b Remove styles for markdown syntax
Support for markdown files would only typeset text as bold or italic
when it appeared inside the corresponding inline Markdown syntax. It
didn't render the Markdown, but rather approximated what the text might
look like if rendered. Because this provides little real value, and
because HLJS sometimes incorrectly parses these Markdown constructs,
markdown is dropped from the highlighting layer.

Bug: Issue 9056
Change-Id: I97865dc8b522dca5a50264456274590fac83dae9
2018-06-06 09:27:20 -07:00
David Pursehouse
acb1889028 Merge branch 'stable-2.15'
* stable-2.15:
  Update git submodules
  Reformat all Java files with google-java-format 1.6
  Reformat all Java files with google-java-format 1.6
  ChangeNotesTest: Have at most one call after ExpectedException#expect
  FieldType: Remove unnecessary KEYWORD type
  Remove unnecessary annotations from reindex test classes
  AbstractReindexTests: Assert account index and group index
  AbstractElasticIndex: Rename getActions to getDeleteActions
  dev-bazel: Improve documentation of build caches
  Hoist declaration of TestName up to GerritBaseTests
  Bazel: Replace native {http,git}_archive with Skylark rules
  Bazel: Bump rules_closure to 0.7.0
  dev-contributing: Update link to buildifier tool
  dev-contributing: Update buildifier to latest released version
  Bump minimum Bazel version to 0.14.0 and activate caches
  ElasticReindexIT: Add tests against Elasticsearch version 5
  Elasticsearch: Add tests for queries against version 5
  MatchQueryBuilder: Don't use deprecated "match" query
  Elasticsearch: Add an adapter to support V5
  Add Bazel version check

Change-Id: I6bbf229b76790f3fbb74a952d4330ba92e3dd449
2018-06-06 13:21:12 +09:00
David Pursehouse
b98818532f AsciiDoctor: Format with google-java-format version 1.6
Change-Id: Idafd9338810c727607290de908244dbe1c681740
2018-06-06 08:45:32 +09:00
Edwin Kempin
6ed96ca40b Migrate all remaining classes to Flogger
This is the next part of the migration to Flogger. This change migrates
all remaining classes Flogger. This means all classes in Gerrit core now
use Flogger.

During this migration we try to make the log statements more consistent:
- avoid string concatenation
- avoid usage of String.format(...)

The visibility of the slf4j library is restricted to plugins and jgit
now. This avoids that we accidentally add new dependencies to slf4j.

Change-Id: Ide573327315a15cde69b68b5f27934deeb790d37
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-06-05 13:14:12 +02:00
Edwin Kempin
2b81d71374 Add dependency to Flogger
Flogger is an open source project (Apache 2 License) from Google that
provides a fluent JAVA API for logging:
* https://github.com/google/flogger
* https://google.github.io/flogger/

We want to use Flogger instead of slf4j. This idea was discussed at the
Gerrit hackathon in Lund [1] and on the mailing list [2].

Benefits:
* Better Readability
* Better Performance
* Will allow us to implement request tracing

Flogger API examples:
* logger.atSevere()
    .withCause(err)
    .log("Error in %s %s", req.getMethod(), uri);
* logger.atInfo()
    .atMostEvery(1, TimeUnit.HOURS)
    .log(...)
* logger.atInfo()
    .withStackTrace(StackSize.FULL)
    .log(...)

Within Google Flogger is long-established and is used by almost 3/4 of
all Google's Java projects, hence this library is very mature.

The Flogger API can be used with different logging backends. We are
using the log4j backend, as we are currently using log4j as backend with
slf4j. This means there are no changes to how logs are configured
(existing log4j.properties and log4j.xml files continue to work). It
also means that this doesn't effect any integrations that work with
log4j (e.g. integration with logstash continues to work).

To use the log4j backend for Flogger the system property
'flogger.backend_factory' must be set to
'com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance'.
E.g. this system property may be set in gerrit.config:
[container]
  javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"

If this property is not set Gerrit sets it automatically on startup so
that we always have a proper logging configuration. We do this in
Main.java before loading any class. This is important since Flogger
reads this system property only once when the FluentLogger class is
loaded and we must be sure that the system property was set before this.

Using Flogger and slf4j in parallel is not a problem. Logs from both
APIs end up in the same log file(s).

This change doesn't migrate any classes to Flogger yet. This will be
done by follow-up changes.

JGit is still using slf4j and needs an explicit runtime dependency on
slf4j.

[1] https://docs.google.com/presentation/d/1Kwn77c1PScMLDEWiJDklEm43NsN2-mWm2PqHwYTkJfI/edit?usp=sharing
[2] https://groups.google.com/d/msg/repo-discuss/meEWJO7c4pA/fxDx2waRCQAJ

Change-Id: Ifc31fb95c10397857e8de5657c729f49c1820ec4
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-06-05 13:06:05 +02:00
David Pursehouse
efe7493467 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  Remove unnecessary annotations from reindex test classes
  AbstractReindexTests: Assert account index and group index
  AbstractElasticIndex: Rename getActions to getDeleteActions
  dev-bazel: Improve documentation of build caches
  Hoist declaration of TestName up to GerritBaseTests
  Bazel: Replace native {http,git}_archive with Skylark rules
  Bazel: Bump rules_closure to 0.7.0
  dev-contributing: Update link to buildifier tool
  dev-contributing: Update buildifier to latest released version
  Bump minimum Bazel version to 0.14.0 and activate caches

Change-Id: I27a88f0887b0d1e3af92fe2934d9e54222012e0f
2018-06-05 19:15:10 +09:00
David Ostrovsky
6dc8c42960 Bazel: Replace native {http,git}_archive with Skylark rules
Future Bazel versions will discontinue support for native http rules and
replace them with Skylark equivalents: [1]. Prepare the Gerit build tool
chain for that move.

The replacements depend on this PR in rules_closure project: [2], that
wasn't merged yet. For now we can apply "patch on import", thanks
Skylark's http rules patch support. When [2] is merged, and new version
of rules_clsoure is released, we can remove the patching procedure.

One side effect of this change is that Skylark version of http_file lost
the ability to save the downloaded artifact under its real name and is
using a generic download file name. The rule closure tool chain stumbles
on this, and rejects to accept polymer_closure artifact without ".js"
suffix. To rectify add intermediate rule and renamed "download" file to
one with js suffix "polymer_closure_renamed.js": [3].

[1] https://groups.google.com/d/topic/bazel-discuss/dO2MHQLwJF0/discussion
[2] https://github.com/bazelbuild/rules_closure/pull/270
[3] http://paste.openstack.org/show/722557

Inspired-By: "Klaus Aehlig" <aehlig@google.com>
Feature: Issue 9151
Change-Id: I44ca2ecfea67d2f4434a4743e7a6f8a3645e96a8
2018-06-05 05:13:58 +00:00
David Ostrovsky
4b1ff15c1a Acceptance tests: Replace embedded ES with docker testcontainer
Testcontainers is a Java 8 library that supports JUnit tests, providing
lightweight, throwaway instances of common databases, Selenium web
browsers, or anything else that can run in a Docker container.

This change replaces ES integration test that currently uses embedded
ES mode with ES docker image using Testcontainers library. All this is
done from within acceptance tests.

This change removes dependency on ES server stack for the test code. As
the consequence, this stack can be removed.

Prerequisite for this change is installed docker service on the SUT. If
docker service is not installed, assumption violation is raised so that
the tests don't fail. Unfortunately, due to this missing Bazel feature,
JUnit assumption violations are not reflected on the Bazel UI: [1] yet.

[1] https://github.com/bazelbuild/bazel/issues/3476

Change-Id: Iccf44310292cc44bff9173f2a4ea757b43f77183
2018-05-31 08:13:48 +09:00
Marco Miller
f9758fd8bb Elasticsearch: replace native API in prod w/ REST
Remove jest API which depends on Elasticsearch native API (also
removed), so no longer depend on lucene for this scope. Replace such
removed dependencies with the Elasticsearch low-level API, which does
not depend on Lucene. That now used API is a REST client with minimal
dependencies, indeed. -As opposed to Elastic's current high-level API,
which still depends on lucene and other Gerrit-constraining libraries.

Do so in order to decouple the elasticsearch client from lucene in
Gerrit. That REST client does not logically require Lucene anyway. Most
importantly, such decoupling now enables upcoming support for more than
just one Elasticsearch server version. This includes the new possibility
of bumping the latter to multiple yet later versions, such as 5 and 6.x.
The currently used version (2.4) should also still be kept, for a while.

Bumping such versions will likely require some Elasticsearch client code
adaptations, so that Gerrit can (dynamically?) switch between either
Elasticsearch server version to eventually support (hopefully soon).

Doing the same for the elasticsearch tests in Gerrit is to be done using
another change or more changes.

Add a partial and customized fork of [1], based on [1]'s commit [2], to
preserve the ability of building proper json requests for Elasticsearch.
Put that forked json-generating code under a new 'builders' sub-package.
There should be a possibility in some near future to consider removing
that fork, based on potential progress such as the one proposed in [3].
Meanwhile, this fork shall be maintained to usual Gerrit quality levels.

[1] https://github.com/elastic/elasticsearch
[2] tag: v2.4.4
[3] https://github.com/elastic/elasticsearch/issues/30791

Bug: Issue 6094
Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
2018-05-31 08:06:19 +09:00
David Pursehouse
24e7484fd4 Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  AbstractElasticIndex: Don't mention "change" in exception message
  Consistently import org.slf4j.LoggerFactory
  PluginLoader: Make Logger private
  Documentation: clarify latest IntelliJ version use
  Elasticsearch builders: fix the Eclipse warnings
  Remove stale references to no longer used jackson libraries
  Add 'docker' tag to build rules for Elasticsearch tests
  ReindexIT: Split Elasticsearch test out to a separate class

Due to change I7c1461c45 ("ReindexIT: Split Elasticsearch test out to
a separate class") it is now possible to re-introduce the other changes
that were reverted in previous merges from stable-2.14 to stable-2.15:

- Iccf443102 ("Acceptance tests: Replace embedded ES with docker
  testcontainer")

- I57e5d0718 ("Acceptance tests: Remove ES bootstrap boilerplate")

Although the reindex tests for Elasticsearch still don't work on the
stable-2.15 branch (issue 8799), they are now isolated in their own
class and the tests can be skipped using the @Ignore annotation.

Change-Id: Ia19ea3fc68d80e0d20ff3cbed2baa49981db401e
2018-05-29 15:27:05 +09:00
David Pursehouse
d92ba3bc8d Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
  ElasticContainer: Allow to specify the docker container version to create
  ElasticContainer: Include cause in AssumptionViolatedException
  ElasticContainer: Create with static method
  Acceptance tests: Replace embedded ES with docker testcontainer
  Elasticsearch: replace native API in prod w/ REST

Changes to ReindexIT done in Iccf443102 ("Acceptance tests: Replace embedded
ES with docker testcontainer") are reverted in this merge since that test
currently doesn't work with Elasticsearch on stable-2.15 (issue 8799).

Change-Id: I21d8b10ebd450c7dc840846a5a0d836b4243dacc
2018-05-29 08:52:24 +09:00
David Pursehouse
d794850e1c Remove stale references to no longer used jackson libraries
Dependency on jackson-dataformat-cbor and jackson-dataformat-smile was
removed in change Iccf443102. They were removed from the WORKSPACE, but
references to them were left in the lib/ folder.

Change-Id: I8d04842fb238a6749f6a97f9ce809f99e16beec5
2018-05-28 21:46:17 +09:00
David Ostrovsky
5f40a6adff Acceptance tests: Replace embedded ES with docker testcontainer
Testcontainers is a Java 8 library that supports JUnit tests, providing
lightweight, throwaway instances of common databases, Selenium web
browsers, or anything else that can run in a Docker container.

This change replaces ES integration test that currently uses embedded
ES mode with ES docker image using Testcontainers library. All this is
done from within acceptance tests.

This change removes dependency on ES server stack for the test code. As
the consequence, this stack can be removed.

Prerequisite for this change is installed docker service on the SUT. If
docker service is not installed, assumption violation is raised so that
the tests don't fail. Unfortunately, due to this missing Bazel feature,
JUnit assumption violations are not reflected on the Bazel UI: [1] yet.

[1] https://github.com/bazelbuild/bazel/issues/3476

Change-Id: Iccf44310292cc44bff9173f2a4ea757b43f77183
2018-05-28 14:30:23 +09:00
Marco Miller
9b4b09ee61 Elasticsearch: replace native API in prod w/ REST
Remove jest API which depends on Elasticsearch native API (also
removed), so no longer depend on lucene for this scope. Replace such
removed dependencies with the Elasticsearch low-level API, which does
not depend on Lucene. That now used API is a REST client with minimal
dependencies, indeed. -As opposed to Elastic's current high-level API,
which still depends on lucene and other Gerrit-constraining libraries.

Do so in order to decouple the elasticsearch client from lucene in
Gerrit. That REST client does not logically require Lucene anyway. Most
importantly, such decoupling now enables upcoming support for more than
just one Elasticsearch server version. This includes the new possibility
of bumping the latter to multiple yet later versions, such as 5 and 6.x.
The currently used version (2.4) should also still be kept, for a while.

Bumping such versions will likely require some Elasticsearch client code
adaptations, so that Gerrit can (dynamically?) switch between either
Elasticsearch server version to eventually support (hopefully soon).

Doing the same for the elasticsearch tests in Gerrit is to be done using
another change or more changes.

Add a partial and customized fork of [1], based on [1]'s commit [2], to
preserve the ability of building proper json requests for Elasticsearch.
Put that forked json-generating code under a new 'builders' sub-package.
There should be a possibility in some near future to consider removing
that fork, based on potential progress such as the one proposed in [3].
Meanwhile, this fork shall be maintained to usual Gerrit quality levels.

[1] https://github.com/elastic/elasticsearch
[2] tag: v2.4.4
[3] https://github.com/elastic/elasticsearch/issues/30791

Bug: Issue 6094
Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
2018-05-28 14:30:23 +09:00
David Pursehouse
d2d2045574 Merge "Upgrade guava to 25.1-jre" 2018-05-27 06:27:41 +00:00
David Pursehouse
80026a8398 Upgrade guava to 25.1-jre
Change-Id: I16677d897a4da9f2a5072586984b9a2959df503a
2018-05-25 09:52:36 +09:00