zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject [zeppelin] 01/01: [HOTFIX] Fix test failure
Date Tue, 24 Sep 2019 14:41:56 GMT
This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch 0.8_hotfix
in repository https://gitbox.apache.org/repos/asf/zeppelin.git

commit 455bfc41c64f6406351299d4d6c53ee612ccb503
Author: Jeff Zhang <zjffdu@apache.org>
AuthorDate: Tue Sep 24 17:42:43 2019 +0800

    [HOTFIX] Fix test failure
---
 .../test/java/org/apache/zeppelin/spark/SparkShimsTest.java    |  2 +-
 .../src/main/scala/org/apache/zeppelin/spark/SparkShims.java   | 10 ++++------
 .../test/java/org/apache/zeppelin/notebook/ParagraphTest.java  |  6 +++---
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkShimsTest.java
b/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkShimsTest.java
index 361fd8d..fefb830 100644
--- a/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkShimsTest.java
+++ b/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkShimsTest.java
@@ -117,7 +117,7 @@ public class SparkShimsTest {
           .when(mockRemoteEventClientWrapper)
           .onParaInfosReceived(anyString(), anyString(), argumentCaptor.capture());
 
-      when(mockProperties.getProperty("spark.jobGroup.id")).thenReturn("job-note-paragraph");
+      when(mockProperties.getProperty("spark.jobGroup.id")).thenReturn("zeppelin-user1-note-paragraph");
 
       try {
         sparkShims = SparkShims.getInstance(SparkVersion.SPARK_2_0_0.toString(), new Properties());
diff --git a/spark/spark-shims/src/main/scala/org/apache/zeppelin/spark/SparkShims.java b/spark/spark-shims/src/main/scala/org/apache/zeppelin/spark/SparkShims.java
index 12464b5..f8e7d8c 100644
--- a/spark/spark-shims/src/main/scala/org/apache/zeppelin/spark/SparkShims.java
+++ b/spark/spark-shims/src/main/scala/org/apache/zeppelin/spark/SparkShims.java
@@ -93,15 +93,13 @@ public abstract class SparkShims {
   public abstract void setupSparkListener(String master, String sparkWebUrl);
 
   protected String getNoteId(String jobgroupId) {
-    int indexOf = jobgroupId.indexOf("-");
-    int secondIndex = jobgroupId.indexOf("-", indexOf + 1);
-    return jobgroupId.substring(indexOf + 1, secondIndex);
+    String[] tokens = jobgroupId.split("-");
+    return tokens[2];
   }
 
   protected String getParagraphId(String jobgroupId) {
-    int indexOf = jobgroupId.indexOf("-");
-    int secondIndex = jobgroupId.indexOf("-", indexOf + 1);
-    return jobgroupId.substring(secondIndex + 1, jobgroupId.length());
+    String[] tokens = jobgroupId.split("-");
+    return tokens[3];
   }
 
   protected void buildSparkJobUrl(
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
index f5580a4..d2b38c8 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java
@@ -342,11 +342,11 @@ public class ParagraphTest extends AbstractInterpreterTest {
     spyParagraph.setText("val x = \"usr={user.ent}&pass={password.ent}\"");
     
     // Credentials should only be injected when it is enabled for an interpreter
-    mockInterpreter.setProperty(Constants.INJECT_CREDENTIALS, "false");
+    when(mockInterpreter.getProperty(Constants.INJECT_CREDENTIALS, "false")).thenReturn("false");
     spyParagraph.jobRun();
     verify(mockInterpreter).interpret(eq("val x = \"usr={user.ent}&pass={password.ent}\""),
any(InterpreterContext.class));
-    
-    mockInterpreter.setProperty(Constants.INJECT_CREDENTIALS, "true");
+
+    when(mockInterpreter.getProperty(Constants.INJECT_CREDENTIALS, "false")).thenReturn("true");
     spyParagraph.jobRun();
     verify(mockInterpreter).interpret(eq("val x = \"usr=user&pass=pwd\""), any(InterpreterContext.class));
   }


Mime
View raw message