[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #7537: NIFI-11778 Initial check in of refactored Groovy tests in nifi-elasticsearch-restapi-processors to Java (and JUnit 5)

2023-08-02 Thread via GitHub


ChrisSamo632 commented on code in PR #7537:
URL: https://github.com/apache/nifi/pull/7537#discussion_r1282108131


##
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/AbstractPaginatedJsonQueryElasticsearchTest.java:
##
@@ -0,0 +1,350 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.nifi.processors.elasticsearch;
+
+import org.apache.nifi.processors.elasticsearch.api.AggregationResultsFormat;
+import org.apache.nifi.processors.elasticsearch.api.PaginationType;
+import org.apache.nifi.processors.elasticsearch.api.ResultOutputStrategy;
+import org.apache.nifi.processors.elasticsearch.api.SearchResultsFormat;
+import org.apache.nifi.provenance.ProvenanceEventType;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.TestRunner;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public abstract class AbstractPaginatedJsonQueryElasticsearchTest extends 
AbstractJsonQueryElasticsearchTest {
+   private static final String TEST_DIR = 
"src/test/resources/AbstractPaginatedJsonQueryElasticsearchTest";
+private static final String MATCH_ALL;
+   private static final String MATCH_ALL_WITH_SORT_BY_MESSAGE;
+   private static final String MATCH_ALL_WITH_SORT_BY_MSG;
+
+   static {
+   try {
+   MATCH_ALL = 
Files.readString(Paths.get("src/test/resources/common/matchAllQuery.json"));
+   MATCH_ALL_WITH_SORT_BY_MESSAGE = 
Files.readString(Paths.get(TEST_DIR, "matchAllWithSortByMessageQuery.json"));
+   MATCH_ALL_WITH_SORT_BY_MSG = 
Files.readString(Paths.get(TEST_DIR,"matchAllWithSortByMsgQueryWithoutSize.json"));
+   } catch (IOException e) {
+   throw new RuntimeException(e);
+   }
+   }

Review Comment:
   Yes, exactly that - you're correct that `super` isn't a thing (my bad), but 
you should be able to refer to 
`AbstractJsonQueryElasticsearchTest.setUpBeforeClass()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #7537: NIFI-11778 Initial check in of refactored Groovy tests in nifi-elasticsearch-restapi-processors to Java (and JUnit 5)

2023-08-02 Thread via GitHub


ChrisSamo632 commented on code in PR #7537:
URL: https://github.com/apache/nifi/pull/7537#discussion_r1282661035


##
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java:
##
@@ -0,0 +1,784 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.nifi.processors.elasticsearch;
+
+import org.apache.avro.Schema;
+import org.apache.nifi.avro.AvroTypeUtil;
+import org.apache.nifi.elasticsearch.IndexOperationRequest;
+import org.apache.nifi.elasticsearch.IndexOperationResponse;
+import org.apache.nifi.json.JsonRecordSetWriter;
+import org.apache.nifi.json.JsonTreeReader;
+import org.apache.nifi.processors.elasticsearch.mock.MockBulkLoadClientService;
+import org.apache.nifi.provenance.ProvenanceEventType;
+import org.apache.nifi.schema.access.SchemaAccessUtils;
+import org.apache.nifi.serialization.RecordReaderFactory;
+import org.apache.nifi.serialization.record.MockRecordParser;
+import org.apache.nifi.serialization.record.MockSchemaRegistry;
+import org.apache.nifi.serialization.record.RecordFieldType;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.function.Consumer;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PutElasticsearchRecordTest extends 
AbstractPutElasticsearchTest {
+private static final int DATE_YEAR = 2020;
+private static final int DATE_MONTH = 11;
+private static final int DATE_DAY = 27;
+private static final int TIME_HOUR = 12;
+private static final int TIME_MINUTE = 55;
+private static final int TIME_SECOND = 23;
+private static final LocalDateTime LOCAL_DATE_TIME = 
LocalDateTime.of(DATE_YEAR, DATE_MONTH, DATE_DAY, TIME_HOUR, TIME_MINUTE, 
TIME_SECOND);
+private static final LocalDate LOCAL_DATE = LocalDate.of(DATE_YEAR, 
DATE_MONTH, DATE_DAY);
+private static final LocalTime LOCAL_TIME = LocalTime.of(TIME_HOUR, 
TIME_MINUTE, TIME_SECOND);
+private static final String TEST_DIR = 
"src/test/resources/PutElasticsearchRecordTest";
+private static final String TEST_COMMON_DIR = "src/test/resources/common";
+private static String simpleSchema;
+private MockBulkLoadClientService clientService;
+private MockSchemaRegistry registry;
+private TestRunner runner;
+
+@Override
+public Class getTestProcessor() {
+return PutElasticsearchRecord.class;
+}
+
+@BeforeAll
+public static void setUpBeforeClass() throws Exception {
+simpleSchema = Files.readString(Paths.get(TEST_DIR, 
"simpleSchema.json"));
+TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+}
+
+@BeforeEach
+public void setup() throws Exception {
+clientService = new MockBulkLoadClientService();
+clientService.setResponse(new IndexOperationResponse(1500));
+registry = new MockSchemaRegistry();
+registry.addSchema("simple", AvroTypeUtil.createSchema(new 
Schema.Parser().parse(simpleSchema)));
+RecordReaderFactory reader = new JsonTreeReader();
+runner = TestRunners.newTestRunner(getTestProcessor());
+runner.addControllerService("registry", registry);
+runner.addControllerService("reader", reader);
+runner.addControllerService("clientService", clientService);
+runner.setProperty(reader, 

[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #7537: NIFI-11778 Initial check in of refactored Groovy tests in nifi-elasticsearch-restapi-processors to Java (and JUnit 5)

2023-08-02 Thread via GitHub


ChrisSamo632 commented on code in PR #7537:
URL: https://github.com/apache/nifi/pull/7537#discussion_r1282344859


##
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java:
##
@@ -0,0 +1,784 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.nifi.processors.elasticsearch;
+
+import org.apache.avro.Schema;
+import org.apache.nifi.avro.AvroTypeUtil;
+import org.apache.nifi.elasticsearch.IndexOperationRequest;
+import org.apache.nifi.elasticsearch.IndexOperationResponse;
+import org.apache.nifi.json.JsonRecordSetWriter;
+import org.apache.nifi.json.JsonTreeReader;
+import org.apache.nifi.processors.elasticsearch.mock.MockBulkLoadClientService;
+import org.apache.nifi.provenance.ProvenanceEventType;
+import org.apache.nifi.schema.access.SchemaAccessUtils;
+import org.apache.nifi.serialization.RecordReaderFactory;
+import org.apache.nifi.serialization.record.MockRecordParser;
+import org.apache.nifi.serialization.record.MockSchemaRegistry;
+import org.apache.nifi.serialization.record.RecordFieldType;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.function.Consumer;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PutElasticsearchRecordTest extends 
AbstractPutElasticsearchTest {
+private static final int DATE_YEAR = 2020;
+private static final int DATE_MONTH = 11;
+private static final int DATE_DAY = 27;
+private static final int TIME_HOUR = 12;
+private static final int TIME_MINUTE = 55;
+private static final int TIME_SECOND = 23;
+private static final LocalDateTime LOCAL_DATE_TIME = 
LocalDateTime.of(DATE_YEAR, DATE_MONTH, DATE_DAY, TIME_HOUR, TIME_MINUTE, 
TIME_SECOND);
+private static final LocalDate LOCAL_DATE = LocalDate.of(DATE_YEAR, 
DATE_MONTH, DATE_DAY);
+private static final LocalTime LOCAL_TIME = LocalTime.of(TIME_HOUR, 
TIME_MINUTE, TIME_SECOND);
+private static final String TEST_DIR = 
"src/test/resources/PutElasticsearchRecordTest";
+private static final String TEST_COMMON_DIR = "src/test/resources/common";
+private static String simpleSchema;
+private MockBulkLoadClientService clientService;
+private MockSchemaRegistry registry;
+private TestRunner runner;
+
+@Override
+public Class getTestProcessor() {
+return PutElasticsearchRecord.class;
+}
+
+@BeforeAll
+public static void setUpBeforeClass() throws Exception {
+simpleSchema = Files.readString(Paths.get(TEST_DIR, 
"simpleSchema.json"));
+TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

Review Comment:
   I wonder whether this is due to the Groovy tests having converted, for 
example, a `LocalDateTime` into a `Timestamp`, to an `Instant`, and finally the 
`long` representation of the "epoch millis" - this would (I think) cater for 
the Locale/TimeZone change in the JVM, e.g. a `Europe/Paris` TZ instead of 
`UTC`, allowing the tests to use a consistent basis for creating, using, and 
then asserting the timestamp/data/time
   
   With the change to a JSON-based structure for the FlowFile contents, are the 
timestamps being read from the file in one TZ then the tests and trying to 
use/assert them in another?
   
   I recall having to spend some time (no pun intended) on getting these tests 

[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #7537: NIFI-11778 Initial check in of refactored Groovy tests in nifi-elasticsearch-restapi-processors to Java (and JUnit 5)

2023-08-02 Thread via GitHub


ChrisSamo632 commented on code in PR #7537:
URL: https://github.com/apache/nifi/pull/7537#discussion_r1282306029


##
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchRecordTest.java:
##
@@ -0,0 +1,784 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.nifi.processors.elasticsearch;
+
+import org.apache.avro.Schema;
+import org.apache.nifi.avro.AvroTypeUtil;
+import org.apache.nifi.elasticsearch.IndexOperationRequest;
+import org.apache.nifi.elasticsearch.IndexOperationResponse;
+import org.apache.nifi.json.JsonRecordSetWriter;
+import org.apache.nifi.json.JsonTreeReader;
+import org.apache.nifi.processors.elasticsearch.mock.MockBulkLoadClientService;
+import org.apache.nifi.provenance.ProvenanceEventType;
+import org.apache.nifi.schema.access.SchemaAccessUtils;
+import org.apache.nifi.serialization.RecordReaderFactory;
+import org.apache.nifi.serialization.record.MockRecordParser;
+import org.apache.nifi.serialization.record.MockSchemaRegistry;
+import org.apache.nifi.serialization.record.RecordFieldType;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.function.Consumer;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PutElasticsearchRecordTest extends 
AbstractPutElasticsearchTest {
+private static final int DATE_YEAR = 2020;
+private static final int DATE_MONTH = 11;
+private static final int DATE_DAY = 27;
+private static final int TIME_HOUR = 12;
+private static final int TIME_MINUTE = 55;
+private static final int TIME_SECOND = 23;
+private static final LocalDateTime LOCAL_DATE_TIME = 
LocalDateTime.of(DATE_YEAR, DATE_MONTH, DATE_DAY, TIME_HOUR, TIME_MINUTE, 
TIME_SECOND);
+private static final LocalDate LOCAL_DATE = LocalDate.of(DATE_YEAR, 
DATE_MONTH, DATE_DAY);
+private static final LocalTime LOCAL_TIME = LocalTime.of(TIME_HOUR, 
TIME_MINUTE, TIME_SECOND);
+private static final String TEST_DIR = 
"src/test/resources/PutElasticsearchRecordTest";
+private static final String TEST_COMMON_DIR = "src/test/resources/common";
+private static String simpleSchema;
+private MockBulkLoadClientService clientService;
+private MockSchemaRegistry registry;
+private TestRunner runner;
+
+@Override
+public Class getTestProcessor() {
+return PutElasticsearchRecord.class;
+}
+
+@BeforeAll
+public static void setUpBeforeClass() throws Exception {
+simpleSchema = Files.readString(Paths.get(TEST_DIR, 
"simpleSchema.json"));
+TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

Review Comment:
   Needs a closer look - this doesn't seem right



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #7537: NIFI-11778 Initial check in of refactored Groovy tests in nifi-elasticsearch-restapi-processors to Java (and JUnit 5)

2023-07-30 Thread via GitHub


ChrisSamo632 commented on code in PR #7537:
URL: https://github.com/apache/nifi/pull/7537#discussion_r1278389375


##
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/IndexOperationRequest.java:
##
@@ -71,7 +71,7 @@ public Operation getOperation() {
 return operation;
 }
 
-public Map getScript() {
+public Map  getScript() {

Review Comment:
   ```suggestion
   public Map getScript() {
   ```
   
   Unnecessary change



##
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/test/java/org/apache/nifi/processors/elasticsearch/SearchElasticsearchTest.java:
##
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.nifi.processors.elasticsearch;
+
+import org.apache.nifi.components.state.Scope;
+import org.apache.nifi.processors.elasticsearch.api.PaginationType;
+import org.apache.nifi.processors.elasticsearch.api.ResultOutputStrategy;
+import org.apache.nifi.state.MockStateManager;
+import org.apache.nifi.util.TestRunner;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.time.Instant;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class SearchElasticsearchTest extends 
AbstractPaginatedJsonQueryElasticsearchTest {
+private static final String MATCH_ALL_WITH_SORT_BY_MSG_WITH_SIZE_QUERY;
+
+static {
+try {
+MATCH_ALL_WITH_SORT_BY_MSG_WITH_SIZE_QUERY = 
Files.readString(Paths.get("src/test/resources/AbstractPaginatedJsonQueryElasticsearchTest/matchAllWithSortByMsgQueryWithSize.json"));
+} catch (IOException e) {
+throw new RuntimeException(e);
+}
+}
+
+public AbstractPaginatedJsonQueryElasticsearch getProcessor() {
+return new SearchElasticsearch();
+}
+
+public boolean isStateUsed() {
+return true;
+}
+
+public boolean isInput() {
+return false;
+}
+
+@Test
+public void testScrollError() {
+final TestRunner runner = createRunner(false);
+final TestElasticsearchClientService service = 
AbstractJsonQueryElasticsearchTest.getService(runner);
+service.setMaxPages(2);
+service.setThrowErrorInSearch(false);
+
runner.setProperty(AbstractPaginatedJsonQueryElasticsearch.PAGINATION_TYPE, 
PaginationType.SCROLL.getValue());
+runner.setProperty(AbstractJsonQueryElasticsearch.QUERY, 
MATCH_ALL_WITH_SORT_BY_MSG_WITH_SIZE_QUERY);
+
+// initialize search
+runOnce(runner);
+AbstractJsonQueryElasticsearchTest.testCounts(runner, 0, 1, 0, 0);
+runner.clearTransferState();
+
+// scroll (error)
+service.setThrowErrorInSearch(true);
+runOnce(runner);
+AbstractJsonQueryElasticsearchTest.testCounts(runner, 0, 0, 0, 0);
+
assertTrue(runner.getLogger().getErrorMessages().stream().anyMatch(logMessage ->
+logMessage.getMsg().contains("Could not query documents") && 
logMessage.getThrowable().getMessage().contains("Simulated IOException - 
scroll")));
+}
+
+@Test
+public void testScrollExpiration() throws Exception {
+testPaginationExpiration(PaginationType.SCROLL);
+}
+
+@Test
+public void testPitExpiration() throws Exception {
+testPaginationExpiration(PaginationType.POINT_IN_TIME);
+}
+
+@Test
+public void testSearchAfterExpiration() throws Exception {
+testPaginationExpiration(PaginationType.SEARCH_AFTER);
+}
+
+private void testPaginationExpiration(final PaginationType paginationType) 
throws Exception{
+// test flowfile per page
+final TestRunner runner = createRunner(false);
+final TestElasticsearchClientService service = 
AbstractJsonQueryElasticsearchTest.getService(runner);
+service.setMaxPages(2);
+
runner.setProperty(AbstractPaginatedJsonQueryElasticsearch.PAGINATION_TYPE, 
paginationType.getValue());