Commit Graph

353 Commits

Author SHA1 Message Date
Nik Everett b0ab02e35c Remove and ban ImmutableSet#copyOf
It was used heavily in the Guice we've embedded.
2015-09-23 15:37:49 -04:00
Nik Everett 6ecda41485 Remove and ban ImmutableSet#builder 2015-09-23 13:55:34 -04:00
Nik Everett 52f3c89c3b Remove and ban ImmutableMap#entrySet
Banning `ImmutableSet` outright is too much to do all at once - this starts
the process by banning `ImmutableMap#entrySet` - one of the more common ways
that `ImmutableSet`s come up. It then starts to remove calls to
`ImmutableMap#entrySet` by changing declarations from `ImmutableMap` to `Map`.

Unfortunately this process is like pulling on a long, windy string and one
declaration change requires another which requires 5 more which in turn
require another few. So this change is rather large.

As such, to keep the changes manageable they only remove `ImmutableMap` from
the signatures that are needed for `entrySet` and make little effort to stop
using `ImmutableMap` internally. Removing the usages of `ImmutableMap`
complicates immutability guarantees and will be done separately.
2015-09-23 11:07:28 -04:00
Robert Muir 689af1a6d6 Factor expressions scripts out to lang-expression plugin 2015-09-22 20:33:47 -04:00
Nik Everett e284210652 [core] Forbid ForwardingSet
Removes CopyOnWriteHashSet, our only usage of ForwardingSet. We weren't
using it.

Related to #13224
2015-09-22 12:31:08 -04:00
Chris Earle 8a32891f1d Adding the actual method name of the replacement method for FileSystem.getDefault 2015-09-22 10:42:14 -04:00
Chris Earle eb266cdde6 Add packages to the 'Use xyz instead' comments 2015-09-22 10:42:14 -04:00
David Pilato f230eabc15 [cloud-azure] Split azure plugin in 3 plugins
Until now we had a cloud-azure plugin which is providing 3 distinct features:

* discovery on Azure
* snapshot/restore on Aure
* SMB store

This commit splits the plugin by feature so people can use either one or the other or both features.

Doc is updated accordingly.
2015-09-21 17:55:23 +02:00
Jason Tedor c281826702 Remove and forbid use of com.google.common.primitives.Ints
This commit removes and now forbids all uses of
com.google.common.primitives.Ints across the codebase. This is one of
many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-18 08:43:17 -04:00
David Pilato 422cfa27c0 Merge branch 'maven/elasticsearch-already-excluded' 2015-09-17 18:10:04 +02:00
Jason Tedor 257f3e862f Add missing forbidden entries for removed Guava classes 2015-09-15 11:15:36 -04:00
Alexander Reelsen dea0243193 Release script: Major Improvements
In order to be able to clean up broken steps in the release, one should
be able to run each step individually. So now one needs to specifiy each
step to run via cmdline argument

* --deploy-sonatype: runs `mvn deploy` and pushes to the staging mvn repo
* --deploy-s3: copies all artifacts over to the s3bucket
* --deploy-s3-repos: Creates the s3 repositories
* --no-install option, so that an existing mvn repo can be used for s3 operations

Also, several minor changes have been added

* Fixed typo in smoke test reference for email
* Checking for correct AWS environment variables
* Only create releases directory if it does not exist
* RPM sign check is only executed after `mvn install`
* Various path fixes for deb/rpm-s3 uploads
* Added output of deb/rpm-s3 commands for easier debugging
* Add configurable destination s3 bucket
* Removed verbosity, always be verbose
* Added color to the command which is being running right now, to differentiate from console output
2015-09-15 17:09:35 +02:00
Jason Tedor b912ad7d56 Remove file that was inadvertently committed 2015-09-15 10:42:11 -04:00
Jason Tedor b3c6327caf Remove and forbid use of com.google.common.base.Joiner
This commit removes and now forbids all uses of
com.google.common.base.Joiner across the codebase. This is one of many
steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-15 10:30:42 -04:00
Jason Tedor 7a29febd72 Remove and forbid use of com.google.common.math.LongMath
This commit removes and now forbids all uses of
com.google.common.math.LongMath across the codebase. This is one step
of many in the eventual removal of Guava as a dependency.
2015-09-15 10:28:02 -04:00
Simon Willnauer ff4a11aa32 Replace and ban next batch of Guava classes
This commit replaces and bans:
 * com.google.common.util.concurrent.UncheckedExecutionException
 * com.google.common.util.concurrent.AtomicLongMap
 * com.google.common.primitives.Longs
 * com.google.common.io.ByteStreams
 * com.google.common.collect.UnmodifiableIterator
 * com.google.common.collect.ObjectArrays
 * com.google.common.collect.Multimap
 * com.google.common.collect.MultimapBuilder

