Skip to content

Commit

Permalink
Fixing test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Dec 9, 2024
1 parent 3373f5b commit 0c813a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ public Optional<JsonNode> get(String id){
ArrayNode docs = objectNode.withArray("docs");

for (JsonNode n : docs) {
boolean found = n.get("found").asBoolean();
boolean found = n.has("found") && n.get("found").asBoolean();
if (found) {
result.add(Optional.of(n));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import java.time.temporal.ChronoUnit;
import java.util.concurrent.atomic.AtomicLong;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.junit.jupiter.api.*;
import org.testcontainers.junit.jupiter.Testcontainers;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import nl.vpro.elasticsearch.Constants;
import nl.vpro.elasticsearch.CreateIndex;
import nl.vpro.test.opensearch.ElasticsearchContainer;
import nl.vpro.util.MaxOffsetIterator;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -24,7 +25,14 @@
* @since 0.47
*/
@Slf4j
public class ElasticSearchIteratorITest {
@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ElasticSearchIteratorContainerTest {



ElasticsearchContainer es = new ElasticsearchContainer(true);


static int ID = 0;
public static class A {
Expand All @@ -48,7 +56,7 @@ public A(String title, int value) {
public void setup() {

client = RestClient.builder(
new HttpHost("localhost", 9200, "http"))
es.getHttpHost())
.build();

helper = IndexHelper.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Slf4j
@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class IndexHelper2ITest {
public class IndexHelper2ContainerTest {
ElasticsearchContainer es = new ElasticsearchContainer(true);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@Slf4j
@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class IndexHelperITest {
public class IndexHelperContainerTest {

ElasticsearchContainer es = new ElasticsearchContainer(true);

Expand Down

0 comments on commit 0c813a5

Please sign in to comment.