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
javanna
29eee328fe
[TEST] expand RequestLoggerTests to all the supported http methods
2016-06-03 18:23:52 +02:00
javanna
13a27a34f8
[TEST] add RestClient integration test
...
Relies on real HttpServer to test the actual interaction between RestClient and HttpClient, and how requests get sent in real life.
2016-06-03 16:20:12 +02:00
javanna
4572b69011
[TEST] add RestClient unit tests
...
Unit tests rely on mockito to mock the internal HttpClient instance. No http request is performed, we only simulate interaction between RestClient and its internal HttpClient.
2016-06-03 16:20:12 +02:00
javanna
9ed2d610ec
[TEST] rename restClientTests back to RestClientBuilderTests
2016-06-03 16:20:12 +02:00
javanna
24ea585c9e
don't use setDefaultHeaders from HttpClient
...
Store default headers ourselves instead, otherwise default ones cannot be replaced. Don't allow for multiple headers with same key, last one wins and replaces previous ones with same key.
Also fail with null params or headers.
2016-06-03 16:20:11 +02:00
javanna
47e52044e4
[TEST] add setHosts test and rename RestClientBuilderTests to RestClientTests
2016-06-03 16:01:07 +02:00
javanna
35dbdeeae5
check hosts is not null nor empty earlier, remove check from nextHost
...
if we check at set time, we don't need to check each single time in nextHost
2016-06-03 16:01:07 +02:00
javanna
6d66fbd9c1
add toString to DeadHostState class
2016-06-03 16:01:07 +02:00
javanna
c9db111387
add javadocs on closing responses
2016-06-03 16:01:07 +02:00
javanna
83c6e736de
add support for PATCH and TRACE methods
...
Although elasticsearch doesn't support these methods (RestController doesn't even allow to register handler for them), the RestClient should allow to send requests using them.
2016-06-03 16:01:07 +02:00
javanna
51e487fa55
[TEST] remove okhttp test dependency
...
Use sun HttpServer instead and disable forbidden-apis for test classes. It turns out to be more flexible than okhttp as it allows get & delete with body.
2016-06-03 16:01:07 +02:00
javanna
044a97c740
move client sniffer to its own project
...
Create a new subproject called client-sniffer that contains the o.e.client.sniff package. Since it is going to go to a separate jar, due to its additional functionalities and dependency on jackson, it makes sense to have it as a separate project that depends on client. This way we make sure that client doesn't depend on it etc.
2016-06-03 16:01:07 +02:00
javanna
7f4807b29e
add some javadocs
2016-06-03 16:01:07 +02:00
javanna
29b1f8d44a
make some classes and methods package private
...
ElasticsearchResponseException, as well as ElasticsearchResponse, should only be created from o.e.client package.
RequestLogger should only be used from this package too.
2016-06-03 16:01:07 +02:00
javanna
6490355cb6
make host state immutable
...
Instead of having a Connection mutable object that holds the state of the connection to each host, we now have immutable objects only. We keep two sets, one with all the hosts, one with the blacklisted ones. Once we blacklist a host we associate it with a DeadHostState which keeps track of the number of failed attempts and when the host should be retried. A new state object is created each and every time the state of the host needs to be updated.
2016-06-03 16:01:07 +02:00
javanna
c70e08c393
include response body in ElasticsearchResponseException error message
2016-06-03 16:01:07 +02:00
javanna
eae914ae8e
Replace rest test client with low level RestClient
...
We still have a wrapper called RestTestClient that is very specific to Rest tests, as well as RestTestResponse etc. but all the low level bits around http connections etc. are now handled by RestClient.
2016-06-03 16:01:07 +02:00
javanna
325b723930
[TEST] add rest client test dependency and replace usage of HttpRequestBuilder with RestClient in integration tests
2016-06-03 16:01:07 +02:00
javanna
6d3f6c7faf
support missing OPTIONS method, it is supported in elasticsearch core
2016-06-03 16:01:07 +02:00