update to Gradle 5.2.1, simpler API without TimeValue, fixing testframework/netty dependencies

This commit is contained in:
Jörg Prante 2019-02-15 11:10:15 +01:00
parent 1b17e3ac7d
commit 0ba6b6d99d
67 changed files with 325 additions and 134 deletions

View file

@ -1,16 +1,9 @@
dependencies { dependencies {
compile("org.elasticsearch.client:transport:${rootProject.property('elasticsearch.version')}") {
exclude group: 'org.elasticsearch', module: 'securesm'
exclude group: 'org.elasticsearch.plugin', module: 'transport-netty3-client'
exclude group: 'org.elasticsearch.plugin', module: 'reindex-client'
exclude group: 'org.elasticsearch.plugin', module: 'percolator-client'
exclude group: 'org.elasticsearch.plugin', module: 'lang-mustache-client'
}
// we try to override the Elasticsearch netty by our netty version which is more recent
compile "io.netty:netty-buffer:${rootProject.property('netty.version')}" compile "io.netty:netty-buffer:${rootProject.property('netty.version')}"
compile "io.netty:netty-codec-http:${rootProject.property('netty.version')}" compile "io.netty:netty-codec-http:${rootProject.property('netty.version')}"
compile "io.netty:netty-handler:${rootProject.property('netty.version')}" compile "io.netty:netty-handler:${rootProject.property('netty.version')}"
compile "org.xbib.elasticsearch:elasticsearch:${rootProject.property('elasticsearch-server.version')}"
} }
jar { jar {

View file

@ -75,7 +75,7 @@ subprojects {
baseName "${rootProject.name}-${project.name}" baseName "${rootProject.name}-${project.name}"
} }
javadoc { /*javadoc {
options.docletpath = configurations.asciidoclet.files.asType(List) options.docletpath = configurations.asciidoclet.files.asType(List)
options.doclet = 'org.xbib.asciidoclet.Asciidoclet' options.doclet = 'org.xbib.asciidoclet.Asciidoclet'
options.overview = "src/docs/asciidoclet/overview.adoc" options.overview = "src/docs/asciidoclet/overview.adoc"
@ -85,7 +85,7 @@ subprojects {
configure(options) { configure(options) {
noTimestamp = true noTimestamp = true
} }
} }*/
/*task javadocJar(type: Jar, dependsOn: classes) { /*task javadocJar(type: Jar, dependsOn: classes) {
baseName "${rootProject.name}-${project.name}" baseName "${rootProject.name}-${project.name}"

View file

@ -44,7 +44,7 @@ artifacts {
test { test {
enabled = false enabled = false
jvmArgs "-javaagent:" + configurations.alpnagent.asPath //jvmArgs "-javaagent:" + configurations.alpnagent.asPath
systemProperty 'path.home', project.buildDir.absolutePath systemProperty 'path.home', project.buildDir.absolutePath
testLogging { testLogging {
showStandardStreams = true showStandardStreams = true
@ -63,3 +63,8 @@ esTest {
} }
esTest.dependsOn jar, testJar esTest.dependsOn jar, testJar
dependencyLicenses.enabled = false
// we not like to examine Netty
thirdPartyAudit.enabled = false

View file

@ -0,0 +1 @@
f14124d1557cd7c21742f09cd18913a861125e56

View file

@ -0,0 +1 @@
2bc144784abc748426b125a948b0bdd4fc4dd7d6

View file

@ -0,0 +1 @@
af8cf6c3e7de988bbb7e6e441a2235ba1df8eaf8

View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View file

@ -0,0 +1 @@
436454f1e6e821f6f18def7a2e4b467eeb341430

View file

@ -0,0 +1 @@
80ef947c9edfaacb261ee27e2c7fa5968b3eeaa6

View file

@ -0,0 +1 @@
abf31b393745f2a6e133819ee7485420d6bc5160

View file

@ -0,0 +1 @@
68463acec824eb54989fcecbe44074a41ee639e3

View file

@ -0,0 +1 @@
4c232fdaf23b8c7b1ff1ca1ba9b91fcc0fa01938

View file

@ -0,0 +1 @@
7834ee69f91a3360f17a31cf6a27b245a3a2f668

View file

@ -0,0 +1 @@
b10c7f51ab98e6f6f252c931534edbb632cb108e

View file

@ -0,0 +1 @@
824c180dc70fda00b70a146d2f2be9a8f36cfdbb

View file

@ -0,0 +1 @@
68fba4b570c4717cda49a3f187e2bfb909697fc8

View file

@ -0,0 +1 @@
e8949a50a223ab837edc312e34ee597febe86464

View file

@ -0,0 +1 @@
0d4fdb13d5832a0f348e4d855c71201a2b15d560

View file

@ -0,0 +1 @@
600762bf6861fa62b061782debb6fcdeff1f1984

View file

@ -0,0 +1 @@
ad557dffc0777b1b24558d6c57b77b0198dbb58d

View file

@ -0,0 +1 @@
398b725cbaca8c691b74759ae6c3d69b8eeb0574

View file

@ -0,0 +1 @@
3bcc2db64f7b0ebacba552aff319b41962c2df96

View file

@ -0,0 +1 @@
f3873f5ed509b5c169fb7cbaf34b694d8c748926

View file

@ -0,0 +1 @@
b9f9af72dfcd8464c16169670d52c6dc5fe65897

View file

@ -0,0 +1 @@
fe9c516ca4ead60f713eceb398e6f636b83d0a5b

View file

@ -0,0 +1 @@
b1bd19c1f50b6764f104cdcbfa3f01b1b3bb2045

View file

@ -0,0 +1 @@
ce2c501f3c72eb1099467d708b9c134ed0b7bb2a

View file

@ -0,0 +1 @@
62a48b60b17e6d2a823439a5e68f31ef196f11e7

View file

@ -0,0 +1 @@
02855ff60b4cecf9dd15e6e91e3cc0902d2e7eac

View file

@ -0,0 +1 @@
9d28517afc71abe5b7f224944280d5f03ed2f2cc

View file

@ -80,9 +80,6 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/**
*
*/
public abstract class AbstractClient implements ClientMethods { public abstract class AbstractClient implements ClientMethods {
private static final Logger logger = LogManager.getLogger(AbstractClient.class.getName()); private static final Logger logger = LogManager.getLogger(AbstractClient.class.getName());
@ -109,9 +106,9 @@ public abstract class AbstractClient implements ClientMethods {
protected int maxConcurrentRequests = DEFAULT_MAX_CONCURRENT_REQUESTS; protected int maxConcurrentRequests = DEFAULT_MAX_CONCURRENT_REQUESTS;
protected ByteSizeValue maxVolume = DEFAULT_MAX_VOLUME_PER_REQUEST; protected String maxVolumePerRequest = DEFAULT_MAX_VOLUME_PER_REQUEST;
protected TimeValue flushInterval = DEFAULT_FLUSH_INTERVAL; protected String flushIngestInterval = DEFAULT_FLUSH_INTERVAL;
@Override @Override
public AbstractClient init(ElasticsearchClient client, Settings settings, public AbstractClient init(ElasticsearchClient client, Settings settings,
@ -209,9 +206,9 @@ public abstract class AbstractClient implements ClientMethods {
BulkProcessor.Builder builder = BulkProcessor.builder(this.client, listener) BulkProcessor.Builder builder = BulkProcessor.builder(this.client, listener)
.setBulkActions(maxActionsPerRequest) .setBulkActions(maxActionsPerRequest)
.setConcurrentRequests(maxConcurrentRequests) .setConcurrentRequests(maxConcurrentRequests)
.setFlushInterval(flushInterval); .setFlushInterval(TimeValue.parseTimeValue(flushIngestInterval, "flushIngestInterval"));
if (maxVolume != null) { if (maxVolumePerRequest != null) {
builder.setBulkSize(maxVolume); builder.setBulkSize(ByteSizeValue.parseBytesSizeValue(maxVolumePerRequest, "maxVolumePerRequest"));
} }
this.bulkProcessor = builder.build(); this.bulkProcessor = builder.build();
} }
@ -239,14 +236,14 @@ public abstract class AbstractClient implements ClientMethods {
} }
@Override @Override
public ClientMethods maxVolumePerRequest(ByteSizeValue maxVolume) { public ClientMethods maxVolumePerRequest(String maxVolumePerRequest) {
this.maxVolume = maxVolume; this.maxVolumePerRequest = maxVolumePerRequest;
return this; return this;
} }
@Override @Override
public ClientMethods flushIngestInterval(TimeValue flushInterval) { public ClientMethods flushIngestInterval(String flushIngestInterval) {
this.flushInterval = flushInterval; this.flushIngestInterval = flushIngestInterval;
return this; return this;
} }
@ -538,11 +535,12 @@ public abstract class AbstractClient implements ClientMethods {
} }
@Override @Override
public ClientMethods waitForResponses(TimeValue maxWaitTime) throws InterruptedException, ExecutionException { public ClientMethods waitForResponses(String maxWaitTime) throws InterruptedException, ExecutionException {
if (closed) { if (closed) {
throwClose(); throwClose();
} }
while (!bulkProcessor.awaitClose(maxWaitTime.getMillis(), TimeUnit.MILLISECONDS)) { long millis = TimeValue.parseTimeValue(maxWaitTime, "millis").getMillis();
while (!bulkProcessor.awaitClose(millis, TimeUnit.MILLISECONDS)) {
logger.warn("still waiting for responses"); logger.warn("still waiting for responses");
} }
return this; return this;
@ -571,7 +569,7 @@ public abstract class AbstractClient implements ClientMethods {
} }
@Override @Override
public void waitForCluster(String statusString, TimeValue timeout) throws IOException { public void waitForCluster(String statusString, String timeout) throws IOException {
if (client() == null) { if (client() == null) {
return; return;
} }
@ -632,7 +630,7 @@ public abstract class AbstractClient implements ClientMethods {
} }
public int updateReplicaLevel(String index, int level) throws IOException { public int updateReplicaLevel(String index, int level) throws IOException {
waitForCluster("YELLOW", TimeValue.timeValueSeconds(30)); waitForCluster("YELLOW","30s");
updateIndexSetting(index, "number_of_replicas", level); updateIndexSetting(index, "number_of_replicas", level);
return waitForRecovery(index); return waitForRecovery(index);
} }

View file

@ -3,8 +3,6 @@ package org.xbib.elasticsearch.client;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/**
*/
public interface BulkControl { public interface BulkControl {
void startBulk(String indexName, long startRefreshInterval, long stopRefreshInterval); void startBulk(String indexName, long startRefreshInterval, long stopRefreshInterval);

View file

@ -3,9 +3,6 @@ package org.xbib.elasticsearch.client;
import org.xbib.metrics.Count; import org.xbib.metrics.Count;
import org.xbib.metrics.Metered; import org.xbib.metrics.Metered;
/**
*
*/
public interface BulkMetric { public interface BulkMetric {
Metered getTotalIngest(); Metered getTotalIngest();

View file

@ -263,7 +263,7 @@ public class BulkProcessor implements Closeable {
/** /**
* Sets the number of concurrent requests allowed to be executed. A value of 0 means that only a single * Sets the number of concurrent requests allowed to be executed. A value of 0 means that only a single
* request will be allowed to be executed. A value of 1 means 1 concurrent request is allowed to be executed * request will be allowed to be executed. A value of 1 means 1 concurrent request is allowed to be executed
* while accumulating new bulk requests. Defaults to <tt>1</tt>. * while accumulating new bulk requests. Defaults to {@code 1}.
* *
* @param concurrentRequests maximum number of concurrent requests * @param concurrentRequests maximum number of concurrent requests
* @return this builder * @return this builder
@ -275,7 +275,7 @@ public class BulkProcessor implements Closeable {
/** /**
* Sets when to flush a new bulk request based on the number of actions currently added. Defaults to * Sets when to flush a new bulk request based on the number of actions currently added. Defaults to
* <tt>1000</tt>. Can be set to <tt>-1</tt> to disable it. * {@code 1000}. Can be set to {@code -1} to disable it.
* *
* @param bulkActions mbulk actions * @param bulkActions mbulk actions
* @return this builder * @return this builder
@ -287,7 +287,7 @@ public class BulkProcessor implements Closeable {
/** /**
* Sets when to flush a new bulk request based on the size of actions currently added. Defaults to * Sets when to flush a new bulk request based on the size of actions currently added. Defaults to
* <tt>5mb</tt>. Can be set to <tt>-1</tt> to disable it. * {@code 5mb}. Can be set to {@code -1} to disable it.
* *
* @param bulkSize bulk size * @param bulkSize bulk size
* @return this builder * @return this builder
@ -299,8 +299,8 @@ public class BulkProcessor implements Closeable {
/** /**
* Sets a flush interval flushing *any* bulk actions pending if the interval passes. Defaults to not set. * Sets a flush interval flushing *any* bulk actions pending if the interval passes. Defaults to not set.
* Note, both {@link #setBulkActions(int)} and {@link #setBulkSize(org.elasticsearch.common.unit.ByteSizeValue)} * Note, both {@link #setBulkActions(int)} and {@link #setBulkSize(ByteSizeValue)}
* can be set to <tt>-1</tt> with the flush interval set allowing for complete async processing of bulk actions. * can be set to {@code -1} with the flush interval set allowing for complete async processing of bulk actions.
* *
* @param flushInterval flush interval * @param flushInterval flush interval
* @return this builder * @return this builder

View file

@ -5,14 +5,10 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.ServiceLoader; import java.util.ServiceLoader;
/**
*
*/
public final class ClientBuilder implements Parameters { public final class ClientBuilder implements Parameters {
private final Settings.Builder settingsBuilder; private final Settings.Builder settingsBuilder;
@ -87,18 +83,18 @@ public final class ClientBuilder implements Parameters {
return this; return this;
} }
public <C extends ClientMethods> C getClient(Class<C> clientClass) throws IOException { public <C extends ClientMethods> C getClient(Class<C> clientClass) {
return getClient(null, clientClass); return getClient(null, clientClass);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <C extends ClientMethods> C getClient(Client client, Class<C> clientClass) throws IOException { public <C extends ClientMethods> C getClient(Client client, Class<C> clientClass) {
Settings settings = settingsBuilder.build(); Settings settings = settingsBuilder.build();
return (C) clientMethodsMap.get(clientClass) return (C) clientMethodsMap.get(clientClass)
.maxActionsPerRequest(settings.getAsInt(MAX_ACTIONS_PER_REQUEST, DEFAULT_MAX_ACTIONS_PER_REQUEST)) .maxActionsPerRequest(settings.getAsInt(MAX_ACTIONS_PER_REQUEST, DEFAULT_MAX_ACTIONS_PER_REQUEST))
.maxConcurrentRequests(settings.getAsInt(MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_REQUESTS)) .maxConcurrentRequests(settings.getAsInt(MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_REQUESTS))
.maxVolumePerRequest(settings.getAsBytesSize(MAX_VOLUME_PER_REQUEST, DEFAULT_MAX_VOLUME_PER_REQUEST)) .maxVolumePerRequest(settings.get(MAX_VOLUME_PER_REQUEST, DEFAULT_MAX_VOLUME_PER_REQUEST))
.flushIngestInterval(settings.getAsTime(FLUSH_INTERVAL, DEFAULT_FLUSH_INTERVAL)) .flushIngestInterval(settings.get(FLUSH_INTERVAL, DEFAULT_FLUSH_INTERVAL))
.init(client, settings, metric, control); .init(client, settings, metric, control);
} }
} }

View file

@ -396,6 +396,7 @@ public interface ClientMethods extends Parameters {
/** /**
* Shutdown the ingesting. * Shutdown the ingesting.
* @throws IOException is shutdown fails
*/ */
void shutdown() throws IOException; void shutdown() throws IOException;
} }

View file

@ -2,9 +2,6 @@ package org.xbib.elasticsearch.client;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
/**
*
*/
@FunctionalInterface @FunctionalInterface
public interface IndexAliasAdder { public interface IndexAliasAdder {

View file

@ -16,9 +16,6 @@ import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
/**
*
*/
public class NetworkUtils { public class NetworkUtils {
private static final Logger logger = LogManager.getLogger(NetworkUtils.class.getName()); private static final Logger logger = LogManager.getLogger(NetworkUtils.class.getName());
@ -253,9 +250,6 @@ public class NetworkUtils {
return left.length - right.length; return left.length - right.length;
} }
/**
*
*/
public enum ProtocolVersion { public enum ProtocolVersion {
IPV4, IPV6, IPV46, NONE IPV4, IPV6, IPV46, NONE
} }

View file

@ -1,13 +1,10 @@
package org.xbib.elasticsearch.client; package org.xbib.elasticsearch.client;
/**
*
*/
public interface Parameters { public interface Parameters {
int DEFAULT_MAX_ACTIONS_PER_REQUEST = 1000; int DEFAULT_MAX_ACTIONS_PER_REQUEST = 1000;
int DEFAULT_MAX_CONCURRENT_REQUESTS = Runtime.getRuntime().availableProcessors() * 4; int DEFAULT_MAX_CONCURRENT_REQUESTS = Runtime.getRuntime().availableProcessors();
String DEFAULT_MAX_VOLUME_PER_REQUEST = "10mb"; String DEFAULT_MAX_VOLUME_PER_REQUEST = "10mb";

View file

@ -5,8 +5,6 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/**
*/
public class SimpleBulkControl implements BulkControl { public class SimpleBulkControl implements BulkControl {
private final Set<String> indexNames = new HashSet<>(); private final Set<String> indexNames = new HashSet<>();

View file

@ -8,9 +8,6 @@ import org.xbib.metrics.Metered;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
/**
*
*/
public class SimpleBulkMetric implements BulkMetric { public class SimpleBulkMetric implements BulkMetric {
private final ScheduledExecutorService executorService; private final ScheduledExecutorService executorService;

View file

@ -10,7 +10,7 @@ import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequestBuilder
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;

View file

@ -11,7 +11,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
public class SearchTests extends ESSingleNodeTestCase { public class SearchTests extends ESSingleNodeTestCase {

View file

@ -12,7 +12,7 @@ import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
public class SimpleTests extends ESSingleNodeTestCase { public class SimpleTests extends ESSingleNodeTestCase {

View file

@ -5,7 +5,7 @@ import org.elasticsearch.client.Requests;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import java.io.IOException; import java.io.IOException;

View file

@ -6,15 +6,15 @@ release = 0
elasticsearch.version = 6.3.2 elasticsearch.version = 6.3.2
lucene.version = 7.3.1 lucene.version = 7.3.1
netty.version = 4.1.29.Final
tcnative.version = 2.0.15.Final tcnative.version = 2.0.15.Final
alpnagent.version = 2.0.7 alpnagent.version = 2.0.7
xbib-netty-http-client.version = 4.1.29.0 netty.version = 4.1.33.Final
netty-http.version = 4.1.33.0
xbib-metrics.version = 1.1.0 xbib-metrics.version = 1.1.0
# elasticsearch build plugin
elasticsearch-libs.version = 6.3.2.1 elasticsearch-libs.version = 6.3.2.1
elasticsearch-server.version = 6.3.2.1
elasticsearch-client.version = 6.3.2.1
elasticsearch-devkit.version = 6.3.2.4 elasticsearch-devkit.version = 6.3.2.4
spatial4j.version = 0.7 spatial4j.version = 0.7
jts.version = 1.15.1 jts.version = 1.15.1

Binary file not shown.

View file

@ -1,5 +1,6 @@
#Fri Feb 15 10:39:20 CET 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

4
gradlew vendored
View file

@ -155,11 +155,7 @@ if $cygwin ; then
fi fi
# Escape application args # Escape application args
<<<<<<< HEAD
save () { save () {
=======
save () {
>>>>>>> 6.3
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " " echo " "
} }

View file

@ -19,7 +19,8 @@ configurations {
dependencies { dependencies {
compile project(':common') compile project(':common')
compile "org.xbib:netty-http-client:${project.property('xbib-netty-http-client.version')}" compile "org.xbib:netty-http-client:${project.property('netty-http.version')}"
compile "org.xbib.elasticsearch:transport-netty4:${project.property('elasticsearch-server.version')}"
testCompile "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}" testCompile "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}"
testRuntime "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}" testRuntime "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}"
} }
@ -56,10 +57,10 @@ randomizedTest {
esTest { esTest {
enabled = true enabled = true
dependsOn jar, testJar
// test with the jars, not the classes, for security manager // test with the jars, not the classes, for security manager
// classpath = files(configurations.testRuntime) + configurations.main.artifacts.files + configurations.tests.artifacts.files // classpath = files(configurations.testRuntime) + configurations.main.artifacts.files + configurations.tests.artifacts.files
systemProperty 'tests.security.manager', 'true' systemProperty 'tests.security.manager', 'true'
// maybe we like some extra security policy for our code // some extra security policy for our code
systemProperty 'tests.security.policy', '/extra-security.policy' systemProperty 'tests.security.policy', '/extra-security.policy'
} }
esTest.dependsOn jar, testJar

View file

@ -9,10 +9,9 @@ import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
@ -98,7 +97,7 @@ public class HttpClientAliasTests extends ESSingleNodeTestCase {
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
client.shutdown(); client.shutdown();
if (client.hasThrowable()) { if (client.hasThrowable()) {
logger.error("error", client.getThrowable()); logger.error("error", client.getThrowable());

View file

@ -13,7 +13,7 @@ import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
@ -73,7 +73,7 @@ public class HttpClientDuplicateIDTests extends ESSingleNodeTestCase {
client.index("test", "test", randomAlphaOfLength(1), false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test", "test", randomAlphaOfLength(1), false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
client.refreshIndex("test"); client.refreshIndex("test");
SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client.client(), SearchAction.INSTANCE) SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client.client(), SearchAction.INSTANCE)
.setIndices("test") .setIndices("test")

View file

@ -16,12 +16,11 @@ import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.shard.IndexingStats; import org.elasticsearch.index.shard.IndexingStats;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.testframework.ESIntegTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
@ -87,7 +86,7 @@ public class HttpClientReplicaTests extends ESIntegTestCase {
try { try {
client.newIndex("test1", settingsTest1, null) client.newIndex("test1", settingsTest1, null)
.newIndex("test2", settingsTest2, null); .newIndex("test2", settingsTest2, null);
client.waitForCluster("GREEN", TimeValue.timeValueSeconds(30)); client.waitForCluster("GREEN", "30s");
for (int i = 0; i < 1234; i++) { for (int i = 0; i < 1234; i++) {
client.index("test1", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test1", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
@ -95,7 +94,7 @@ public class HttpClientReplicaTests extends ESIntegTestCase {
client.index("test2", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test2", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(60)); client.waitForResponses("60s");
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {

View file

@ -9,7 +9,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;

View file

@ -11,7 +11,7 @@ import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.testframework.ESIntegTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
@ -75,12 +75,12 @@ public class HttpClientUpdateReplicaLevelTests extends ESIntegTestCase {
try { try {
client.newIndex("replicatest", settings, null); client.newIndex("replicatest", settings, null);
client.waitForCluster("GREEN", TimeValue.timeValueSeconds(30)); client.waitForCluster("GREEN", "30s");
for (int i = 0; i < 12345; i++) { for (int i = 0; i < 12345; i++) {
client.index("replicatest", "replicatest", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("replicatest", "replicatest", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
shardsAfterReplica = client.updateReplicaLevel("replicatest", replicaLevel); shardsAfterReplica = client.updateReplicaLevel("replicatest", replicaLevel);
assertEquals(shardsAfterReplica, numberOfShards * (replicaLevel + 1)); assertEquals(shardsAfterReplica, numberOfShards * (replicaLevel + 1));
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {

View file

@ -13,11 +13,13 @@ import java.util.logging.SimpleFormatter;
public class IndexCreationTest { public class IndexCreationTest {
private static final Logger logger = Logger.getLogger(IndexCreationTest.class.getName()); private static final Logger logger = Logger.getLogger(IndexCreationTest.class.getName());
static { static {
//System.setProperty("io.netty.leakDetection.level", "paranoid"); //System.setProperty("io.netty.leakDetection.level", "paranoid");
System.setProperty("io.netty.noKeySetOptimization", Boolean.toString(true)); System.setProperty("io.netty.noKeySetOptimization", Boolean.toString(true));
System.setProperty("log4j2.disable.jmx", Boolean.toString(true)); System.setProperty("log4j2.disable.jmx", Boolean.toString(true));
// enforce massive logging to the console
System.setProperty("java.util.logging.SimpleFormatter.format", System.setProperty("java.util.logging.SimpleFormatter.format",
"%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s [%3$s] %5$s %6$s%n"); "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s [%3$s] %5$s %6$s%n");
LogManager.getLogManager().reset(); LogManager.getLogManager().reset();

View file

@ -6,8 +6,7 @@ import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.search.SearchAction; import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
import org.xbib.elasticsearch.client.SimpleBulkMetric; import org.xbib.elasticsearch.client.SimpleBulkMetric;
@ -36,7 +35,7 @@ public class NodeBulkClientDuplicateIDTests extends ESSingleNodeTestCase {
client.index("test", "test", randomAlphaOfLength(1), false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test", "test", randomAlphaOfLength(1), false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
client.refreshIndex("test"); client.refreshIndex("test");
SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client.client(), SearchAction.INSTANCE) SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client.client(), SearchAction.INSTANCE)
.setIndices("test") .setIndices("test")

View file

@ -5,9 +5,8 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.IndexAliasAdder; import org.xbib.elasticsearch.client.IndexAliasAdder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
@ -61,7 +60,7 @@ public class NodeBulkClientIndexAliasTests extends ESSingleNodeTestCase {
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
client.shutdown(); client.shutdown();
if (client.hasThrowable()) { if (client.hasThrowable()) {
logger.error("error", client.getThrowable()); logger.error("error", client.getThrowable());

View file

@ -13,10 +13,9 @@ import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.shard.IndexingStats; import org.elasticsearch.index.shard.IndexingStats;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.testframework.ESIntegTestCase;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
import org.xbib.elasticsearch.client.SimpleBulkMetric; import org.xbib.elasticsearch.client.SimpleBulkMetric;
@ -49,7 +48,7 @@ public class NodeBulkClientReplicaTests extends ESIntegTestCase {
try { try {
client.newIndex("test1", settingsTest1, null) client.newIndex("test1", settingsTest1, null)
.newIndex("test2", settingsTest2, null); .newIndex("test2", settingsTest2, null);
client.waitForCluster("GREEN", TimeValue.timeValueSeconds(30)); client.waitForCluster("GREEN", "30s");
for (int i = 0; i < 1234; i++) { for (int i = 0; i < 1234; i++) {
client.index("test1", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test1", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
@ -57,7 +56,7 @@ public class NodeBulkClientReplicaTests extends ESIntegTestCase {
client.index("test2", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test2", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(60)); client.waitForResponses("60s");
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {

View file

@ -9,11 +9,12 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.search.SearchAction; import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
import org.xbib.elasticsearch.client.SimpleBulkMetric; import org.xbib.elasticsearch.client.SimpleBulkMetric;
@ -62,7 +63,7 @@ public class NodeBulkClientTests extends ESSingleNodeTestCase {
.endObject() .endObject()
.endObject() .endObject()
.endObject(); .endObject();
client.mapping("test", builder.string()); client.mapping("test", Strings.toString(builder));
client.newIndex("test"); client.newIndex("test");
GetMappingsRequest getMappingsRequest = new GetMappingsRequest().indices("test"); GetMappingsRequest getMappingsRequest = new GetMappingsRequest().indices("test");
GetMappingsResponse getMappingsResponse = GetMappingsResponse getMappingsResponse =
@ -85,7 +86,7 @@ public class NodeBulkClientTests extends ESSingleNodeTestCase {
client.newIndex("test"); client.newIndex("test");
client.index("test", "test", "1", false, "{ \"name\" : \"Hello World\"}"); // single doc ingest client.index("test", "test", "1", false, "{ \"name\" : \"Hello World\"}"); // single doc ingest
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
assertEquals(1, client.getMetric().getSucceeded().getCount()); assertEquals(1, client.getMetric().getSucceeded().getCount());
if (client.hasThrowable()) { if (client.hasThrowable()) {
logger.error("error", client.getThrowable()); logger.error("error", client.getThrowable());
@ -108,7 +109,7 @@ public class NodeBulkClientTests extends ESSingleNodeTestCase {
client.index("test", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {
@ -149,7 +150,7 @@ public class NodeBulkClientTests extends ESSingleNodeTestCase {
latch.await(30, TimeUnit.SECONDS); latch.await(30, TimeUnit.SECONDS);
logger.info("flush..."); logger.info("flush...");
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
logger.info("got all responses, executor service shutdown..."); logger.info("got all responses, executor service shutdown...");
executorService.shutdown(); executorService.shutdown();
logger.info("executor service is shut down"); logger.info("executor service is shut down");

View file

@ -5,8 +5,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.testframework.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
import org.xbib.elasticsearch.client.SimpleBulkMetric; import org.xbib.elasticsearch.client.SimpleBulkMetric;
@ -36,12 +35,12 @@ public class NodeBulkClientUpdateReplicaLevelTests extends ESIntegTestCase {
try { try {
client.newIndex("replicatest", settings, null); client.newIndex("replicatest", settings, null);
client.waitForCluster("GREEN", TimeValue.timeValueSeconds(30)); client.waitForCluster("GREEN", "30s");
for (int i = 0; i < 12345; i++) { for (int i = 0; i < 12345; i++) {
client.index("replicatest", "replicatest", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("replicatest", "replicatest", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
shardsAfterReplica = client.updateReplicaLevel("replicatest", replicaLevel); shardsAfterReplica = client.updateReplicaLevel("replicatest", replicaLevel);
assertEquals(shardsAfterReplica, numberOfShards * (replicaLevel + 1)); assertEquals(shardsAfterReplica, numberOfShards * (replicaLevel + 1));
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {

View file

@ -19,6 +19,7 @@ configurations {
dependencies { dependencies {
compile project(':common') compile project(':common')
compile "org.xbib.elasticsearch:transport-netty4:${project.property('elasticsearch-server.version')}"
testCompile "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}" testCompile "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}"
testRuntime "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}" testRuntime "org.xbib.elasticsearch:elasticsearch-test-framework:${project.property('elasticsearch-devkit.version')}"
} }
@ -56,7 +57,7 @@ randomizedTest {
test { test {
enabled = false enabled = false
jvmArgs "-javaagent:" + configurations.alpnagent.asPath //jvmArgs "-javaagent:" + configurations.alpnagent.asPath
systemProperty 'path.home', projectDir.absolutePath systemProperty 'path.home', projectDir.absolutePath
testLogging { testLogging {
showStandardStreams = true showStandardStreams = true

View file

@ -5,8 +5,6 @@ import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.xbib.elasticsearch.client.BulkControl; import org.xbib.elasticsearch.client.BulkControl;
import org.xbib.elasticsearch.client.BulkMetric; import org.xbib.elasticsearch.client.BulkMetric;
@ -40,12 +38,12 @@ public class MockTransportBulkClient extends TransportBulkClient {
} }
@Override @Override
public MockTransportBulkClient maxVolumePerRequest(ByteSizeValue maxVolumePerRequest) { public MockTransportBulkClient maxVolumePerRequest(String maxVolumePerRequest) {
return this; return this;
} }
@Override @Override
public MockTransportBulkClient flushIngestInterval(TimeValue interval) { public MockTransportBulkClient flushIngestInterval(String interval) {
return this; return this;
} }
@ -85,7 +83,7 @@ public class MockTransportBulkClient extends TransportBulkClient {
} }
@Override @Override
public MockTransportBulkClient waitForResponses(TimeValue timeValue) throws InterruptedException { public MockTransportBulkClient waitForResponses(String timeValue) throws InterruptedException {
return this; return this;
} }
@ -130,7 +128,7 @@ public class MockTransportBulkClient extends TransportBulkClient {
} }
@Override @Override
public void waitForCluster(String healthColor, TimeValue timeValue) throws IOException { public void waitForCluster(String healthColor, String timeValue) throws IOException {
// mockup method // mockup method
} }

View file

@ -13,10 +13,9 @@ import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
@ -79,7 +78,7 @@ public class TransportBulkClientDuplicateIDTests extends ESSingleNodeTestCase {
client.index("test", "test", randomAlphaOfLength(1), false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test", "test", randomAlphaOfLength(1), false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
client.refreshIndex("test"); client.refreshIndex("test");
SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client.client(), SearchAction.INSTANCE) SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(client.client(), SearchAction.INSTANCE)
.setIndices("test") .setIndices("test")

View file

@ -18,10 +18,9 @@ import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.index.shard.IndexingStats; import org.elasticsearch.index.shard.IndexingStats;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.testframework.ESIntegTestCase;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
@ -76,7 +75,7 @@ public class TransportBulkClientReplicaTests extends ESIntegTestCase {
try { try {
client.newIndex("test1", settingsTest1, null) client.newIndex("test1", settingsTest1, null)
.newIndex("test2", settingsTest2, null); .newIndex("test2", settingsTest2, null);
client.waitForCluster("GREEN", TimeValue.timeValueSeconds(30)); client.waitForCluster("GREEN", "30s");
for (int i = 0; i < 1234; i++) { for (int i = 0; i < 1234; i++) {
client.index("test1", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test1", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
@ -84,7 +83,7 @@ public class TransportBulkClientReplicaTests extends ESIntegTestCase {
client.index("test2", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test2", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(60)); client.waitForResponses("60s");
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {

View file

@ -11,6 +11,7 @@ import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.client.transport.NoNodeAvailableException; import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
@ -20,7 +21,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.testframework.ESSingleNodeTestCase;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
@ -123,7 +124,7 @@ public class TransportBulkClientTests extends ESSingleNodeTestCase {
.endObject() .endObject()
.endObject() .endObject()
.endObject(); .endObject();
client.mapping("test", builder.string()); client.mapping("test", Strings.toString(builder));
client.newIndex("test"); client.newIndex("test");
GetMappingsRequest getMappingsRequest = new GetMappingsRequest().indices("test"); GetMappingsRequest getMappingsRequest = new GetMappingsRequest().indices("test");
GetMappingsResponse getMappingsResponse = GetMappingsResponse getMappingsResponse =
@ -153,7 +154,7 @@ public class TransportBulkClientTests extends ESSingleNodeTestCase {
logger.info("flush"); logger.info("flush");
client.flushIngest(); client.flushIngest();
logger.info("wait for responses"); logger.info("wait for responses");
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
logger.info("waited for responses"); logger.info("waited for responses");
} catch (InterruptedException e) { } catch (InterruptedException e) {
// ignore // ignore
@ -186,7 +187,7 @@ public class TransportBulkClientTests extends ESSingleNodeTestCase {
client.index("test", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("test", "test", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {
logger.warn("skipping, no node available"); logger.warn("skipping, no node available");
} finally { } finally {
@ -228,7 +229,7 @@ public class TransportBulkClientTests extends ESSingleNodeTestCase {
latch.await(30, TimeUnit.SECONDS); latch.await(30, TimeUnit.SECONDS);
logger.info("client flush ..."); logger.info("client flush ...");
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
logger.info("executor service to be shut down ..."); logger.info("executor service to be shut down ...");
executorService.shutdown(); executorService.shutdown();
logger.info("executor service is shut down"); logger.info("executor service is shut down");

View file

@ -8,9 +8,8 @@ import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.testframework.ESIntegTestCase;
import org.junit.Before; import org.junit.Before;
import org.xbib.elasticsearch.client.ClientBuilder; import org.xbib.elasticsearch.client.ClientBuilder;
import org.xbib.elasticsearch.client.SimpleBulkControl; import org.xbib.elasticsearch.client.SimpleBulkControl;
@ -60,12 +59,12 @@ public class TransportBulkClientUpdateReplicaLevelTests extends ESIntegTestCase
try { try {
client.newIndex("replicatest", settings, null); client.newIndex("replicatest", settings, null);
client.waitForCluster("GREEN", TimeValue.timeValueSeconds(30)); client.waitForCluster("GREEN", "30s");
for (int i = 0; i < 12345; i++) { for (int i = 0; i < 12345; i++) {
client.index("replicatest", "replicatest", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}"); client.index("replicatest", "replicatest", null, false, "{ \"name\" : \"" + randomAlphaOfLength(32) + "\"}");
} }
client.flushIngest(); client.flushIngest();
client.waitForResponses(TimeValue.timeValueSeconds(30)); client.waitForResponses("30s");
shardsAfterReplica = client.updateReplicaLevel("replicatest", 3); shardsAfterReplica = client.updateReplicaLevel("replicatest", 3);
assertEquals(shardsAfterReplica, 2 * (3 + 1)); assertEquals(shardsAfterReplica, 2 * (3 + 1));
} catch (NoNodeAvailableException e) { } catch (NoNodeAvailableException e) {