DATAES-767 - Fix ReactiveElasticsearch handling of 4xx HTTP responses.

This commit is contained in:
Peter-Josef Meisch 2020-05-03 04:46:01 +02:00
parent 0df58615e9
commit ee02073142
2 changed files with 8 additions and 6 deletions

View File

@ -97,7 +97,6 @@ import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.SearchHits;
import org.reactivestreams.Publisher; import org.reactivestreams.Publisher;
import org.springframework.data.elasticsearch.ElasticsearchException;
import org.springframework.data.elasticsearch.client.ClientConfiguration; import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.ClientLogger; import org.springframework.data.elasticsearch.client.ClientLogger;
import org.springframework.data.elasticsearch.client.ElasticsearchHost; import org.springframework.data.elasticsearch.client.ElasticsearchHost;

View File

@ -41,11 +41,11 @@ import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.WriteRequest.RefreshPolicy; import org.elasticsearch.action.support.WriteRequest.RefreshPolicy;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.reactivestreams.Publisher; import org.reactivestreams.Publisher;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
@ -177,9 +177,11 @@ public class SimpleReactiveElasticsearchRepositoryTests {
.verifyComplete(); .verifyComplete();
} }
@Test // DATAES-519 @Test // DATAES-519, DATAES-767
public void findAllByIdByIdShouldCompleteIfIndexDoesNotExist() { public void findAllByIdByIdShouldCompleteIfIndexDoesNotExist() {
repository.findAllById(Arrays.asList("id-two", "id-two")).as(StepVerifier::create).verifyComplete(); repository.findAllById(Arrays.asList("id-two", "id-two")).as(StepVerifier::create)
.expectError(HttpClientErrorException.class);
} }
@Test // DATAES-519 @Test // DATAES-519
@ -207,9 +209,10 @@ public class SimpleReactiveElasticsearchRepositoryTests {
.verifyComplete(); .verifyComplete();
} }
@Test // DATAES-519 @Test // DATAES-519, DATAE-767
public void countShouldReturnZeroWhenIndexDoesNotExist() { public void countShouldReturnZeroWhenIndexDoesNotExist() {
repository.count().as(StepVerifier::create).expectNext(0L).verifyComplete(); repository.count().as(StepVerifier::create).expectNext(0L).expectError(HttpClientErrorException.class);
} }
@Test // DATAES-519 @Test // DATAES-519