DATAES-812 - IndexOperations should use SpEL index name from entity.

Original PR: #447
This commit is contained in:
Peter-Josef Meisch
2020-05-05 21:39:06 +02:00
committed by GitHub
parent 97cb075afe
commit 4deea9d667
2 changed files with 38 additions and 13 deletions

View File

@@ -96,6 +96,21 @@ public class DynamicIndexEntityTests {
assertThat(repository.count()).isEqualTo(0L);
}
@Test // DATAES-821
void indexOpsShouldUseDynamicallyProvidedName() {
indexNameProvider.setIndexName("test-dynamic");
IndexOperations indexOps = operations.indexOps(DynamicIndexEntity.class);
int initialCallsCount = indexNameProvider.callsCount;
indexOps.create();
indexOps.refresh();
indexOps.refresh();
indexOps.delete();
assertThat(indexNameProvider.callsCount - initialCallsCount).isEqualTo(4);
}
static class IndexNameProvider {
private String indexName;