DATAES-328 - Replace explicit generics with diamond operator.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -84,7 +84,7 @@ public class NestedObjectTests {
|
||||
@Test
|
||||
public void shouldIndexInitialLevelNestedObject() {
|
||||
|
||||
final List<Car> cars = new ArrayList<Car>();
|
||||
final List<Car> cars = new ArrayList<>();
|
||||
|
||||
final Car saturn = new Car();
|
||||
saturn.setName("Saturn");
|
||||
@@ -116,7 +116,7 @@ public class NestedObjectTests {
|
||||
bar.setName("Bar");
|
||||
bar.setCar(Arrays.asList(car));
|
||||
|
||||
final List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
final List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
final IndexQuery indexQuery1 = new IndexQuery();
|
||||
indexQuery1.setId(foo.getId());
|
||||
indexQuery1.setObject(foo);
|
||||
@@ -165,7 +165,7 @@ public class NestedObjectTests {
|
||||
//when
|
||||
elasticsearchTemplate.putMapping(PersonMultipleLevelNested.class);
|
||||
elasticsearchTemplate.bulkIndex(indexQueries);
|
||||
// then
|
||||
// then
|
||||
|
||||
final Map mapping = elasticsearchTemplate.getMapping(PersonMultipleLevelNested.class);
|
||||
|
||||
@@ -253,7 +253,7 @@ public class NestedObjectTests {
|
||||
indexQuery2.setId(person2.getId());
|
||||
indexQuery2.setObject(person2);
|
||||
|
||||
final List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
final List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(indexQuery1);
|
||||
indexQueries.add(indexQuery2);
|
||||
|
||||
@@ -263,7 +263,7 @@ public class NestedObjectTests {
|
||||
@Test
|
||||
public void shouldSearchBooksForPersonInitialLevelNestedType() {
|
||||
|
||||
final List<Car> cars = new ArrayList<Car>();
|
||||
final List<Car> cars = new ArrayList<>();
|
||||
|
||||
final Car saturn = new Car();
|
||||
saturn.setName("Saturn");
|
||||
@@ -312,7 +312,7 @@ public class NestedObjectTests {
|
||||
bar.setName("Bar");
|
||||
bar.setCar(Arrays.asList(car));
|
||||
|
||||
final List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
final List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
final IndexQuery indexQuery1 = new IndexQuery();
|
||||
indexQuery1.setId(foo.getId());
|
||||
indexQuery1.setObject(foo);
|
||||
@@ -351,16 +351,16 @@ public class NestedObjectTests {
|
||||
book2.setId(randomNumeric(5));
|
||||
book2.setName("testBook2");
|
||||
|
||||
final Map<Integer, Collection<String>> map1 = new HashMap<Integer, Collection<String>>();
|
||||
final Map<Integer, Collection<String>> map1 = new HashMap<>();
|
||||
map1.put(1, Arrays.asList("test1", "test2"));
|
||||
|
||||
final Map<Integer, Collection<String>> map2 = new HashMap<Integer, Collection<String>>();
|
||||
final Map<Integer, Collection<String>> map2 = new HashMap<>();
|
||||
map2.put(1, Arrays.asList("test3", "test4"));
|
||||
|
||||
book1.setBuckets(map1);
|
||||
book2.setBuckets(map2);
|
||||
|
||||
final List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
final List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
final IndexQuery indexQuery1 = new IndexQuery();
|
||||
indexQuery1.setId(book1.getId());
|
||||
indexQuery1.setObject(book1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,7 @@ public class AliasTests {
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
Map<String, Object> settings = new HashMap<String, Object>();
|
||||
Map<String, Object> settings = new HashMap<>();
|
||||
settings.put("index.refresh_interval", "-1");
|
||||
settings.put("index.number_of_replicas", "0");
|
||||
settings.put("index.number_of_shards", "2");
|
||||
|
||||
@@ -187,7 +187,7 @@ public class DefaultResultMapperTests {
|
||||
}
|
||||
|
||||
private Map<String, SearchHitField> createCarFields(String name, String model) {
|
||||
Map<String, SearchHitField> result = new HashMap<String, SearchHitField>();
|
||||
Map<String, SearchHitField> result = new HashMap<>();
|
||||
result.put("name", new InternalSearchHitField("name", Arrays.<Object>asList(name)));
|
||||
result.put("model", new InternalSearchHitField("model", Arrays.<Object>asList(model)));
|
||||
return result;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -142,7 +142,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldReturnObjectsForGivenIdsUsingMultiGet() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = SampleEntity.builder().id(documentId).message("some message")
|
||||
@@ -170,7 +170,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldReturnObjectsForGivenIdsUsingMultiGetWithFields() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = SampleEntity.builder().id(documentId)
|
||||
@@ -198,7 +198,7 @@ public class ElasticsearchTemplateTests {
|
||||
LinkedList<SampleEntity> sampleEntities = elasticsearchTemplate.multiGet(query, SampleEntity.class, new MultiGetResultMapper() {
|
||||
@Override
|
||||
public <T> LinkedList<T> mapResults(MultiGetResponse responses, Class<T> clazz) {
|
||||
LinkedList<T> list = new LinkedList<T>();
|
||||
LinkedList<T> list = new LinkedList<>();
|
||||
for (MultiGetItemResponse response : responses.getResponses()) {
|
||||
SampleEntity entity = new SampleEntity();
|
||||
entity.setId(response.getResponse().getId());
|
||||
@@ -236,7 +236,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldDoBulkIndex() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = SampleEntity.builder().id(documentId).message("some message")
|
||||
@@ -280,7 +280,7 @@ public class ElasticsearchTemplateTests {
|
||||
UpdateQuery updateQuery = new UpdateQueryBuilder().withId(documentId)
|
||||
.withClass(SampleEntity.class).withIndexRequest(indexRequest).build();
|
||||
|
||||
List<UpdateQuery> queries = new ArrayList<UpdateQuery>();
|
||||
List<UpdateQuery> queries = new ArrayList<>();
|
||||
queries.add(updateQuery);
|
||||
|
||||
// when
|
||||
@@ -375,7 +375,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldSortResultsGivenSortCriteria() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = SampleEntity.builder().id(documentId)
|
||||
@@ -414,7 +414,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldSortResultsGivenMultipleSortCriteria() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = SampleEntity.builder().id(documentId)
|
||||
@@ -488,7 +488,7 @@ public class ElasticsearchTemplateTests {
|
||||
elasticsearchTemplate.index(indexQuery);
|
||||
elasticsearchTemplate.refresh(SampleEntity.class);
|
||||
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("factor", 2);
|
||||
// when
|
||||
SearchQuery searchQuery = new NativeSearchQueryBuilder()
|
||||
@@ -638,11 +638,11 @@ public class ElasticsearchTemplateTests {
|
||||
Page<String> page = elasticsearchTemplate.queryForPage(searchQuery, String.class, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<String> values = new ArrayList<String>();
|
||||
List<String> values = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
values.add((String) searchHit.field("message").value());
|
||||
}
|
||||
return new AggregatedPageImpl<T>((List<T>) values);
|
||||
return new AggregatedPageImpl<>((List<T>) values);
|
||||
}
|
||||
});
|
||||
// then
|
||||
@@ -731,7 +731,7 @@ public class ElasticsearchTemplateTests {
|
||||
criteriaQuery.setPageable(new PageRequest(0, 10));
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(criteriaQuery, 1000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, SampleEntity.class);
|
||||
@@ -758,7 +758,7 @@ public class ElasticsearchTemplateTests {
|
||||
.withTypes(TYPE_NAME).withPageable(new PageRequest(0, 10)).build();
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(searchQuery, 1000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, SampleEntity.class);
|
||||
@@ -791,13 +791,13 @@ public class ElasticsearchTemplateTests {
|
||||
criteriaQuery.setPageable(new PageRequest(0, 10));
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(criteriaQuery, 5000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<SampleEntity> result = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> result = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
String message = searchHit.getFields().get("message").getValue();
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
@@ -807,7 +807,7 @@ public class ElasticsearchTemplateTests {
|
||||
}
|
||||
|
||||
if (result.size() > 0) {
|
||||
return new AggregatedPageImpl<T>((List<T>) result);
|
||||
return new AggregatedPageImpl<>((List<T>) result);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -843,13 +843,13 @@ public class ElasticsearchTemplateTests {
|
||||
.build();
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(searchQuery, 10000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 10000L, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<SampleEntity> result = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> result = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
String message = searchHit.getFields().get("message").getValue();
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
@@ -859,7 +859,7 @@ public class ElasticsearchTemplateTests {
|
||||
}
|
||||
|
||||
if (result.size() > 0) {
|
||||
return new AggregatedPageImpl<T>((List<T>) result);
|
||||
return new AggregatedPageImpl<>((List<T>) result);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -892,13 +892,13 @@ public class ElasticsearchTemplateTests {
|
||||
criteriaQuery.setPageable(new PageRequest(0, 10));
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(criteriaQuery, 5000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<SampleEntity> chunk = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> chunk = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
if (response.getHits().getHits().length <= 0) {
|
||||
return null;
|
||||
@@ -909,7 +909,7 @@ public class ElasticsearchTemplateTests {
|
||||
chunk.add(user);
|
||||
}
|
||||
if (chunk.size() > 0) {
|
||||
return new AggregatedPageImpl<T>((List<T>) chunk);
|
||||
return new AggregatedPageImpl<>((List<T>) chunk);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -937,13 +937,13 @@ public class ElasticsearchTemplateTests {
|
||||
.withTypes(TYPE_NAME).withPageable(new PageRequest(0, 10)).build();
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(searchQuery, 1000, false);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<SampleEntity> chunk = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> chunk = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
if (response.getHits().getHits().length <= 0) {
|
||||
return null;
|
||||
@@ -954,7 +954,7 @@ public class ElasticsearchTemplateTests {
|
||||
chunk.add(user);
|
||||
}
|
||||
if (chunk.size() > 0) {
|
||||
return new AggregatedPageImpl<T>((List<T>) chunk);
|
||||
return new AggregatedPageImpl<>((List<T>) chunk);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -985,7 +985,7 @@ public class ElasticsearchTemplateTests {
|
||||
criteriaQuery.setPageable(new PageRequest(0, 10));
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(criteriaQuery, 1000, false, SampleEntity.class);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, SampleEntity.class);
|
||||
@@ -1015,7 +1015,7 @@ public class ElasticsearchTemplateTests {
|
||||
.withPageable(new PageRequest(0, 10)).build();
|
||||
|
||||
String scrollId = elasticsearchTemplate.scan(searchQuery, 1000, false, SampleEntity.class);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
boolean hasRecords = true;
|
||||
while (hasRecords) {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.scroll(scrollId, 5000L, SampleEntity.class);
|
||||
@@ -1047,7 +1047,7 @@ public class ElasticsearchTemplateTests {
|
||||
criteriaQuery.setPageable(new PageRequest(0, 10));
|
||||
|
||||
CloseableIterator<SampleEntity> stream = elasticsearchTemplate.stream(criteriaQuery, SampleEntity.class);
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
while (stream.hasNext()) {
|
||||
sampleEntities.add(stream.next());
|
||||
}
|
||||
@@ -1055,7 +1055,7 @@ public class ElasticsearchTemplateTests {
|
||||
}
|
||||
|
||||
private static List<IndexQuery> createSampleEntitiesWithMessage(String message, int numberOfEntities) {
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
for (int i = 0; i < numberOfEntities; i++) {
|
||||
String documentId = UUID.randomUUID().toString();
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
@@ -1074,7 +1074,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldReturnListForGivenCriteria() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = SampleEntity.builder().id(documentId)
|
||||
@@ -1249,7 +1249,7 @@ public class ElasticsearchTemplateTests {
|
||||
Page<SampleEntity> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<SampleEntity> chunk = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> chunk = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
if (response.getHits().getHits().length <= 0) {
|
||||
return null;
|
||||
@@ -1261,7 +1261,7 @@ public class ElasticsearchTemplateTests {
|
||||
chunk.add(user);
|
||||
}
|
||||
if (chunk.size() > 0) {
|
||||
return new AggregatedPageImpl<T>((List<T>) chunk);
|
||||
return new AggregatedPageImpl<>((List<T>) chunk);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1316,14 +1316,14 @@ public class ElasticsearchTemplateTests {
|
||||
Page<SampleEntity> page = elasticsearchTemplate.queryForPage(searchQuery, SampleEntity.class, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<SampleEntity> values = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> values = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
sampleEntity.setId(searchHit.getId());
|
||||
sampleEntity.setMessage((String) searchHit.getSource().get("message"));
|
||||
values.add(sampleEntity);
|
||||
}
|
||||
return new AggregatedPageImpl<T>((List<T>) values);
|
||||
return new AggregatedPageImpl<>((List<T>) values);
|
||||
}
|
||||
});
|
||||
assertThat(page, is(notNullValue()));
|
||||
@@ -1365,7 +1365,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldReturnDocumentAboveMinimalScoreGivenQuery() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
|
||||
indexQueries.add(buildIndex(SampleEntity.builder().id("1").message("ab").build()));
|
||||
indexQueries.add(buildIndex(SampleEntity.builder().id("2").message("bc").build()));
|
||||
@@ -1413,7 +1413,7 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldDoBulkIndexWithoutId() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
sampleEntity1.setMessage("some message");
|
||||
@@ -1446,14 +1446,14 @@ public class ElasticsearchTemplateTests {
|
||||
@Test
|
||||
public void shouldIndexMapWithIndexNameAndTypeAtRuntime() {
|
||||
//given
|
||||
Map<String, Object> person1 = new HashMap<String, Object>();
|
||||
Map<String, Object> person1 = new HashMap<>();
|
||||
person1.put("userId", "1");
|
||||
person1.put("email", "smhdiu@gmail.com");
|
||||
person1.put("title", "Mr");
|
||||
person1.put("firstName", "Mohsin");
|
||||
person1.put("lastName", "Husen");
|
||||
|
||||
Map<String, Object> person2 = new HashMap<String, Object>();
|
||||
Map<String, Object> person2 = new HashMap<>();
|
||||
person2.put("userId", "2");
|
||||
person2.put("email", "akonczak@gmail.com");
|
||||
person2.put("title", "Mr");
|
||||
@@ -1472,7 +1472,7 @@ public class ElasticsearchTemplateTests {
|
||||
indexQuery2.setIndexName(INDEX_NAME);
|
||||
indexQuery2.setType(TYPE_NAME);
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(indexQuery1);
|
||||
indexQueries.add(indexQuery2);
|
||||
|
||||
@@ -1486,12 +1486,12 @@ public class ElasticsearchTemplateTests {
|
||||
Page<Map> sampleEntities = elasticsearchTemplate.queryForPage(searchQuery, Map.class, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<Map> chunk = new ArrayList<Map>();
|
||||
List<Map> chunk = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
if (response.getHits().getHits().length <= 0) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> person = new HashMap<String, Object>();
|
||||
Map<String, Object> person = new HashMap<>();
|
||||
person.put("userId", searchHit.getSource().get("userId"));
|
||||
person.put("email", searchHit.getSource().get("email"));
|
||||
person.put("title", searchHit.getSource().get("title"));
|
||||
@@ -1500,7 +1500,7 @@ public class ElasticsearchTemplateTests {
|
||||
chunk.add(person);
|
||||
}
|
||||
if (chunk.size() > 0) {
|
||||
return new AggregatedPageImpl<T>((List<T>) chunk);
|
||||
return new AggregatedPageImpl<>((List<T>) chunk);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -2000,14 +2000,14 @@ public class ElasticsearchTemplateTests {
|
||||
Page<ResultAggregator> page = elasticsearchTemplate.queryForPage(searchQuery, ResultAggregator.class, new SearchResultMapper() {
|
||||
@Override
|
||||
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {
|
||||
List<ResultAggregator> values = new ArrayList<ResultAggregator>();
|
||||
List<ResultAggregator> values = new ArrayList<>();
|
||||
for (SearchHit searchHit : response.getHits()) {
|
||||
String id = String.valueOf(searchHit.getSource().get("id"));
|
||||
String firstName = StringUtils.isNotEmpty((String) searchHit.getSource().get("firstName")) ? (String) searchHit.getSource().get("firstName") : "";
|
||||
String lastName = StringUtils.isNotEmpty((String) searchHit.getSource().get("lastName")) ? (String) searchHit.getSource().get("lastName") : "";
|
||||
values.add(new ResultAggregator(id, firstName, lastName));
|
||||
}
|
||||
return new AggregatedPageImpl<T>((List<T>) values);
|
||||
return new AggregatedPageImpl<>((List<T>) values);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2051,7 +2051,7 @@ public class ElasticsearchTemplateTests {
|
||||
}
|
||||
|
||||
private List<IndexQuery> getIndexQueries(List<SampleEntity> sampleEntities) {
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
for (SampleEntity sampleEntity : sampleEntities) {
|
||||
indexQueries.add(new IndexQueryBuilder().withId(sampleEntity.getId()).withObject(sampleEntity).build());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
elasticsearchTemplate.refresh(CompletionEntity.class);
|
||||
elasticsearchTemplate.putMapping(CompletionEntity.class);
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(new CompletionEntityBuilder("1").name("Rizwan Idrees").suggest(new String[]{"Rizwan Idrees"}).buildIndex());
|
||||
indexQueries.add(new CompletionEntityBuilder("2").name("Franck Marchand").suggest(new String[]{"Franck", "Marchand"}).buildIndex());
|
||||
indexQueries.add(new CompletionEntityBuilder("3").name("Mohsin Husen").suggest(new String[]{"Mohsin", "Husen"}, "Mohsin Husen").buildIndex());
|
||||
@@ -81,7 +81,7 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
nonDocumentEntity.setSomeField1("foo");
|
||||
nonDocumentEntity.setSomeField2("bar");
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("1").name("Franck Marchand").suggest(new String[]{"Franck", "Marchand"}).buildIndex());
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("2").name("Mohsin Husen").suggest(new String[]{"Mohsin", "Husen"}, "Mohsin Husen").buildIndex());
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("3").name("Rizwan Idrees").suggest(new String[]{"Rizwan", "Idrees"}, "Rizwan Idrees").buildIndex());
|
||||
@@ -101,7 +101,7 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
nonDocumentEntity.setSomeField1("Payload");
|
||||
nonDocumentEntity.setSomeField2("test");
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("1").name("Mewes Kochheim1").suggest(new String[]{"Mewes Kochheim1"}, null, Double.MAX_VALUE).buildIndex());
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("2").name("Mewes Kochheim2").suggest(new String[]{"Mewes Kochheim2"}, null, Long.MAX_VALUE).buildIndex());
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("3").name("Mewes Kochheim3").suggest(new String[]{"Mewes Kochheim3"}, null, "Payload test").buildIndex());
|
||||
@@ -117,7 +117,7 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
elasticsearchTemplate.refresh(AnnotatedCompletionEntity.class);
|
||||
elasticsearchTemplate.putMapping(AnnotatedCompletionEntity.class);
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("1").name("Mewes Kochheim1").suggest(new String[]{"Mewes Kochheim1"}).buildIndex());
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("2").name("Mewes Kochheim2").suggest(new String[]{"Mewes Kochheim2"}, null, null, 0).buildIndex());
|
||||
indexQueries.add(new AnnotatedCompletionEntityBuilder("3").name("Mewes Kochheim3").suggest(new String[]{"Mewes Kochheim3"}, null, null, 1).buildIndex());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,10 +49,10 @@ public class ArticleEntity {
|
||||
@InnerField(suffix = "sort", type = String, store = true, indexAnalyzer = "keyword")
|
||||
}
|
||||
)
|
||||
private List<String> authors = new ArrayList<String>();
|
||||
private List<String> authors = new ArrayList<>();
|
||||
|
||||
@Field(type = Integer, store = true)
|
||||
private List<Integer> publishedYears = new ArrayList<Integer>();
|
||||
private List<Integer> publishedYears = new ArrayList<>();
|
||||
|
||||
private int score;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,7 +55,7 @@ public class ElasticsearchTemplateGeoTests {
|
||||
elasticsearchTemplate.refresh(AuthorMarkerEntity.class);
|
||||
elasticsearchTemplate.putMapping(AuthorMarkerEntity.class);
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
indexQueries.add(new AuthorMarkerEntityBuilder("1").name("Franck Marchand").location(45.7806d, 3.0875d).buildIndex());
|
||||
indexQueries.add(new AuthorMarkerEntityBuilder("2").name("Mohsin Husen").location(51.5171d, 0.1062d).buildIndex());
|
||||
indexQueries.add(new AuthorMarkerEntityBuilder("3").name("Rizwan Idrees").location(51.5171d, 0.1062d).buildIndex());
|
||||
@@ -69,7 +69,7 @@ public class ElasticsearchTemplateGeoTests {
|
||||
elasticsearchTemplate.refresh(LocationMarkerEntity.class);
|
||||
elasticsearchTemplate.putMapping(LocationMarkerEntity.class);
|
||||
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
double[] latLonArray = {0.100000, 51.000000};
|
||||
String lonLatString = "51.000000, 0.100000";
|
||||
String geohash = "u1044k2bd6u";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -78,7 +78,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformOrOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -117,7 +117,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformAndOperationWithinCriteria() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
@@ -144,7 +144,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformOrOperationWithinCriteria() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
@@ -170,7 +170,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformIsOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
@@ -196,7 +196,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformMultipleIsOperations() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -234,7 +234,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformEndsWithOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -273,7 +273,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformStartsWithOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -312,7 +312,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformContainsOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -350,7 +350,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldExecuteExpression() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -388,7 +388,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldExecuteCriteriaChain() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -427,7 +427,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformIsNotOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -466,7 +466,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformBetweenOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -505,7 +505,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformBetweenOperationWithoutUpperBound() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -545,7 +545,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformBetweenOperationWithoutLowerBound() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -585,7 +585,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformLessThanEqualOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -625,7 +625,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformGreaterThanEquals() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -665,7 +665,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldPerformBoostOperation() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
// first document
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity1 = new SampleEntity();
|
||||
@@ -704,7 +704,7 @@ public class CriteriaQueryTests {
|
||||
@Test
|
||||
public void shouldReturnDocumentAboveMinimalScoreGivenCriteria() {
|
||||
// given
|
||||
List<IndexQuery> indexQueries = new ArrayList<IndexQuery>();
|
||||
List<IndexQuery> indexQueries = new ArrayList<>();
|
||||
|
||||
indexQueries.add(buildIndex(SampleEntity.builder().id("1").message("ab").build()));
|
||||
indexQueries.add(buildIndex(SampleEntity.builder().id("2").message("bc").build()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,5 +43,5 @@ public class Book {
|
||||
@Field(type = FieldType.Object)
|
||||
private Author author;
|
||||
@Field(type = FieldType.Nested)
|
||||
private Map<Integer, Collection<String>> buckets = new HashMap<Integer, Collection<String>>();
|
||||
private Map<Integer, Collection<String>> buckets = new HashMap<>();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.entities;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -11,7 +26,6 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||
/**
|
||||
* Created by akonczak on 21/08/2016.
|
||||
*/
|
||||
|
||||
@Document(indexName = "groups", type = "group")
|
||||
public class Group {
|
||||
|
||||
@@ -19,5 +33,5 @@ public class Group {
|
||||
String id;
|
||||
|
||||
@Field(type = FieldType.Nested, ignoreFields ={"groups"})
|
||||
private Set<User> users = new HashSet<User>();
|
||||
private Set<User> users = new HashSet<>();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.entities;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -11,12 +26,11 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||
/**
|
||||
* Created by akonczak on 21/08/2016.
|
||||
*/
|
||||
|
||||
@Document(indexName = "users", type = "user")
|
||||
public class User {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
@Field(type= FieldType.Nested,ignoreFields={"users"})
|
||||
private Set<Group> groups = new HashSet<Group>();
|
||||
private Set<Group> groups = new HashSet<>();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1194,7 +1194,7 @@ public class CustomMethodRepositoryTests {
|
||||
}
|
||||
|
||||
private List<SampleEntity> createSampleEntities(String type, int numberOfEntities) {
|
||||
List<SampleEntity> entities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> entities = new ArrayList<>();
|
||||
for (int i = 0; i < numberOfEntities; i++) {
|
||||
SampleEntity entity = new SampleEntity();
|
||||
entity.setId(randomNumeric(numberOfEntities));
|
||||
|
||||
@@ -534,7 +534,7 @@ public class SimpleElasticsearchRepositoryTests {
|
||||
}
|
||||
|
||||
private static List<SampleEntity> createSampleEntitiesWithMessage(String message, int numberOfEntities) {
|
||||
List<SampleEntity> sampleEntities = new ArrayList<SampleEntity>();
|
||||
List<SampleEntity> sampleEntities = new ArrayList<>();
|
||||
for (int i = 0; i < numberOfEntities; i++) {
|
||||
String documentId = randomNumeric(5);
|
||||
SampleEntity sampleEntity = new SampleEntity();
|
||||
|
||||
@@ -490,7 +490,7 @@ public class UUIDElasticsearchRepositoryTests {
|
||||
}
|
||||
|
||||
private static List<SampleEntityUUIDKeyed> createSampleEntitiesWithMessage(String message, int numberOfEntities) {
|
||||
List<SampleEntityUUIDKeyed> sampleEntities = new ArrayList<SampleEntityUUIDKeyed>();
|
||||
List<SampleEntityUUIDKeyed> sampleEntities = new ArrayList<>();
|
||||
for (int i = 0; i < numberOfEntities; i++) {
|
||||
UUID documentId = UUID.randomUUID();
|
||||
SampleEntityUUIDKeyed sampleEntityUUIDKeyed = new SampleEntityUUIDKeyed();
|
||||
|
||||
Reference in New Issue
Block a user