mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-23 12:32:10 +00:00
parent
c9b8b1af19
commit
43ab49b5fa
1
.gitignore
vendored
1
.gitignore
vendored
@ -24,4 +24,5 @@ target
|
||||
|
||||
|
||||
/zap.env
|
||||
/localdocker.env
|
||||
.localdocker-env
|
||||
|
@ -15,10 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.support.querybyexample;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.data.elasticsearch.utils.IdGenerator.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.assertj.core.api.AbstractThrowableAssert;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
@ -39,14 +45,6 @@ import org.springframework.data.elasticsearch.utils.IndexNameProvider;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.springframework.data.elasticsearch.utils.IdGenerator.nextIdAsString;
|
||||
|
||||
/**
|
||||
* @author Ezequiel Antúnez Camacho
|
||||
* @since 5.1
|
||||
@ -65,14 +63,11 @@ abstract class QueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #2418
|
||||
@org.junit.jupiter.api.Order(Integer.MAX_VALUE)
|
||||
@Order(Integer.MAX_VALUE)
|
||||
void cleanup() {
|
||||
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("All QueryByExampleExecutor operations should work")
|
||||
class QueryByExampleExecutorOperations {
|
||||
@Test // #2418
|
||||
void shouldFindOne() {
|
||||
// given
|
||||
@ -218,8 +213,7 @@ abstract class QueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
// when
|
||||
SampleEntity probe = new SampleEntity();
|
||||
final Iterable<SampleEntity> all = repository.findAll();
|
||||
Iterable<SampleEntity> sampleEntities = repository.findAll(Example.of(probe),
|
||||
Sort.by(Sort.Direction.DESC, "rate"));
|
||||
Iterable<SampleEntity> sampleEntities = repository.findAll(Example.of(probe), Sort.by(Sort.Direction.DESC, "rate"));
|
||||
|
||||
// then
|
||||
assertThat(sampleEntities).isNotNull().hasSize(3).containsExactly(sampleEntityWithRate22, sampleEntityWithRate13,
|
||||
@ -313,12 +307,6 @@ abstract class QueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
assertThat(exists).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("All ExampleMatchers should work")
|
||||
class AllExampleMatchersShouldWork {
|
||||
|
||||
@Test // #2418
|
||||
void defaultStringMatcherShouldWork() {
|
||||
// given
|
||||
@ -469,8 +457,6 @@ abstract class QueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
assertThat(sampleEntities).isNotNull().hasSize(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||
static class SampleEntity {
|
||||
@Nullable
|
||||
|
@ -15,9 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repository.support.querybyexample;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.data.elasticsearch.utils.IdGenerator.*;
|
||||
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
@ -36,13 +43,6 @@ import org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRe
|
||||
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
|
||||
import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.data.elasticsearch.utils.IdGenerator.nextIdAsString;
|
||||
|
||||
/**
|
||||
* @author Ezequiel Antúnez Camacho
|
||||
@ -58,21 +58,17 @@ abstract class ReactiveQueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
@BeforeEach
|
||||
void before() {
|
||||
indexNameProvider.increment();
|
||||
operations.indexOps(SampleEntity.class).createWithMapping()
|
||||
.as(StepVerifier::create) //
|
||||
operations.indexOps(SampleEntity.class).createWithMapping().as(StepVerifier::create) //
|
||||
.expectNext(true) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test // #2418
|
||||
@org.junit.jupiter.api.Order(Integer.MAX_VALUE)
|
||||
@Order(Integer.MAX_VALUE)
|
||||
void cleanup() {
|
||||
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
|
||||
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete().block();
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("All QueryByExampleExecutor operations should work")
|
||||
class ReactiveQueryByExampleExecutorOperations {
|
||||
@Test
|
||||
void shouldFindOne() {
|
||||
// given
|
||||
@ -296,12 +292,6 @@ abstract class ReactiveQueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
@DisplayName("All ExampleMatchers should work")
|
||||
class AllExampleMatchersShouldWork {
|
||||
|
||||
@Test // #2418
|
||||
void defaultStringMatcherShouldWork() {
|
||||
// given
|
||||
@ -482,8 +472,6 @@ abstract class ReactiveQueryByExampleElasticsearchExecutorIntegrationTests {
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||
static class SampleEntity {
|
||||
@Nullable
|
||||
|
Loading…
x
Reference in New Issue
Block a user