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

zjffdu 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 a616160  [ZEPPELIN-5094]. Unable to get EditorSetting for jdbc 
interpreter
a616160 is described below

commit a6161600039e85683276a270b1438d42c4615107
Author: Jeff Zhang <zjf...@apache.org>
AuthorDate: Tue Oct 13 16:45:38 2020 +0800

    [ZEPPELIN-5094]. Unable to get EditorSetting for jdbc interpreter
    
    ### What is this PR for?
    
    The root cause is that when there's only sub interpreter, zeppelin could 
not get the right editor setting based in interpreter name (because interpreter 
name is omitted by users). This PR fix this issue by just using method 
getDefaultInterpreterInfo to get the correct editor setting.
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5094
    
    ### How should this be tested?
    * Manually tested.
    
    ### Screenshots (if appropriate)
    
    
![image](https://user-images.githubusercontent.com/164491/95840602-edb07a80-0d76-11eb-88e0-8a7ea9951c20.png)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zjf...@apache.org>
    
    Closes #3941 from zjffdu/ZEPPELIN-5094 and squashes the following commits:
    
    256d6dfe7 [Jeff Zhang] [ZEPPELIN-5094]. Unable to get EditorSetting for 
jdbc interpreter
    
    (cherry picked from commit 80ca24c8a9cc765c0368439973df8ca2aabfc816)
    Signed-off-by: Jeff Zhang <zjf...@apache.org>
---
 .../zeppelin/interpreter/InterpreterSettingManager.java     |  2 +-
 .../zeppelin/interpreter/InterpreterSettingManagerTest.java | 13 +++++--------
 .../resources/interpreter/mock1/interpreter-setting.json    |  4 ++++
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
index 3977573..da6cc18 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
@@ -587,7 +587,7 @@ public class InterpreterSettingManager implements 
NoteEventListener, ClusterEven
             if (interpreterSetting == null) {
               return DEFAULT_EDITOR;
             }
-            return interpreterSetting.getInterpreterInfo(intpName).getEditor();
+            return interpreterSetting.getDefaultInterpreterInfo().getEditor();
           } catch (Exception e) {
             LOGGER.warn(e.getMessage());
             return DEFAULT_EDITOR;
diff --git 
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java
 
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java
index 167cb0f..bf7b048 100644
--- 
a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java
+++ 
b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterSettingManagerTest.java
@@ -188,17 +188,14 @@ public class InterpreterSettingManagerTest extends 
AbstractInterpreterTest {
 
   }
 
-  //@Test
-  public void testGetEditor() throws IOException, InterpreterNotFoundException 
{
-    Interpreter echoInterpreter = 
interpreterFactory.getInterpreter("test.echo", new 
ExecutionContextBuilder().setUser("user1").setNoteId("note1").setDefaultInterpreterGroup("test").createExecutionContext());
+  @Test
+  public void testGetEditor() {
     // get editor setting from interpreter-setting.json
-    Map<String, Object> editor = 
interpreterSettingManager.getEditorSetting("test.echo", "note1");
+    Map<String, Object> editor = 
interpreterSettingManager.getEditorSetting("%test.echo", "note1");
     assertEquals("java", editor.get("language"));
 
-    // when editor setting doesn't exit, return the default editor
-    Interpreter mock1Interpreter = interpreterFactory.getInterpreter("mock1", 
new 
ExecutionContextBuilder().setUser("user1").setNoteId("note1").setDefaultInterpreterGroup("test").createExecutionContext());
-    editor = interpreterSettingManager.getEditorSetting("mock1", "note1");
-    assertEquals("text", editor.get("language"));
+    editor = interpreterSettingManager.getEditorSetting("%mock1", "note1");
+    assertEquals("python", editor.get("language"));
   }
 
   @Test
diff --git 
a/zeppelin-zengine/src/test/resources/interpreter/mock1/interpreter-setting.json
 
b/zeppelin-zengine/src/test/resources/interpreter/mock1/interpreter-setting.json
index 2f628da..3b33972 100644
--- 
a/zeppelin-zengine/src/test/resources/interpreter/mock1/interpreter-setting.json
+++ 
b/zeppelin-zengine/src/test/resources/interpreter/mock1/interpreter-setting.json
@@ -5,6 +5,10 @@
     "className": "org.apache.zeppelin.interpreter.mock.MockInterpreter1",
     "properties": {
     },
+    "editor": {
+      "language": "python",
+      "editOnDblClick": false
+    },
     "option": {
       "remote": true,
       "port": -1,

Reply via email to