You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pd...@apache.org on 2021/02/09 09:17:57 UTC

[zeppelin] branch branch-0.9 updated: [ZEPPELIN-5240] Neo4jCypherInterpreterTest fails

This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new 98b9626  [ZEPPELIN-5240] Neo4jCypherInterpreterTest fails
98b9626 is described below

commit 98b96269f2fc40ecb0af2c5a2d7f612f43fe281f
Author: Philipp Dallig <ph...@gmail.com>
AuthorDate: Mon Feb 8 17:09:54 2021 +0100

    [ZEPPELIN-5240] Neo4jCypherInterpreterTest fails
    
    ### What is this PR for?
    This PR should fix the testcontainers error.
    More informations can be found at https://github.com/testcontainers/testcontainers-java/issues/3574
    
    ### What type of PR is it?
     - Bug Fix
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5240
    
    ### How should this be tested?
    * CI
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Philipp Dallig <ph...@gmail.com>
    
    Closes #4050 from Reamer/testcontainer and squashes the following commits:
    
    720427baa [Philipp Dallig] Cleanup the code
    d55d777de [Philipp Dallig] Update testcontainers
    
    (cherry picked from commit bcbadc64aaa287c2556af5f348cf01e9c5aef287)
    Signed-off-by: Philipp Dallig <ph...@gmail.com>
---
 .../graph/neo4j/Neo4jCypherInterpreter.java        |  2 +-
 .../graph/neo4j/Neo4jCypherInterpreterTest.java    | 67 +++++++++++-----------
 pom.xml                                            |  2 +-
 3 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/neo4j/src/main/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreter.java b/neo4j/src/main/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreter.java
index b13ed9d..54436cc 100644
--- a/neo4j/src/main/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreter.java
+++ b/neo4j/src/main/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreter.java
@@ -238,7 +238,7 @@ public class Neo4jCypherInterpreter extends Interpreter {
         try {
           value = Neo4jConversionUtils.JSON_MAPPER.writer().writeValueAsString(value);
         } catch (Exception e) {
-          LOGGER.debug("ignored exception: " + e.getMessage());
+          LOGGER.debug("ignored exception: {}", e.getMessage());
         }
       }
     }