Relates to #13224
2015-09-15 14:44:41 +02:00
Jason Tedor 527ab95c39 Remove and forbid use of com.google.common.collect.Iterables
This commit removes and now forbids all uses of
com.google.common.collect.Iterables across the codebase. This is one of
many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-15 07:47:36 -04:00
Jason Tedor f5c408535d Remove and forbid use of com.google.common.base.Preconditions
This commit removes and now forbids all uses of
com.google.common.base.Preconditions across the codebase. This is one
of many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-15 07:23:34 -04:00
Alexander Reelsen 5f6aeb982d Release script: Improve automation for package repositories
* Automatic package repository creation for debian and rpm repositories using deb-s3 and rpm-s3 tools
* Fixing paths in email for repositories
* Add manual verification step for maven staging repo
* Do not create release directory in /tmp, because we might loose it on VMs
* Removed unused download-s3 script
* Add signage check for RPM
* Removed download-s3.py/upload-s3.py, as they are unused

Closes #13209
2015-09-14 15:03:30 +02:00
Simon Willnauer 30bd46ab25 Replace LoadingCache usage with a simple ConcurrentHashMap
This commit replaces the usage of LoadedCache with a simple CHM and calls
to computeIfAbsent and adds LoadingCache and CacheLoader to forbidden APIs

Relates to #13224
2015-09-14 13:25:58 +02:00
Alexander Reelsen a96350d785 Release: Add 1.7.2 bwc indices/versions
* Added BWC indices
* Added snapshot version to Version.java
* Fixed create_bwc_index to use localhost instead of localhost and 127.0.0.1 (problem with ipv4/6 setup)
2015-09-14 12:58:46 +02:00
Simon Willnauer 40959068d5 Remove and forbid use of guava Function, Charsets, Collections2
This commit removes and now forbids all uses of
Function, Charsets, Collections2  across the codebase. This
is one of many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-14 10:27:12 +02:00
Robert Muir b16e1569fe Remove all setAccessible in tests and forbid 2015-09-12 19:46:39 -04:00
Robert Muir d6f56030d8 ban setAccessible from core code.
In addition to being a big security problem, setAccessible is a risk
for java 9 migration. We need to clean up our code so we can ban it
and eventually enforce this with security manager for third-party code, too,
or we may have problems.

Instead of using setAccessible, use the correct modifier (e.g. public).

TODO: ban in tests
TODO: ban in security manager at runtime
2015-09-12 02:11:06 -04:00
Jason Tedor d6d8d30d47 Remove and forbid use of com.google.common.collect.ImmutableSortedMap
This commit removes and now forbids all uses of
com.google.common.collect.ImmutableSortedMap across the codebase. This
is one of many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-11 17:42:19 -04:00
Simon Willnauer 7b0f086946 Remove and forbid use of several com.google.common.util. classes
This commit replaces:
 * com.google.common.util.concurrent.ListenableFuture
 * com.google.common.util.concurrent.SettableFuture
 * com.google.common.util.concurrent.Futures
 * com.google.common.util.concurrent.MoreExecutors

And forbits its usage via forbidden APIs. This is one of
many steps in the eventual removal of Guava as a dependency.

Relates to #13224
2015-09-11 21:15:12 +02:00
Jason Tedor 722a08d4d1 Forbid Guava in all instead of core
Now that Guava is no longer shaded, it can be forbidden in all instead
of core.

Relates #13224
2015-09-11 14:53:15 -04:00
Adrien Grand e988a9edc6 Merge pull request #13439 from rmuir/1702090
upgrade lucene to r1702265
2015-09-11 09:48:43 +02:00
Jason Tedor b5b22d4b01 Remove and forbid use of com.google.common.collect.Queues
This commit removes and now forbids all uses of
com.google.common.collect.Queues across the codebase. This is one of
many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-10 23:59:59 -04:00
Jason Tedor 65353b8a32 Remove and forbid use of com.google.common.collect.ImmutableSortedSet
This commit removes and now forbids all uses of
com.google.common.collect.ImmutableSortedSet across the codebase. This
is one of many steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-10 23:33:55 -04:00
Robert Muir dd208002c9 Merge branch 'master' into 1702090 2015-09-10 21:41:07 -04:00
Jason Tedor 5d4d34ab16 Remove and forbid use of c.g.c.b.Preconditions#checkNotNull
This commit removes and now forbids all uses of
com.google.common.base.Preconditions#checkNotNull across the codebase.
This is one of many steps in the eventual removal of Guava as a
dependency.

