Skip to content

Commit f973236

Browse files
authored
Test code cleanup.
Original Pull Request #2572 Closes #2571
1 parent 36e3b93 commit f973236

17 files changed

+9
-140
lines changed

src/test/java/org/springframework/data/elasticsearch/NewElasticsearchClientDevelopment.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/test/java/org/springframework/data/elasticsearch/core/geo/GeoELCIntegrationTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ IndexNameProvider indexNameProvider() {
4545
}
4646
}
4747

48-
@Override
49-
public boolean newElasticsearchClient() {
50-
return true;
51-
}
52-
5348
@Override
5449
protected Query nativeQueryForBoundingBox(String fieldName, double top, double left, double bottom, double right) {
5550
return NativeQuery.builder() //

src/test/java/org/springframework/data/elasticsearch/core/geo/GeoIntegrationTests.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.junit.jupiter.api.condition.DisabledIf;
2727
import org.springframework.beans.factory.annotation.Autowired;
2828
import org.springframework.data.annotation.Id;
29-
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
3029
import org.springframework.data.elasticsearch.annotations.Document;
3130
import org.springframework.data.elasticsearch.annotations.GeoPointField;
3231
import org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate;
@@ -56,16 +55,11 @@
5655
* Latitude , max Longitude , max Latitude
5756
*/
5857
@SpringIntegrationTest
59-
public abstract class GeoIntegrationTests implements NewElasticsearchClientDevelopment {
58+
public abstract class GeoIntegrationTests {
6059

6160
@Autowired private ElasticsearchOperations operations;
6261
@Autowired private IndexNameProvider indexNameProvider;
6362

64-
boolean rhlcWithCluster8() {
65-
var clusterVersion = ((AbstractElasticsearchTemplate) operations).getClusterVersion();
66-
return (oldElasticsearchClient() && clusterVersion != null && clusterVersion.startsWith("8"));
67-
}
68-
6963
@BeforeEach
7064
public void before() {
7165
indexNameProvider.increment();
@@ -227,7 +221,6 @@ public void shouldFindAnnotatedGeoMarkersInRangeForGivenCriteriaQueryUsingGeohas
227221
assertThat(geoAuthorsForGeoCriteria).hasSize(3);
228222
}
229223

230-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
231224
@Test
232225
public void shouldFindAllMarkersForNativeSearchQuery() {
233226

@@ -245,7 +238,6 @@ public void shouldFindAllMarkersForNativeSearchQuery() {
245238
protected abstract Query nativeQueryForBoundingBox(String fieldName, double top, double left, double bottom,
246239
double right);
247240

248-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
249241
@Test
250242
public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeoBox() {
251243

@@ -264,7 +256,6 @@ public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeoBox() {
264256
.containsExactlyInAnyOrder("def", "ghi");
265257
}
266258

267-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
268259
@Test
269260
public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeohash() {
270261

@@ -283,7 +274,6 @@ public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeohash() {
283274
.containsExactlyInAnyOrder("def", "ghi");
284275
}
285276

286-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
287277
@Test
288278
public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeoPoints() {
289279

@@ -302,7 +292,6 @@ public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingGeoPoints() {
302292
.containsExactlyInAnyOrder("def", "ghi");
303293
}
304294

305-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
306295
@Test
307296
public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingPoints() {
308297

@@ -321,7 +310,6 @@ public void shouldFindAuthorMarkersInBoxForGivenCriteriaQueryUsingPoints() {
321310
.containsExactlyInAnyOrder("def", "ghi");
322311
}
323312

324-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
325313
@Test
326314
public void shouldFindLocationWithGeoHashPrefix() {
327315

src/test/java/org/springframework/data/elasticsearch/core/index/IndexTemplateELCIntegrationTests.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,4 @@
2323
* @since 4.4
2424
*/
2525
@ContextConfiguration(classes = { ElasticsearchTemplateConfiguration.class })
26-
public class IndexTemplateELCIntegrationTests extends IndexTemplateIntegrationTests {
27-
@Override
28-
public boolean newElasticsearchClient() {
29-
return true;
30-
}
31-
}
26+
public class IndexTemplateELCIntegrationTests extends IndexTemplateIntegrationTests { }

src/test/java/org/springframework/data/elasticsearch/core/index/IndexTemplateIntegrationTests.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@
2525
import org.json.JSONException;
2626
import org.junit.jupiter.api.DisplayName;
2727
import org.junit.jupiter.api.Test;
28-
import org.junit.jupiter.api.condition.DisabledIf;
2928
import org.springframework.beans.factory.annotation.Autowired;
3029
import org.springframework.data.annotation.Id;
31-
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
3230
import org.springframework.data.elasticsearch.annotations.Document;
3331
import org.springframework.data.elasticsearch.annotations.Field;
3432
import org.springframework.data.elasticsearch.annotations.FieldType;
3533
import org.springframework.data.elasticsearch.annotations.Setting;
36-
import org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate;
3734
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
3835
import org.springframework.data.elasticsearch.core.IndexOperations;
3936
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
@@ -47,16 +44,10 @@
4744
* @author Peter-Josef Meisch
4845
*/
4946
@SpringIntegrationTest
50-
public abstract class IndexTemplateIntegrationTests implements NewElasticsearchClientDevelopment {
47+
public abstract class IndexTemplateIntegrationTests {
5148

5249
@Autowired ElasticsearchOperations operations;
5350

54-
boolean rhlcWithCluster8() {
55-
var clusterVersion = ((AbstractElasticsearchTemplate) operations).getClusterVersion();
56-
return (oldElasticsearchClient() && clusterVersion != null && clusterVersion.startsWith("8"));
57-
}
58-
59-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
6051
@Test // DATAES-612
6152
void shouldPutTemplate() {
6253

@@ -78,7 +69,6 @@ void shouldPutTemplate() {
7869
assertThat(acknowledged).isTrue();
7970
}
8071

81-
@DisabledIf(value = "oldElasticsearchClient", disabledReason = "not implemented for the deprecated old client")
8272
@Test // #1458
8373
@DisplayName("should create component template")
8474
void shouldCreateComponentTemplate() {
@@ -108,7 +98,6 @@ void shouldCreateComponentTemplate() {
10898
assertThat(acknowledged).isTrue();
10999
}
110100

111-
@DisabledIf(value = "oldElasticsearchClient", disabledReason = "not implemented for the deprecated old client")
112101
@Test // #1458
113102
@DisplayName("should get component template")
114103
void shouldGetComponentTemplate() throws JSONException {
@@ -157,7 +146,6 @@ void shouldGetComponentTemplate() throws JSONException {
157146
assertThat(alias2.getAlias()).isEqualTo("alias2");
158147
}
159148

160-
@DisabledIf(value = "oldElasticsearchClient", disabledReason = "not implemented for the deprecated old client")
161149
@Test // #1458
162150
@DisplayName("should delete component template")
163151
void shouldDeleteComponentTemplate() {
@@ -185,7 +173,6 @@ void shouldDeleteComponentTemplate() {
185173
assertThat(exists).isFalse();
186174
}
187175

188-
@DisabledIf(value = "oldElasticsearchClient", disabledReason = "not implemented for the deprecated old client")
189176
@Test // #1458
190177
@DisplayName("should put, get and delete index template with template")
191178
void shouldPutGetAndDeleteIndexTemplateWithTemplate() {
@@ -225,7 +212,6 @@ void shouldPutGetAndDeleteIndexTemplateWithTemplate() {
225212
assertThat(exists).isFalse();
226213
}
227214

228-
@DisabledIf(value = "oldElasticsearchClient", disabledReason = "not implemented for the deprecated old client")
229215
@Test // #1458
230216
@DisplayName("should put, get and delete index template of components")
231217
void shouldPutGetAndDeleteIndexTemplateOfComponents() {
@@ -316,7 +302,6 @@ void shouldReturnNullOnNonExistingGetTemplate() {
316302
assertThat(templateData).isNull();
317303
}
318304

319-
@DisabledIf(value = "rhlcWithCluster8", disabledReason = "RHLC fails to parse response from ES 8.2")
320305
@Test // DATAES-612, #2073
321306
void shouldGetTemplate() throws JSONException {
322307
IndexOperations indexOps = operations.indexOps(IndexCoordinates.of("dont-care"));

src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderELCIntegrationTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,4 @@ IndexNameProvider indexNameProvider() {
3737
return new IndexNameProvider("mappingbuilder");
3838
}
3939
}
40-
41-
@Override
42-
public boolean newElasticsearchClient() {
43-
return true;
44-
}
4540
}

src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderIntegrationTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import org.junit.jupiter.api.Test;
4040
import org.springframework.beans.factory.annotation.Autowired;
4141
import org.springframework.data.annotation.Id;
42-
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
4342
import org.springframework.data.elasticsearch.annotations.*;
4443
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
4544
import org.springframework.data.elasticsearch.core.IndexOperations;
@@ -64,8 +63,7 @@
6463
* @author Morgan Lutz
6564
*/
6665
@SpringIntegrationTest
67-
public abstract class MappingBuilderIntegrationTests extends MappingContextBaseTests
68-
implements NewElasticsearchClientDevelopment {
66+
public abstract class MappingBuilderIntegrationTests extends MappingContextBaseTests {
6967

7068
@Autowired private ElasticsearchOperations operations;
7169
@Autowired protected IndexNameProvider indexNameProvider;

src/test/java/org/springframework/data/elasticsearch/core/index/ReactiveIndexOperationsELCIntegrationTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,4 @@ IndexNameProvider indexNameProvider() {
3535
return new IndexNameProvider("reactive-indexoperations");
3636
}
3737
}
38-
39-
@Override
40-
public boolean newElasticsearchClient() {
41-
return true;
42-
}
4338
}

src/test/java/org/springframework/data/elasticsearch/core/index/ReactiveIndexOperationsIntegrationTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.junit.jupiter.api.Test;
3131
import org.springframework.beans.factory.annotation.Autowired;
3232
import org.springframework.data.annotation.Id;
33-
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
3433
import org.springframework.data.elasticsearch.annotations.DateFormat;
3534
import org.springframework.data.elasticsearch.annotations.Document;
3635
import org.springframework.data.elasticsearch.annotations.Field;
@@ -49,17 +48,12 @@
4948
* @author Peter-Josef Meisch
5049
*/
5150
@SpringIntegrationTest
52-
public abstract class ReactiveIndexOperationsIntegrationTests implements NewElasticsearchClientDevelopment {
51+
public abstract class ReactiveIndexOperationsIntegrationTests {
5352

5453
@Autowired private ReactiveElasticsearchOperations operations;
5554
@Autowired private IndexNameProvider indexNameProvider;
5655
private ReactiveIndexOperations indexOperations;
5756

58-
boolean rhlcWithCluster8() {
59-
var clusterVersion = ((AbstractReactiveElasticsearchTemplate) operations).getClusterVersion().block();
60-
return (oldElasticsearchClient() && clusterVersion != null && clusterVersion.startsWith("8"));
61-
}
62-
6357
@BeforeEach
6458
void setUp() {
6559
indexNameProvider.increment();

src/test/java/org/springframework/data/elasticsearch/core/index/ReactiveIndexTemplateELCIntegrationTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,4 @@ IndexNameProvider indexNameProvider() {
3535
return new IndexNameProvider("reactive-index-template");
3636
}
3737
}
38-
39-
@Override
40-
public boolean newElasticsearchClient() {
41-
return true;
42-
}
4338
}

0 commit comments

Comments
 (0)