DATAES-723 - Cleanup ElasticsearchRepository interface.
Original PR: #373
This commit is contained in:
committed by
GitHub
parent
0d272fe9bf
commit
16e0f566cd
@@ -39,7 +39,7 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
|
||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchCrudRepository;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||
import org.springframework.data.elasticsearch.utils.IndexInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -229,6 +229,6 @@ public class DynamicSettingAndMappingEntityRepositoryTests {
|
||||
* @author Mohsin Husen
|
||||
*/
|
||||
public interface DynamicSettingAndMappingEntityRepository
|
||||
extends ElasticsearchCrudRepository<DynamicSettingAndMappingEntity, String> {}
|
||||
extends ElasticsearchRepository<DynamicSettingAndMappingEntity, String> {}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
import org.springframework.data.elasticsearch.core.IndexOperations;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchCrudRepository;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||
import org.springframework.data.elasticsearch.utils.IndexInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -57,6 +57,7 @@ public class FieldDynamicMappingEntityRepositoryTests {
|
||||
@Autowired private ElasticsearchOperations operations;
|
||||
|
||||
private IndexOperations indexOperations;
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
indexOperations = operations.getIndexOperations();
|
||||
@@ -129,6 +130,6 @@ public class FieldDynamicMappingEntityRepositoryTests {
|
||||
* @author Ted Liang
|
||||
*/
|
||||
public interface FieldDynamicMappingEntityRepository
|
||||
extends ElasticsearchCrudRepository<FieldDynamicMappingEntity, String> {}
|
||||
extends ElasticsearchRepository<FieldDynamicMappingEntity, String> {}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchCrudRepository;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||
import org.springframework.data.elasticsearch.utils.IndexInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -72,6 +72,7 @@ public class SynonymRepositoryTests {
|
||||
void after() {
|
||||
indexOperations.deleteIndex(SynonymEntity.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldDo() {
|
||||
|
||||
@@ -112,5 +113,5 @@ public class SynonymRepositoryTests {
|
||||
*
|
||||
* @author Artur Konczak
|
||||
*/
|
||||
interface SynonymRepository extends ElasticsearchCrudRepository<SynonymEntity, String> {}
|
||||
interface SynonymRepository extends ElasticsearchRepository<SynonymEntity, String> {}
|
||||
}
|
||||
|
||||
@@ -389,7 +389,6 @@ public class UUIDElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
List<SampleEntityUUIDKeyed> result = repository.deleteByAvailable(true);
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
assertThat(result).hasSize(2);
|
||||
@@ -423,7 +422,6 @@ public class UUIDElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
List<SampleEntityUUIDKeyed> result = repository.deleteByMessage("hello world 3");
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
assertThat(result).hasSize(1);
|
||||
@@ -457,7 +455,6 @@ public class UUIDElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
repository.deleteByType("article");
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
|
||||
@@ -478,7 +475,6 @@ public class UUIDElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
repository.delete(sampleEntityUUIDKeyed);
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(termQuery("id", documentId.toString()))
|
||||
@@ -601,8 +597,7 @@ public class UUIDElasticsearchRepositoryTests {
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Data
|
||||
@Document(indexName = "test-index-uuid-keyed", replicas = 0,
|
||||
refreshInterval = "-1")
|
||||
@Document(indexName = "test-index-uuid-keyed", replicas = 0, refreshInterval = "-1")
|
||||
static class SampleEntityUUIDKeyed {
|
||||
|
||||
@Id private UUID id;
|
||||
|
||||
@@ -148,9 +148,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
sampleEntity.setVersion(System.currentTimeMillis());
|
||||
|
||||
// when
|
||||
assertThatThrownBy(() -> {
|
||||
repository.save(sampleEntity);
|
||||
}).isInstanceOf(ActionRequestValidationException.class);
|
||||
assertThatThrownBy(() -> repository.save(sampleEntity)).isInstanceOf(ActionRequestValidationException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -385,7 +383,6 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
long result = repository.deleteSampleEntityById(documentId);
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(termQuery("id", documentId)).build();
|
||||
@@ -422,7 +419,6 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
List<SampleEntity> result = repository.deleteByAvailable(true);
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
assertThat(result).hasSize(2);
|
||||
@@ -456,7 +452,6 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
List<SampleEntity> result = repository.deleteByMessage("hello world 3");
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
assertThat(result).hasSize(1);
|
||||
@@ -490,7 +485,6 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
|
||||
// when
|
||||
repository.deleteByType("article");
|
||||
repository.refresh();
|
||||
|
||||
// then
|
||||
NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
|
||||
@@ -581,7 +575,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
sampleEntity.setMessage("some message");
|
||||
|
||||
// when
|
||||
repository.index(sampleEntity);
|
||||
repository.save(sampleEntity);
|
||||
|
||||
// then
|
||||
Page<SampleEntity> entities = repository.search(termQuery("id", documentId), PageRequest.of(0, 50));
|
||||
@@ -707,8 +701,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Document(indexName = "test-index-sample-simple-repository", replicas = 0,
|
||||
refreshInterval = "-1")
|
||||
@Document(indexName = "test-index-sample-simple-repository", replicas = 0, refreshInterval = "-1")
|
||||
static class SampleEntity {
|
||||
|
||||
@Id private String id;
|
||||
|
||||
Reference in New Issue
Block a user