Relates #13224
2015-09-10 17:57:00 -04:00
Robert Muir c1f2fc76c2 Upgrade lucene to r1702090
The semantics of the `boost` parameter for `function_score` changed. This is
due to the fact that Lucene now requires that query boosts and top-level boosts
are applied the same way.
2015-09-10 23:36:43 +02:00
Ryan Ernst 47de1bd923 Merge pull request #13443 from rjernst/simplify_bwc_path
Move static bwc indexes to a shared location
2015-09-10 10:31:50 -07:00
Jason Tedor 3bd1d38176 Remove and forbid use of com.google.common.collect.Sets
This commit removes and now forbids all uses of
com.google.common.collect.Sets across the codebase. This is one of many
steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-10 11:22:09 -04:00
Nik Everett 56c3471851 Fix test for _cat/nodeattrs
Adds a node attribute to all test runs and uses the attribute to test
`_cat/nodeattrs`.

Note that its quite possible create an impressively slow regex while doing
this and you have to be careful. See comment in commit for more if curious.

Closes #12558
2015-09-10 10:50:51 -04:00
Alexander Reelsen 9421aaea4d Release: Remove deprecated method of repository creation
This removes the old shell script for repository creation.
Small fix for gpg key name as well.
2015-09-10 11:14:31 +02:00
Ryan Ernst 8f75c2b3a8 Tests: Move static bwc indexes to a shared location
There are a few tests that currently use the statically generated
backcompat indexes. This change moves them to a shared location, so they
no longer have to build a path based on the package name of the old
index tests.
2015-09-09 15:42:26 -07:00
Jason Tedor 2a5412ebf0 Remove and forbid use of com.google.common.collect.Maps
This commit removes and now forbids all uses of
com.google.common.collect.Maps across the codebase. This is one of many
steps in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-09 17:41:41 -04:00
Jason Tedor 1806c1e0c7 Remove and forbid use of com.google.common.base.Throwables
This commit removes and now forbids all uses of
com.google.common.base.Throwables across the codebase.

For uses of com.google.common.base.Throwables#getStackTraceAsString,
use org.elasticsearch.ExceptionsHelper#stackTrace.

Relates #13224
2015-09-08 21:56:23 -04:00
Alexander Reelsen 28970e7d54 Release: Add script to validate mvn repositories
This script allows to ensure that artifacts have been pushed to
a repository after running `mvn deploy`. This will allow us to
check that all of our artifacts have been deployed to sonatype and
the S3 bucket.

Basically it takes the contents of a local mvn repository and
runs HTTP HEAD requests against all artifacts. It also compares if
the length returned by the Content-Length header is the same as the
size of the artifact locally.
2015-09-08 14:12:33 +02:00
David Pilato b89efbed69 [maven] assembly: elasticsearch is already excluded
As elasticsearch is marked as provided we don't need to explicitly exclude it from the assembly descriptor.

We get a warning today for all plugins, the following:

```
[INFO] --- maven-assembly-plugin:2.5.5:single (default) @ repository-s3 ---
[INFO] Reading assembly descriptor: /path/to/plugin-assembly.xml
[WARNING] The following patterns were never triggered in this artifact exclusion filter:
o  'org.elasticsearch:elasticsearch'
[INFO] Building zip: /path/to/target/releases/repository-s3-3.0.0-SNAPSHOT.zip
[INFO]
```

It now gives:

```
[INFO] --- maven-assembly-plugin:2.5.5:single (default) @ repository-s3 ---
[INFO] Reading assembly descriptor: /path/to/plugin-assembly.xml
[INFO] Building zip: /path/to/target/releases/repository-s3-3.0.0-SNAPSHOT.zip
[INFO]
```
2015-09-08 08:55:31 +02:00
Jason Tedor a6ffe8f6d5 Remove and forbid use of com.google.common.base.Strings
This commit removes and now forbids all uses of
com.google.common.base.Strings across the codebase.

For uses of com.google.common.base.Strings.isNullOrEmpty, use
org.elasticsearch.common.Strings.isNullOrEmpty.

For uses of com.google.common.base.Strings.padStart use
org.elasticsearch.common.Strings.padStart.

For uses of com.google.common.base.Strings.nullToEmpty use
org.elasticsearch.common.Strings.coalesceToEmpty.

Relates #13224
2015-09-07 09:40:14 -04:00
Jason Tedor 8a3411e5e4 Remove and forbid the use of com.google.common.base.Predicate(s)?
This commit removes and now forbids all uses of
com.google.common.base.Predicate and com.google.common.base.Predicates
across the codebase. This is one of the many steps in the eventual
removal of Guava as a dependency. This was enabled by #13314.

