NIFI-10043 fix ElasticsearchClient integration tests following JUnit5 upgrade; update Elasticsearch and json-path dependency versions

Signed-off-by: Joe Gresock <jgresock@gmail.com>

This closes #6062.
This commit is contained in:
Chris Sampson 2022-05-20 12:54:45 +01:00 committed by Joe Gresock
parent e0976f42d3
commit 9c9c708c14
No known key found for this signature in database
GPG Key ID: 37F5B9B6E258C8B7
3 changed files with 16 additions and 16 deletions

View File

@ -135,7 +135,7 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.6.0</version>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@ -187,7 +187,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.6.3</version>
<version>3.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
@ -210,8 +210,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<!-- use 3.0.0-M3 due to a classpath/class loader issue in -M5, expected to be fixed in M6+ -->
<version>3.0.0-M3</version>
<version>3.0.0-M6</version>
</plugin>
</plugins>
</pluginManagement>
@ -251,7 +250,7 @@
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<es.int.version>7.17.1</es.int.version>
<es.int.version>7.17.3</es.int.version>
<es.int.script.name>setup-7.script</es.int.script.name>
<es.int.type.name />
<es.int.path.conf />
@ -264,7 +263,7 @@
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<es.int.version>8.0.1</es.int.version>
<es.int.version>8.2.0</es.int.version>
<!-- elasticsearch-maven-plugin version 6.20+ required for Elasticsearch 8.x+ -->
<alexcojocaru.plugin.version>6.22</alexcojocaru.plugin.version>
<es.int.script.name>setup-8.script</es.int.script.name>

View File

@ -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<String, Object> result = service.get(INDEX, TYPE, TEST_ID, null)
assertEquals("Not the same", doc, result)
assertEquals(doc, result, "Not the same")
Map<String, Object> 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<String, Object>).containsKey("error")
}.size() == 2
}

View File

@ -93,7 +93,7 @@ language governing permissions and limitations under the License. -->
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.6.0</version>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>