diff --git a/neo4j/src/test/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreterTest.java b/neo4j/src/test/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreterTest.java
index 208d3d6..9f363f0 100644
--- a/neo4j/src/test/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreterTest.java
+++ b/neo4j/src/test/java/org/apache/zeppelin/graph/neo4j/Neo4jCypherInterpreterTest.java
@@ -46,6 +46,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class Neo4jCypherInterpreterTest {
@@ -55,7 +56,7 @@ public class Neo4jCypherInterpreterTest {
   private InterpreterContext context;
 
   @ClassRule
-  public static Neo4jContainer neo4jContainer = new Neo4jContainer("neo4j:4.1.1")
+  public static Neo4jContainer<?> neo4jContainer = new Neo4jContainer<>("neo4j:4.1.1")
           .withoutAuthentication();
 
   private static final Gson gson = new Gson();
@@ -153,15 +154,15 @@ public class Neo4jCypherInterpreterTest {
     assertEquals(Code.SUCCESS, result.code());
     String[] rows = result.toString().replace(TABLE_RESULT_PREFIX, StringUtils.EMPTY)
             .split(Neo4jCypherInterpreter.NEW_LINE);
-    assertEquals(rows.length, 2);
+    assertEquals(2, rows.length);
     List<String> header = Arrays.asList(rows[0].split(Neo4jCypherInterpreter.TAB));
-    assertEquals(header.contains(objectKey), true);
-    assertEquals(header.contains(objectListKey), true);
+    assertTrue(header.contains(objectKey));
+    assertTrue(header.contains(objectListKey));
     List<String> row = Arrays.asList(rows[1].split(Neo4jCypherInterpreter.TAB));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value");
-    assertEquals(row.get(header.indexOf(objectListKey)),
-            "[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]");
+    assertEquals("value", row.get(header.indexOf(objectKey)));
+    assertEquals("[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]",
+        row.get(header.indexOf(objectListKey)));
 
     final String query = "WITH [{key: \"value\", listKey: [{inner: \"Map1\"}, {inner: \"Map2\"}]},"
             + "{key: \"value2\", listKey: [{inner: \"Map12\"}, {inner: \"Map22\"}]}] "
@@ -170,20 +171,20 @@ public class Neo4jCypherInterpreterTest {
     assertEquals(Code.SUCCESS, result.code());
     rows = result.toString().replace(TABLE_RESULT_PREFIX, StringUtils.EMPTY)
             .split(Neo4jCypherInterpreter.NEW_LINE);
-    assertEquals(rows.length, 3);
+    assertEquals(3, rows.length);
     header = Arrays.asList(rows[0].split(Neo4jCypherInterpreter.TAB));
-    assertEquals(header.contains(objectKey), true);
-    assertEquals(header.contains(objectListKey), true);
+    assertTrue(header.contains(objectKey));
+    assertTrue(header.contains(objectListKey));
     row = Arrays.asList(rows[1].split(Neo4jCypherInterpreter.TAB));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value");
-    assertEquals(row.get(header.indexOf(objectListKey)),
-            "[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]");
+    assertEquals("value", row.get(header.indexOf(objectKey)));
+    assertEquals("[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]",
+        row.get(header.indexOf(objectListKey)));
     row = Arrays.asList(rows[2].split(Neo4jCypherInterpreter.TAB));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value2");
-    assertEquals(row.get(header.indexOf(objectListKey)),
-            "[{\"inner\":\"Map12\"},{\"inner\":\"Map22\"}]");
+    assertEquals("value2", row.get(header.indexOf(objectKey)));
+    assertEquals("[{\"inner\":\"Map12\"},{\"inner\":\"Map22\"}]",
+        row.get(header.indexOf(objectListKey)));
 
     final String jsonListWithNullQuery = "WITH [{key: \"value\", listKey: null},"
             + "{key: \"value2\", listKey: [{inner: \"Map1\"}, {inner: \"Map2\"}]}] "
@@ -192,20 +193,20 @@ public class Neo4jCypherInterpreterTest {
     assertEquals(Code.SUCCESS, result.code());
     rows = result.toString().replace(TABLE_RESULT_PREFIX, StringUtils.EMPTY)
             .split(Neo4jCypherInterpreter.NEW_LINE);
-    assertEquals(rows.length, 3);
+    assertEquals(3, rows.length);
     header = Arrays.asList(rows[0].split(Neo4jCypherInterpreter.TAB, -1));
-    assertEquals(header.contains(objectKey), true);
-    assertEquals(header.contains(objectListKey), true);
+    assertTrue(header.contains(objectKey));
+    assertTrue(header.contains(objectListKey));
     row = Arrays.asList(rows[1].split(Neo4jCypherInterpreter.TAB, -1));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value");
-    assertEquals(row.get(header.indexOf(objectListKey)), StringUtils.EMPTY);
-    assertEquals(row.get(header.indexOf(objectListKey)), "");
+    assertEquals("value", row.get(header.indexOf(objectKey)));
+    assertEquals(StringUtils.EMPTY, row.get(header.indexOf(objectListKey)));
+    assertEquals("", row.get(header.indexOf(objectListKey)));
     row = Arrays.asList(rows[2].split(Neo4jCypherInterpreter.TAB, -1));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value2");
-    assertEquals(row.get(header.indexOf(objectListKey)),
-            "[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]");
+    assertEquals("value2", row.get(header.indexOf(objectKey)));
+    assertEquals("[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]",
+        row.get(header.indexOf(objectListKey)));
 
     final String jsonListWithoutListKeyQuery = "WITH [{key: \"value\"},"
             + "{key: \"value2\", listKey: [{inner: \"Map1\"}, {inner: \"Map2\"}]}] "
@@ -214,19 +215,19 @@ public class Neo4jCypherInterpreterTest {
     assertEquals(Code.SUCCESS, result.code());
     rows = result.toString().replace(TABLE_RESULT_PREFIX, StringUtils.EMPTY)
             .split(Neo4jCypherInterpreter.NEW_LINE);
-    assertEquals(rows.length, 3);
+    assertEquals(3, rows.length);
     header = Arrays.asList(rows[0].split(Neo4jCypherInterpreter.TAB, -1));
-    assertEquals(header.contains(objectKey), true);
-    assertEquals(header.contains(objectListKey), true);
+    assertTrue(header.contains(objectKey));
+    assertTrue(header.contains(objectListKey));
     row = Arrays.asList(rows[1].split(Neo4jCypherInterpreter.TAB, -1));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value");
-    assertEquals(row.get(header.indexOf(objectListKey)), StringUtils.EMPTY);
+    assertEquals("value", row.get(header.indexOf(objectKey)));
+    assertEquals(StringUtils.EMPTY, row.get(header.indexOf(objectListKey)));
     row = Arrays.asList(rows[2].split(Neo4jCypherInterpreter.TAB, -1));
     assertEquals(row.size(), header.size());
-    assertEquals(row.get(header.indexOf(objectKey)), "value2");
-    assertEquals(row.get(header.indexOf(objectListKey)),
-            "[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]");
+    assertEquals("value2", row.get(header.indexOf(objectKey)));
+    assertEquals("[{\"inner\":\"Map1\"},{\"inner\":\"Map2\"}]",
+        row.get(header.indexOf(objectListKey)));
   }
 
   @Test
diff --git a/pom.xml b/pom.xml
index 176d84d..27fc92a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -203,7 +203,7 @@
     <plugin.surefire.version>2.17</plugin.surefire.version>
     <plugin.xml.version>1.0.2</plugin.xml.version>
 
-    <testcontainers.version>1.14.3</testcontainers.version>
+    <testcontainers.version>1.15.1</testcontainers.version>
 
     <plugin.gitcommitid.useNativeGit>false</plugin.gitcommitid.useNativeGit>