mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Added test cases for "per note" as "isolated"
This commit is contained in:
parent
0d53d1da60
commit
bcccbb98cf
1 changed files with 38 additions and 0 deletions
|
|
@ -166,4 +166,42 @@ public class InterpreterSettingTest {
|
|||
interpreterSetting.closeAndRemoveInterpreterGroup("note2", "user1");
|
||||
assertEquals(0, interpreterSetting.getAllInterpreterGroups().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void perNoteIsolatedModeCloseAndRemoveInterpreterGroupTest() {
|
||||
InterpreterOption interpreterOption = new InterpreterOption();
|
||||
interpreterOption.setPerNote(InterpreterOption.ISOLATED);
|
||||
InterpreterSetting interpreterSetting = new InterpreterSetting("", "", "", new ArrayList<InterpreterInfo>(), new Properties(), new ArrayList<Dependency>(), interpreterOption, "", null);
|
||||
|
||||
interpreterSetting.setInterpreterGroupFactory(new InterpreterGroupFactory() {
|
||||
@Override
|
||||
public InterpreterGroup createInterpreterGroup(String interpreterGroupId,
|
||||
InterpreterOption option) {
|
||||
return new InterpreterGroup(interpreterGroupId);
|
||||
}
|
||||
});
|
||||
|
||||
Interpreter mockInterpreter1 = mock(RemoteInterpreter.class);
|
||||
List<Interpreter> interpreterList1 = new ArrayList<>();
|
||||
interpreterList1.add(mockInterpreter1);
|
||||
InterpreterGroup interpreterGroup = interpreterSetting.getInterpreterGroup("user1", "note1");
|
||||
interpreterGroup.put(interpreterSetting.getInterpreterSessionKey("user1", "note1"), interpreterList1);
|
||||
|
||||
Interpreter mockInterpreter2 = mock(RemoteInterpreter.class);
|
||||
List<Interpreter> interpreterList2 = new ArrayList<>();
|
||||
interpreterList2.add(mockInterpreter2);
|
||||
interpreterGroup = interpreterSetting.getInterpreterGroup("user1", "note2");
|
||||
interpreterGroup.put(interpreterSetting.getInterpreterSessionKey("user1", "note2"), interpreterList2);
|
||||
|
||||
assertEquals(2, interpreterSetting.getAllInterpreterGroups().size());
|
||||
assertEquals(1, interpreterSetting.getInterpreterGroup("user1", "note1").size());
|
||||
assertEquals(1, interpreterSetting.getInterpreterGroup("user1", "note2").size());
|
||||
|
||||
interpreterSetting.closeAndRemoveInterpreterGroup("note1", "user1");
|
||||
assertEquals(1, interpreterSetting.getInterpreterGroup("user1","note2").size());
|
||||
assertEquals(1, interpreterSetting.getAllInterpreterGroups().size());
|
||||
|
||||
interpreterSetting.closeAndRemoveInterpreterGroup("note2", "user1");
|
||||
assertEquals(0, interpreterSetting.getAllInterpreterGroups().size());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue