Commit Graph

99 Commits

Author SHA1 Message Date
Simon Willnauer 8394544548 Add a dedicated client/transport project for transport-client (#19435)
The `client/transport` project adds a new jar build project that
pulls in all dependencies and configures all required modules.

Preinstalled modules are:
 * transport-netty
 * lang-mustache
 * reindex
 * percolator

The `TransportClient` classes are still in core
while `TransportClient.Builder` has only a protected construcutor
such that users are redirected to use the new `TransportClientBuilder`
from the new jar.

Closes #19412
2016-07-18 15:42:24 +02:00
javanna 512b8be791 RestClient: simplify ssl configuration and make http config callback functional friendly 2016-07-12 13:25:55 +02:00
javanna fa0b354e66 Rest Client: add callback to customize http client settings
The callback replaces the ability to fully replace the http client instance. By doing that, one used to lose any default that the RestClient had set for the underlying http client. Given that you'd usually override one or two things only, like a couple of timeout values, the ssl factory or the default credentials providers, it is not uder friendly if by doing that users end up replacing the whole http client instance and lose any default set by us.
2016-07-12 12:31:28 +02:00
javanna 942e342662 Rest Client: use short performRequest methods when possible 2016-07-11 10:36:26 +02:00
javanna fd297637a2 Rest Client: add short performRequest method variants without params and/or body
Users wanting to send a request by providing only its method and endpoint, effectively the only two required arguments, shouldn't need to pass in an empty map and a null entity for the body. While at it we can also add a variant to send requests by specifying only method, endpoint and params, but not body. Headers remain a vararg as last argument, so they can always optionally be provided.

 Closes #19312
2016-07-11 10:36:04 +02:00
javanna 2a91a6ac37 Rest Client: check log level against tracer logger for trace logging 2016-07-08 12:52:29 +02:00
javanna c63719d085 Rest Client: wrap log statement in logger.isDebugEnabled 2016-07-08 12:51:48 +02:00
javanna cfc762b70d Rest Client: add slash to log line when missing between host and uri
Closes #19314
2016-07-08 12:25:20 +02:00
javanna 134b73ab33 Rest Client: HostsSniffer to set http as default scheme
The assumption is HostsSniffer is that all of the arguments have been properly provided and validated through HostsSniffer.Builder, except they weren't, as the scheme didn't have a default value and when not set would cause NPEs down the road. Improved tests to catch this also.
2016-07-07 19:11:37 +02:00
Tanguy Leroux 8c40b2b54e Fix order of modifiers 2016-07-01 16:57:14 +02:00
javanna c4b87149c2 Build: set group for client and sniffer, disable publishing for client-test
Closes #19205
2016-07-01 12:09:34 +02:00
Yannick Welsch 33313df0a2 Add ThreadLeakLingering option to Rest client tests
Some Rest tests use the Sun HTTP server which has lingering threads after shutdown. Similar to ESTestCase, this adds an
option to wait 5 seconds for these threads to terminate.
2016-06-23 10:21:37 +02:00
Nik Everett 0bf447c697 Group client projects under :client
:client ---------> :client:rest
:client-sniffer -> :client:sniffer
:client-test ----> :client:test

This lines the client up with how we do things like modules and
plugins.
2016-06-22 14:26:41 -04:00
javanna c2839c1577 [TEST] Add client-test module and make client tests use randomized runner directly
The lucene-test dependency caused issues with IDEs as they would always load the lucene 5 jar although they shouldn't have, which caused jarhell in es core tests.

If we depend directly on randomized runner we don't have this problem. It is luckily still compatible with java 1.7. This requires though adding a thin module that includes the base test class which can be shared between client and client-sniffer.
2016-06-22 19:37:08 +02:00
javanna f0b6abe439 rename onSuccess to onResponse
That makes it a bit clearer that it's about the response and whether we decide if it was a good one or a failure (based on status code)
2016-06-21 17:11:09 +02:00
javanna cb4bfcb864 Take SniffOnFailureListener out of Sniffer and make FailureListener final on RestClient 2016-06-21 15:29:59 +02:00
javanna 8c60374284 Build: do not load integ test class if --skip-integ-tests-in-disguise is specified in NamingConventionsCheck
Projects that don't depend on elasticsearch-test fail otherwise because org.elasticsearch.test.EsIntegTestCase (default integ test class) is not in the classpath. They should provide their onw integ test base class, but having integration tests should not be mandatory. One can simply set skipIntegTestsInDisguise to true to prevent loading of integ test class.
2016-06-17 13:46:27 +02:00
javanna 7c8013f9fd Build: remove explicit targetCompatibility from forbiddenapis config
targetCompatibility set to the project is enough.
2016-06-15 11:43:48 +02:00
javanna 70fb67cc7b Build: targetCompatibility and sourceCompatibility are enough to make sure we compile client and client-sniffer with target and source 1.7 2016-06-14 23:16:38 +02:00
javanna cf93e904e3 remove message parameter from RequestLogger methods
This prevents useless string allocation.
2016-06-14 14:14:03 +02:00
javanna 1932f6bc7c Rename RequestLogger#log methods to distinguish between the two
One method is to log a request that yielded a response, the other one for a failed request
2016-06-14 13:45:38 +02:00
javanna caa6c96259 Build: make client and client-sniffer depend on lucene-test version 5, last 1.7 compatible version 2016-06-14 09:43:31 +02:00
javanna 116805b28b remove TODO around copying hosts when rotating the collection, it's not a problem for now 2016-06-13 14:02:01 +02:00
javanna 8f7b7fb813 added comments to clarify RequestLogger and DeadHostState 2016-06-13 12:59:30 +02:00
javanna 3cd201e67e [TEST] add comment on using animal-sniffer suppress annotation 2016-06-13 12:02:09 +02:00
javanna 50b6f4c02f Build: changed forbidden-apis targetCompatibility to 1.7 for client and client-sniffer 2016-06-13 09:20:39 +02:00
javanna 777d438f48 [TEST] use jdk-internal bundled signature (rather than the previously removed jdk-non-portable) 2016-06-10 12:46:33 +02:00
javanna 3d7186c81f make DeadHostState final 2016-06-10 11:40:35 +02:00
javanna 6db90da25e [TEST] Remove usage of @SuppressForbidden due to sun HttpServer usage, resolve some violations that were hidden by it 2016-06-10 11:40:13 +02:00
javanna a5e329e563 [TEST] use animalsniffer annotation @IgnoreJRERequirement (similar to @SuppressForbidden) rather than exclusion pattern 2016-06-10 10:11:21 +02:00
javanna 0af9d2c767 Build: add animalsniffer to detect usage of java8 apis in client and client-sniffer 2016-06-10 09:51:47 +02:00
javanna f38ce72004 make forbiddenApisTest work for client and client-sniffer 2016-06-09 23:44:34 +02:00
javanna bd773359d5 [TEST] add SuppresForbidden annotation for client project 2016-06-09 17:39:52 +02:00
javanna d8c0fad08f fix failing tests 2016-06-09 17:06:58 +02:00
javanna 9a4971d3fd fix line length 2016-06-09 16:57:57 +02:00
javanna de8b9fd579 use switch for status codes and add comments 2016-06-09 16:51:08 +02:00
javanna cbdffc7965 s/elasticsearchResponse/response 2016-06-09 16:39:59 +02:00
javanna 853ea9385b add comments on retries 2016-06-09 16:38:43 +02:00
javanna 742f9c6eaa nextHost to return Iterable<HttpHost> rather than Iterator 2016-06-09 16:34:01 +02:00
javanna c028bf9250 rename deadUntil to deadUntilNanos 2016-06-09 16:31:09 +02:00
javanna 85606e8a4b renamed all time intervals arguments and members to include the time unit in their name 2016-06-09 16:27:52 +02:00
javanna 437c4f210b rename ElasticsearchResponse to Response and ElasticsearchResponseException to ResponseException 2016-06-09 14:38:32 +02:00
javanna 04d620da74 require hosts when creating RestClient.Builder
Also fix order of arguments when using assertEquals
2016-06-08 12:37:50 +02:00
javanna 2cf04c0877 wrap entity only when not repeatable and improve RequestLoggerTests 2016-06-06 15:41:11 +02:00
javanna 1f7f6e2709 wrap log statement with logger.isDebugEnabled 2016-06-06 15:13:42 +02:00
javanna a461dd84d2 Build: add hamcrest and securemock to version.properties 2016-06-06 15:02:52 +02:00
javanna 05e26a46d7 raise default socket timeout to 10s and default connect timeout to 1s 2016-06-04 01:06:18 +02:00
javanna f2318ed5ae Build: add missing licenses, SHAs and enable dependency licenses check 2016-06-04 00:56:42 +02:00
javanna b15279b5ef Allow to pass socket facttry registry to createDefaultHttpClient method 2016-06-03 23:59:26 +02:00
javanna f17f0f9247 rename ElasticsearchResponse#getFirstHeader to getHeader 2016-06-03 18:28:31 +02:00