From 9c9c708c14a29b4b7527a801ca1dfd243c923b32 Mon Sep 17 00:00:00 2001 From: Chris Sampson Date: Fri, 20 May 2022 12:54:45 +0100 Subject: [PATCH] NIFI-10043 fix ElasticsearchClient integration tests following JUnit5 upgrade; update Elasticsearch and json-path dependency versions Signed-off-by: Joe Gresock This closes #6062. --- .../nifi-elasticsearch-client-service/pom.xml | 11 +++++------ .../ElasticSearchClientService_IT.groovy | 19 ++++++++++--------- .../pom.xml | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/pom.xml b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/pom.xml index 4965fed0f3..cb95985347 100644 --- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/pom.xml +++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/pom.xml @@ -135,7 +135,7 @@ com.jayway.jsonpath json-path - 2.6.0 + 2.7.0 org.apache.httpcomponents @@ -187,7 +187,7 @@ org.apache.maven maven-artifact - 3.6.3 + 3.8.5 test @@ -210,8 +210,7 @@ org.apache.maven.plugins maven-failsafe-plugin - - 3.0.0-M3 + 3.0.0-M6 @@ -251,7 +250,7 @@ false - 7.17.1 + 7.17.3 setup-7.script @@ -264,7 +263,7 @@ false - 8.0.1 + 8.2.0 6.22 setup-8.script diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/test/groovy/org/apache/nifi/elasticsearch/integration/ElasticSearchClientService_IT.groovy b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/test/groovy/org/apache/nifi/elasticsearch/integration/ElasticSearchClientService_IT.groovy index 26b46d687e..0997542af2 100644 --- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/test/groovy/org/apache/nifi/elasticsearch/integration/ElasticSearchClientService_IT.groovy +++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/test/groovy/org/apache/nifi/elasticsearch/integration/ElasticSearchClientService_IT.groovy @@ -34,13 +34,14 @@ import org.apache.nifi.util.StringUtils import org.apache.nifi.util.TestRunner import org.apache.nifi.util.TestRunners import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.Assumptions import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import static groovy.json.JsonOutput.prettyPrint import static groovy.json.JsonOutput.toJson +import static org.junit.jupiter.api.Assertions.assertNotEquals +import static org.junit.jupiter.api.Assertions.assertThrows import static org.junit.jupiter.api.Assumptions.assumeTrue import static org.junit.jupiter.api.Assertions.assertEquals @@ -83,7 +84,7 @@ class ElasticSearchClientService_IT { @BeforeAll static void beforeAll() throws Exception { - Assumptions.assumeTrue(isElasticsearchSetup(), "Elasticsearch integration-tests not setup") + assumeTrue(isElasticsearchSetup(), "Elasticsearch integration-tests not setup") System.out.println( String.format("%n%n%n%n%n%n%n%n%n%n%n%n%n%n%nTYPE: %s%nVERSION: %s%nFLAVOUR %s%n%n%n%n%n%n%n%n%n%n%n%n%n%n%n", @@ -119,7 +120,7 @@ class ElasticSearchClientService_IT { throw ex } - service.refresh(null, null); + service.refresh(null, null) } @AfterEach @@ -226,9 +227,9 @@ class ElasticSearchClientService_IT { @Test void testSearchWarnings() { - Assume.assumeTrue("Requires version <8.0 (no search API deprecations yet for 8.x)", VERSION < ES_8_0) + assumeTrue(VERSION < ES_8_0, "Requires version <8.0 (no search API deprecations yet for 8.x)") - String query + String query = null String type = TYPE if (VERSION.toString().startsWith("8.")) { // TODO: something that's deprecated when the 8.x branch progresses to include search-API deprecations @@ -287,11 +288,11 @@ class ElasticSearchClientService_IT { assertNull(scrollResponse.searchAfter, "Unexpected Search_After") assertNull(scrollResponse.pitId, "Unexpected pitId") - assertNotEquals(scrollResponse.hits, response.hits, "Same results") + assertNotEquals(scrollResponse.hits, response.hits, () -> "Same results") // delete the scroll DeleteOperationResponse deleteResponse = service.deleteScroll(scrollResponse.scrollId) - assertNotNull("Delete Response was null", deleteResponse) + assertNotNull(deleteResponse, "Delete Response was null") assertTrue(deleteResponse.took > 0) // delete scroll again (should now be unknown but the 404 caught and ignored) @@ -638,7 +639,7 @@ class ElasticSearchClientService_IT { doc.put("msg", "Buongiorno, mondo") service.add(new IndexOperationRequest(INDEX, TYPE, TEST_ID, doc, IndexOperationRequest.Operation.Index), [refresh: "true"]) Map result = service.get(INDEX, TYPE, TEST_ID, null) - assertEquals("Not the same", doc, result) + assertEquals(doc, result, "Not the same") Map updates = new HashMap<>() updates.put("from", "john.smith") @@ -684,7 +685,7 @@ class ElasticSearchClientService_IT { assert response.hasErrors() assert response.items.findAll { def key = it.keySet().stream().findFirst().get() - it[key].containsKey("error") + (it[key] as Map).containsKey("error") }.size() == 2 } diff --git a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/pom.xml b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/pom.xml index fbd129666a..731c8584e2 100644 --- a/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/pom.xml +++ b/nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/pom.xml @@ -93,7 +93,7 @@ language governing permissions and limitations under the License. --> com.jayway.jsonpath json-path - 2.6.0 + 2.7.0 compile