Relates #13224
2015-09-06 07:20:24 -04:00
Jason Tedor 14e4882425 Remove and forbid use of com.google.common.base.Objects
This commit removes and now forbids all uses of
com.google.common.base.Objects across the codebase. This is a small
step in the eventual removal of Guava as a dependency.

Relates #13224
2015-09-05 08:52:30 -04:00
Clinton Gormley 877589e153 In the license checker, include the "ignore prefix" parameter in the output
Closes #13322
2015-09-03 21:00:11 +02:00
Simon Willnauer 796701d52e Move version to 3.0.0-SNAPSHOT 2015-09-03 10:43:28 +02:00
David Pilato 1a8a2c9bc2 [qa] Add smoke test client module
This commit adds a new smoke test for testing client as a end Java user.

It starts a cluster in `pre-integration-test` phase, then execute the client operations defined as JUnit tests within `integration-test` phase and then stop the external cluster in `post-integration-test` phase.

You can also run test classes from your IDE.

* Start an external node on your machine with `bin/elasticsearch` (note that you can test Java API regressions if you run an older or newer node version)
* Run the JUnit test. By default, it will run tests on `localhost:9300` but you can change this setting using system property `tests.cluster`. It also expects the default `cluster.name` (`elasticsearch`).

This commit also starts adding [snippets as defined by Maven](https://maven.apache.org/guides/mini/guide-snippet-macro.html) to help keeping automatically synchronized the Java reference guide with the current code.

Our documentation builder tool does not support snippets though but we will most likely support it at some point.
2015-09-02 17:34:54 +02:00
David Pilato 34ee4c2d66 [build] remove shaded elasticsearch version
The shaded version of elasticsearch was built at the very beginning to avoid dependency conflicts in a specific case where:

* People use elasticsearch from Java
* People needs to embed elasticsearch jar within their own application (as it's today the only way to get a `TransportClient`)
* People also embed in their application another (most of the time older) version of dependency we are using for elasticsearch, such as: Guava, Joda, Jackson...

This conflict issue can be solved within the projects themselves by either upgrade the dependency version and use the one provided by elasticsearch or by shading elasticsearch project and relocating some conflicting packages.

Example
-------

As an example, let's say you want to use within your project `Joda 2.1` but elasticsearch `2.0.0-beta1` provides `Joda 2.8`.
Let's say you also want to run all that with shield plugin.

Create a new maven project or module with:

```xml
<groupId>fr.pilato.elasticsearch.test</groupId>
<artifactId>es-shaded</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <elasticsearch.version>2.0.0-beta1</elasticsearch.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>shield</artifactId>
        <version>${elasticsearch.version}</version>
    </dependency>
</dependencies>
```

And now shade and relocate all packages which conflicts with your own application:

```xml
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <relocations>
                            <relocation>
                                <pattern>org.joda</pattern>
                                <shadedPattern>fr.pilato.thirdparty.joda</shadedPattern>
                            </relocation>
                        </relocations>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
```

You can create now a shaded version of elasticsearch + shield by running `mvn clean install`.

In your project, you can now depend on:

```xml
<dependency>
    <groupId>fr.pilato.elasticsearch.test</groupId>
    <artifactId>es-shaded</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.1</version>
</dependency>
```

Build then your TransportClient as usual:

```java
TransportClient client = TransportClient.builder()
        .settings(Settings.builder()
                        .put("path.home", ".")
                        .put("shield.user", "username:password")
                        .put("plugin.types", "org.elasticsearch.shield.ShieldPlugin")
        )
        .build();
client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("localhost", 9300)));

// Index some data
client.prepareIndex("test", "doc", "1").setSource("foo", "bar").setRefresh(true).get();
SearchResponse searchResponse = client.prepareSearch("test").get();
```

If you want to use your own version of Joda, then import for example `org.joda.time.DateTime`. If you want to access to the shaded version (not recommended though), import `fr.pilato.thirdparty.joda.time.DateTime`.

You can run a simple test to make sure that both classes can live together within the same JVM:

```java
CodeSource codeSource = new org.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource();
System.out.println("unshaded = " + codeSource);

codeSource = new fr.pilato.thirdparty.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource();
System.out.println("shaded = " + codeSource);
```

It will print:

```
unshaded = (file:/path/to/joda-time-2.1.jar <no signer certificates>)
shaded = (file:/path/to/es-shaded-1.0-SNAPSHOT.jar <no signer certificates>)
```

This PR also removes fully-loaded module.

By the way, the project can now build with Maven 3.3.3 so we can relax a bit our maven policy.
2015-09-02 11:57:10 +02:00
Jason Tedor a8bace9f97 Remove and forbid final uses of ImmutableList 2015-08-31 14:35:23 -04:00