Skip to content

Commit 6ed521a

Browse files
committed
Removed adduser while creating note
Added test to guarantee paragraph.getUserParagraph is different from paragraph itself
1 parent 6eecdec commit 6ed521a

File tree

2 files changed

+16
-1
lines changed
  • zeppelin-zengine/src

2 files changed

+16
-1
lines changed

zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ public Paragraph insertNewParagraph(int index, AuthenticationInfo authentication
353353
private Paragraph createParagraph(int index, AuthenticationInfo authenticationInfo) {
354354
Paragraph p = new Paragraph(this, this, factory, interpreterSettingManager);
355355
p.setAuthenticationInfo(authenticationInfo);
356-
p.addUser(p, p.getUser());
357356
setParagraphMagic(p, index);
358357
return p;
359358
}

zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,20 @@ public void getNameWithoutNameItself() {
217217

218218
assertEquals("getName should return same as getId when name is empty", note.getId(), note.getName());
219219
}
220+
221+
@Test
222+
public void personalizedModeReturnDifferentParagraphInstancePerUser() {
223+
Note note = new Note(repo, interpreterFactory, interpreterSettingManager, jobListenerFactory, index, credentials, noteEventListener);
224+
225+
String user1 = "user1";
226+
String user2 = "user2";
227+
note.setPersonalizedMode(true);
228+
note.addNewParagraph(new AuthenticationInfo(user1));
229+
Paragraph baseParagraph = note.getParagraphs().get(0);
230+
Paragraph user1Paragraph = baseParagraph.getUserParagraph(user1);
231+
Paragraph user2Paragraph = baseParagraph.getUserParagraph(user2);
232+
assertNotEquals(System.identityHashCode(baseParagraph), System.identityHashCode(user1Paragraph));
233+
assertNotEquals(System.identityHashCode(baseParagraph), System.identityHashCode(user2Paragraph));
234+
assertNotEquals(System.identityHashCode(user1Paragraph), System.identityHashCode(user2Paragraph));
235+
}
220236
}

0 commit comments

Comments
 (0)