BAEL-53 - moved to java8 foreach
This commit is contained in:
parent
4101ebd609
commit
bc8fd9a260
@ -32,4 +32,18 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -5,6 +5,7 @@ import static org.junit.Assert.*;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -102,13 +103,9 @@ public class ElasticSearchUnitTests {
|
|||||||
try {
|
try {
|
||||||
response2.getHits();
|
response2.getHits();
|
||||||
response3.getHits();
|
response3.getHits();
|
||||||
SearchHit[] searchHits = response.getHits().getHits();
|
List<SearchHit> searchHits = Arrays.asList(response.getHits().getHits());
|
||||||
List<Person> results = new ArrayList<Person>();
|
final List<Person> results = new ArrayList<Person>();
|
||||||
for (SearchHit hit : searchHits) {
|
searchHits.forEach(hit -> results.add(JSON.parseObject(hit.getSourceAsString(), Person.class)));
|
||||||
String sourceAsString = hit.getSourceAsString();
|
|
||||||
Person person = JSON.parseObject(sourceAsString, Person.class);
|
|
||||||
results.add(person);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
isExecutedSuccessfully = false;
|
isExecutedSuccessfully = false;
|
||||||
}
|
}
|
||||||
|
1
pom.xml
1
pom.xml
@ -29,6 +29,7 @@
|
|||||||
<module>dozer</module>
|
<module>dozer</module>
|
||||||
<module>dependency-injection</module>
|
<module>dependency-injection</module>
|
||||||
<module>deltaspike</module>
|
<module>deltaspike</module>
|
||||||
|
<module>elasticsearch</module>
|
||||||
|
|
||||||
<module>enterprise-patterns</module>
|
<module>enterprise-patterns</module>
|
||||||
<module>feign-client</module>
|
<module>feign-client</module>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user