Repository: zeppelin Updated Branches: refs/heads/branch-0.6 1d88e3a77 -> b422bdf2a
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepo.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepo.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepo.java index 2c249c9..d2f6ca2 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepo.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepo.java @@ -29,6 +29,7 @@ import org.apache.zeppelin.notebook.NoteInfo; import org.apache.zeppelin.notebook.repo.NotebookRepo; import org.apache.zeppelin.notebook.repo.zeppelinhub.rest.ZeppelinhubRestApiHandler; import org.apache.zeppelin.notebook.repo.zeppelinhub.websocket.Client; +import org.apache.zeppelin.user.AuthenticationInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -141,7 +142,7 @@ public class ZeppelinHubRepo implements NotebookRepo { } @Override - public List<NoteInfo> list() throws IOException { + public List<NoteInfo> list(AuthenticationInfo subject) throws IOException { String response = restApiClient.asyncGet(""); List<NoteInfo> notes = GSON.fromJson(response, new TypeToken<List<NoteInfo>>() {}.getType()); if (notes == null) { @@ -152,7 +153,7 @@ public class ZeppelinHubRepo implements NotebookRepo { } @Override - public Note get(String noteId) throws IOException { + public Note get(String noteId, AuthenticationInfo subject) throws IOException { if (StringUtils.isBlank(noteId)) { return EMPTY_NOTE; } @@ -167,7 +168,7 @@ public class ZeppelinHubRepo implements NotebookRepo { } @Override - public void save(Note note) throws IOException { + public void save(Note note, AuthenticationInfo subject) throws IOException { if (note == null) { throw new IOException("Zeppelinhub failed to save empty note"); } @@ -177,7 +178,7 @@ public class ZeppelinHubRepo implements NotebookRepo { } @Override - public void remove(String noteId) throws IOException { + public void remove(String noteId, AuthenticationInfo subject) throws IOException { restApiClient.asyncDel(noteId); LOG.info("ZeppelinHub REST API removing note {} ", noteId); } @@ -188,19 +189,20 @@ public class ZeppelinHubRepo implements NotebookRepo { } @Override - public Revision checkpoint(String noteId, String checkpointMsg) throws IOException { + public Revision checkpoint(String noteId, String checkpointMsg, AuthenticationInfo subject) + throws IOException { // Auto-generated method stub return null; } @Override - public Note get(String noteId, Revision rev) throws IOException { + public Note get(String noteId, Revision rev, AuthenticationInfo subject) throws IOException { // Auto-generated method stub return null; } @Override - public List<Revision> revisionHistory(String noteId) { + public List<Revision> revisionHistory(String noteId, AuthenticationInfo subject) { // Auto-generated method stub return null; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java index 1f7d5c0..d4ca87d 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java @@ -105,7 +105,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testSelectingReplImplementation() throws IOException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); // run with defatul repl @@ -144,8 +144,8 @@ public class NotebookTest implements JobListenerFactory{ assertEquals(notes.size(), 0); // load copied notebook on memory when reloadAllNotes() is called - Note copiedNote = notebookRepo.get("2A94M5J1Z"); - notebook.reloadAllNotes(); + Note copiedNote = notebookRepo.get("2A94M5J1Z", null); + notebook.reloadAllNotes(null); notes = notebook.getAllNotes(); assertEquals(notes.size(), 1); assertEquals(notes.get(0).id(), copiedNote.id()); @@ -160,14 +160,14 @@ public class NotebookTest implements JobListenerFactory{ assertEquals(notes.size(), 1); // delete notebook from notebook list when reloadAllNotes() is called - notebook.reloadAllNotes(); + notebook.reloadAllNotes(null); notes = notebook.getAllNotes(); assertEquals(notes.size(), 0); } @Test public void testPersist() throws IOException, SchedulerException, RepositoryException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); // run with default repl Paragraph p1 = note.addParagraph(); @@ -175,7 +175,7 @@ public class NotebookTest implements JobListenerFactory{ config.put("enabled", true); p1.setConfig(config); p1.setText("hello world"); - note.persist(); + note.persist(null); Notebook notebook2 = new Notebook( conf, notebookRepo, schedulerFactory, @@ -185,7 +185,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testClearParagraphOutput() throws IOException, SchedulerException{ - Note note = notebook.createNote(); + Note note = notebook.createNote(null); Paragraph p1 = note.addParagraph(); Map config = p1.getConfig(); config.put("enabled", true); @@ -203,7 +203,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testRunAll() throws IOException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); // p1 @@ -236,13 +236,13 @@ public class NotebookTest implements JobListenerFactory{ assertNull(p2.getResult()); assertEquals("repl1: p3", p3.getResult().message()); - notebook.removeNote(note.getId()); + notebook.removeNote(note.getId(), null); } @Test public void testSchedule() throws InterruptedException, IOException{ // create a note and a paragraph - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); Paragraph p = note.addParagraph(); @@ -274,7 +274,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testAutoRestartInterpreterAfterSchedule() throws InterruptedException, IOException{ // create a note and a paragraph - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); Paragraph p = note.addParagraph(); @@ -326,7 +326,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testCloneNote() throws IOException, CloneNotSupportedException, InterruptedException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); final Paragraph p = note.addParagraph(); @@ -335,7 +335,7 @@ public class NotebookTest implements JobListenerFactory{ while(p.isTerminated()==false || p.getResult()==null) Thread.yield(); p.setStatus(Status.RUNNING); - Note cloneNote = notebook.cloneNote(note.getId(), "clone note"); + Note cloneNote = notebook.cloneNote(note.getId(), "clone note", null); Paragraph cp = cloneNote.paragraphs.get(0); assertEquals(cp.getStatus(), Status.READY); @@ -347,7 +347,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testResourceRemovealOnParagraphNoteRemove() throws IOException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); for (InterpreterGroup intpGroup : InterpreterGroup.getAll()) { intpGroup.setResourcePool(new LocalResourcePool(intpGroup.getId())); @@ -368,7 +368,7 @@ public class NotebookTest implements JobListenerFactory{ assertEquals(1, ResourcePoolUtils.getAllResources().size()); // remove note - notebook.removeNote(note.id()); + notebook.removeNote(note.id(), null); assertEquals(0, ResourcePoolUtils.getAllResources().size()); } @@ -376,7 +376,7 @@ public class NotebookTest implements JobListenerFactory{ public void testAngularObjectRemovalOnNotebookRemove() throws InterruptedException, IOException { // create a note and a paragraph - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); AngularObjectRegistry registry = note.getNoteReplLoader() @@ -395,7 +395,7 @@ public class NotebookTest implements JobListenerFactory{ registry.add("o3", "object3", null, null); // remove notebook - notebook.removeNote(note.id()); + notebook.removeNote(note.id(), null); // notebook scope or paragraph scope object should be removed assertNull(registry.get("o1", note.id(), null)); @@ -409,7 +409,7 @@ public class NotebookTest implements JobListenerFactory{ public void testAngularObjectRemovalOnParagraphRemove() throws InterruptedException, IOException { // create a note and a paragraph - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); AngularObjectRegistry registry = note.getNoteReplLoader() @@ -442,7 +442,7 @@ public class NotebookTest implements JobListenerFactory{ public void testAngularObjectRemovalOnInterpreterRestart() throws InterruptedException, IOException { // create a note and a paragraph - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); AngularObjectRegistry registry = note.getNoteReplLoader() @@ -463,13 +463,13 @@ public class NotebookTest implements JobListenerFactory{ // local and global scope object should be removed assertNull(registry.get("o1", note.id(), null)); assertNull(registry.get("o2", null, null)); - notebook.removeNote(note.id()); + notebook.removeNote(note.id(), null); } @Test public void testPermissions() throws IOException { // create a note and a paragraph - Note note = notebook.createNote(); + Note note = notebook.createNote(null); NotebookAuthorization notebookAuthorization = notebook.getNotebookAuthorization(); // empty owners, readers and writers means note is public assertEquals(notebookAuthorization.isOwner(note.id(), @@ -508,13 +508,13 @@ public class NotebookTest implements JobListenerFactory{ assertEquals(notebookAuthorization.isReader(note.id(), new HashSet<String>(Arrays.asList("user3"))), true); - notebook.removeNote(note.id()); + notebook.removeNote(note.id(), null); } @Test public void testAbortParagraphStatusOnInterpreterRestart() throws InterruptedException, IOException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); ArrayList<Paragraph> paragraphs = new ArrayList<>(); @@ -551,7 +551,7 @@ public class NotebookTest implements JobListenerFactory{ @Test public void testPerSessionInterpreterCloseOnNoteRemoval() throws IOException { // create a notes - Note note1 = notebook.createNote(); + Note note1 = notebook.createNote(null); Paragraph p1 = note1.addParagraph(); p1.setText("getId"); @@ -566,8 +566,8 @@ public class NotebookTest implements JobListenerFactory{ InterpreterResult result = p1.getResult(); // remove note and recreate - notebook.removeNote(note1.getId()); - note1 = notebook.createNote(); + notebook.removeNote(note1.getId(), null); + note1 = notebook.createNote(null); p1 = note1.addParagraph(); p1.setText("getId"); @@ -575,16 +575,16 @@ public class NotebookTest implements JobListenerFactory{ while (p1.getStatus() != Status.FINISHED) Thread.yield(); assertNotEquals(p1.getResult().message(), result.message()); - notebook.removeNote(note1.getId()); + notebook.removeNote(note1.getId(), null); } @Test public void testPerSessionInterpreter() throws IOException { // create two notes - Note note1 = notebook.createNote(); + Note note1 = notebook.createNote(null); Paragraph p1 = note1.addParagraph(); - Note note2 = notebook.createNote(); + Note note2 = notebook.createNote(null); Paragraph p2 = note2.addParagraph(); p1.setText("getId"); @@ -615,14 +615,14 @@ public class NotebookTest implements JobListenerFactory{ assertNotEquals(p1.getResult().message(), p2.getResult().message()); - notebook.removeNote(note1.getId()); - notebook.removeNote(note2.getId()); + notebook.removeNote(note1.getId(), null); + notebook.removeNote(note2.getId(), null); } @Test public void testPerSessionInterpreterCloseOnUnbindInterpreterSetting() throws IOException { // create a notes - Note note1 = notebook.createNote(); + Note note1 = notebook.createNote(null); Paragraph p1 = note1.addParagraph(); p1.setText("getId"); @@ -647,13 +647,13 @@ public class NotebookTest implements JobListenerFactory{ assertNotEquals(result.message(), p1.getResult().message()); - notebook.removeNote(note1.getId()); + notebook.removeNote(note1.getId(), null); } @Test public void testNormalizeNoteName() throws IOException { // create a notes - Note note1 = notebook.createNote(); + Note note1 = notebook.createNote(null); note1.setName("MyNote"); assertEquals(note1.getName(), "MyNote"); @@ -673,7 +673,7 @@ public class NotebookTest implements JobListenerFactory{ note1.setName("\\\\\\MyNote///sub"); assertEquals(note1.getName(), "/MyNote/sub"); - notebook.removeNote(note1.getId()); + notebook.removeNote(note1.getId(), null); } private void delete(File file){ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java index fe020cb..39db0fe 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/GitNotebookRepoTest.java @@ -97,7 +97,7 @@ public class GitNotebookRepoTest { assertThat(git).isNotNull(); assertThat(dotGit.exists()).isEqualTo(true); - assertThat(notebookRepo.list()).isNotEmpty(); + assertThat(notebookRepo.list(null)).isNotEmpty(); List<DiffEntry> diff = git.diff().call(); // no commit, diff isn't empty @@ -108,10 +108,10 @@ public class GitNotebookRepoTest { public void showNotebookHistory() throws GitAPIException, IOException { //given notebookRepo = new GitNotebookRepo(conf); - assertThat(notebookRepo.list()).isNotEmpty(); + assertThat(notebookRepo.list(null)).isNotEmpty(); //when - List<Revision> testNotebookHistory = notebookRepo.revisionHistory(TEST_NOTE_ID); + List<Revision> testNotebookHistory = notebookRepo.revisionHistory(TEST_NOTE_ID, null); //then //no initial commit, empty history @@ -122,17 +122,17 @@ public class GitNotebookRepoTest { public void addCheckpoint() throws IOException { // initial checks notebookRepo = new GitNotebookRepo(conf); - assertThat(notebookRepo.list()).isNotEmpty(); - assertThat(containsNote(notebookRepo.list(), TEST_NOTE_ID)).isTrue(); - assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID)).isEmpty(); + assertThat(notebookRepo.list(null)).isNotEmpty(); + assertThat(containsNote(notebookRepo.list(null), TEST_NOTE_ID)).isTrue(); + assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, null)).isEmpty(); - notebookRepo.checkpoint(TEST_NOTE_ID, "first commit"); - List<Revision> notebookHistoryBefore = notebookRepo.revisionHistory(TEST_NOTE_ID); - assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID)).isNotEmpty(); + notebookRepo.checkpoint(TEST_NOTE_ID, "first commit", null); + List<Revision> notebookHistoryBefore = notebookRepo.revisionHistory(TEST_NOTE_ID, null); + assertThat(notebookRepo.revisionHistory(TEST_NOTE_ID, null)).isNotEmpty(); int initialCount = notebookHistoryBefore.size(); // add changes to note - Note note = notebookRepo.get(TEST_NOTE_ID); + Note note = notebookRepo.get(TEST_NOTE_ID, null); Paragraph p = note.addParagraph(); Map<String, Object> config = p.getConfig(); config.put("enabled", true); @@ -140,11 +140,11 @@ public class GitNotebookRepoTest { p.setText("%md checkpoint test text"); // save and checkpoint note - notebookRepo.save(note); - notebookRepo.checkpoint(TEST_NOTE_ID, "second commit"); + notebookRepo.save(note, null); + notebookRepo.checkpoint(TEST_NOTE_ID, "second commit", null); // see if commit is added - List<Revision> notebookHistoryAfter = notebookRepo.revisionHistory(TEST_NOTE_ID); + List<Revision> notebookHistoryAfter = notebookRepo.revisionHistory(TEST_NOTE_ID, null); assertThat(notebookHistoryAfter.size()).isEqualTo(initialCount + 1); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java index 138977e..fe7e3fc 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/NotebookRepoSyncTest.java @@ -118,16 +118,16 @@ public class NotebookRepoSyncTest implements JobListenerFactory { public void testSyncOnCreate() throws IOException { /* check that both storage systems are empty */ assertTrue(notebookRepoSync.getRepoCount() > 1); - assertEquals(0, notebookRepoSync.list(0).size()); - assertEquals(0, notebookRepoSync.list(1).size()); + assertEquals(0, notebookRepoSync.list(0, null).size()); + assertEquals(0, notebookRepoSync.list(1, null).size()); /* create note */ - Note note = notebookSync.createNote(); + Note note = notebookSync.createNote(null); // check that automatically saved on both storages - assertEquals(1, notebookRepoSync.list(0).size()); - assertEquals(1, notebookRepoSync.list(1).size()); - assertEquals(notebookRepoSync.list(0).get(0).getId(),notebookRepoSync.list(1).get(0).getId()); + assertEquals(1, notebookRepoSync.list(0, null).size()); + assertEquals(1, notebookRepoSync.list(1, null).size()); + assertEquals(notebookRepoSync.list(0, null).get(0).getId(),notebookRepoSync.list(1, null).get(0).getId()); } @@ -135,22 +135,22 @@ public class NotebookRepoSyncTest implements JobListenerFactory { public void testSyncOnDelete() throws IOException { /* create note */ assertTrue(notebookRepoSync.getRepoCount() > 1); - assertEquals(0, notebookRepoSync.list(0).size()); - assertEquals(0, notebookRepoSync.list(1).size()); + assertEquals(0, notebookRepoSync.list(0, null).size()); + assertEquals(0, notebookRepoSync.list(1, null).size()); - Note note = notebookSync.createNote(); + Note note = notebookSync.createNote(null); /* check that created in both storage systems */ - assertEquals(1, notebookRepoSync.list(0).size()); - assertEquals(1, notebookRepoSync.list(1).size()); - assertEquals(notebookRepoSync.list(0).get(0).getId(),notebookRepoSync.list(1).get(0).getId()); + assertEquals(1, notebookRepoSync.list(0, null).size()); + assertEquals(1, notebookRepoSync.list(1, null).size()); + assertEquals(notebookRepoSync.list(0, null).get(0).getId(),notebookRepoSync.list(1, null).get(0).getId()); /* remove Note */ - notebookSync.removeNote(notebookRepoSync.list(0).get(0).getId()); + notebookSync.removeNote(notebookRepoSync.list(0, null).get(0).getId(), null); /* check that deleted in both storages */ - assertEquals(0, notebookRepoSync.list(0).size()); - assertEquals(0, notebookRepoSync.list(1).size()); + assertEquals(0, notebookRepoSync.list(0, null).size()); + assertEquals(0, notebookRepoSync.list(1, null).size()); } @@ -158,7 +158,7 @@ public class NotebookRepoSyncTest implements JobListenerFactory { public void testSyncUpdateMain() throws IOException { /* create note */ - Note note = notebookSync.createNote(); + Note note = notebookSync.createNote(null); Paragraph p1 = note.addParagraph(); Map config = p1.getConfig(); config.put("enabled", true); @@ -170,37 +170,37 @@ public class NotebookRepoSyncTest implements JobListenerFactory { /* new paragraph not yet saved into storages */ assertEquals(0, notebookRepoSync.get(0, - notebookRepoSync.list(0).get(0).getId()).getParagraphs().size()); + notebookRepoSync.list(0, null).get(0).getId(), null).getParagraphs().size()); assertEquals(0, notebookRepoSync.get(1, - notebookRepoSync.list(1).get(0).getId()).getParagraphs().size()); + notebookRepoSync.list(1, null).get(0).getId(), null).getParagraphs().size()); /* save to storage under index 0 (first storage) */ - notebookRepoSync.save(0, note); + notebookRepoSync.save(0, note, null); /* check paragraph saved to first storage */ assertEquals(1, notebookRepoSync.get(0, - notebookRepoSync.list(0).get(0).getId()).getParagraphs().size()); + notebookRepoSync.list(0, null).get(0).getId(), null).getParagraphs().size()); /* check paragraph isn't saved to second storage */ assertEquals(0, notebookRepoSync.get(1, - notebookRepoSync.list(1).get(0).getId()).getParagraphs().size()); + notebookRepoSync.list(1, null).get(0).getId(), null).getParagraphs().size()); /* apply sync */ notebookRepoSync.sync(); /* check whether added to second storage */ assertEquals(1, notebookRepoSync.get(1, - notebookRepoSync.list(1).get(0).getId()).getParagraphs().size()); + notebookRepoSync.list(1, null).get(0).getId(), null).getParagraphs().size()); /* check whether same paragraph id */ assertEquals(p1.getId(), notebookRepoSync.get(0, - notebookRepoSync.list(0).get(0).getId()).getLastParagraph().getId()); + notebookRepoSync.list(0, null).get(0).getId(), null).getLastParagraph().getId()); assertEquals(p1.getId(), notebookRepoSync.get(1, - notebookRepoSync.list(1).get(0).getId()).getLastParagraph().getId()); + notebookRepoSync.list(1, null).get(0).getId(), null).getLastParagraph().getId()); } @Test public void testSyncOnReloadedList() throws IOException { /* check that both storage repos are empty */ assertTrue(notebookRepoSync.getRepoCount() > 1); - assertEquals(0, notebookRepoSync.list(0).size()); - assertEquals(0, notebookRepoSync.list(1).size()); + assertEquals(0, notebookRepoSync.list(0, null).size()); + assertEquals(0, notebookRepoSync.list(1, null).size()); File srcDir = new File("src/test/resources/2A94M5J1Z"); File destDir = new File(secNotebookDir + "/2A94M5J1Z"); @@ -211,13 +211,13 @@ public class NotebookRepoSyncTest implements JobListenerFactory { } catch (IOException e) { LOG.error(e.toString(), e); } - assertEquals(0, notebookRepoSync.list(0).size()); - assertEquals(1, notebookRepoSync.list(1).size()); + assertEquals(0, notebookRepoSync.list(0, null).size()); + assertEquals(1, notebookRepoSync.list(1, null).size()); // After reloading notebooks repos should be synchronized - notebookSync.reloadAllNotes(); - assertEquals(1, notebookRepoSync.list(0).size()); - assertEquals(1, notebookRepoSync.list(1).size()); + notebookSync.reloadAllNotes(null); + assertEquals(1, notebookRepoSync.list(0, null).size()); + assertEquals(1, notebookRepoSync.list(1, null).size()); } @Test @@ -236,15 +236,15 @@ public class NotebookRepoSyncTest implements JobListenerFactory { GitNotebookRepo gitRepo = (GitNotebookRepo) vRepoSync.getRepo(0); // no notes - assertThat(vRepoSync.list().size()).isEqualTo(0); + assertThat(vRepoSync.list(null).size()).isEqualTo(0); // create note - Note note = vNotebookSync.createNote(); - assertThat(vRepoSync.list().size()).isEqualTo(1); + Note note = vNotebookSync.createNote(null); + assertThat(vRepoSync.list(null).size()).isEqualTo(1); - String noteId = vRepoSync.list().get(0).getId(); + String noteId = vRepoSync.list(null).get(0).getId(); // first checkpoint - vRepoSync.checkpoint(noteId, "checkpoint message"); - int vCount = gitRepo.revisionHistory(noteId).size(); + vRepoSync.checkpoint(noteId, "checkpoint message", null); + int vCount = gitRepo.revisionHistory(noteId, null).size(); assertThat(vCount).isEqualTo(1); Paragraph p = note.addParagraph(); @@ -254,9 +254,9 @@ public class NotebookRepoSyncTest implements JobListenerFactory { p.setText("%md checkpoint test"); // save and checkpoint again - vRepoSync.save(note); - vRepoSync.checkpoint(noteId, "checkpoint message 2"); - assertThat(gitRepo.revisionHistory(noteId).size()).isEqualTo(vCount + 1); + vRepoSync.save(note, null); + vRepoSync.checkpoint(noteId, "checkpoint message 2", null); + assertThat(gitRepo.revisionHistory(noteId, null).size()).isEqualTo(vCount + 1); } static void delete(File file){ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java index e5915a9..0550e90 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java @@ -93,7 +93,7 @@ public class VFSNotebookRepoTest implements JobListenerFactory { @Test public void testInvalidJsonFile() throws IOException { // given - int numNotes = notebookRepo.list().size(); + int numNotes = notebookRepo.list(null).size(); // when create invalid json file File testNoteDir = new File(mainNotebookDir, "test"); @@ -101,12 +101,12 @@ public class VFSNotebookRepoTest implements JobListenerFactory { FileUtils.writeStringToFile(new File(testNoteDir, "note.json"), ""); // then - assertEquals(numNotes, notebookRepo.list().size()); + assertEquals(numNotes, notebookRepo.list(null).size()); } @Test public void testSaveNotebook() throws IOException, InterruptedException { - Note note = notebook.createNote(); + Note note = notebook.createNote(null); note.getNoteReplLoader().setInterpreters(factory.getDefaultInterpreterSettingList()); Paragraph p1 = note.addParagraph(); @@ -133,7 +133,7 @@ public class VFSNotebookRepoTest implements JobListenerFactory { } note.setName("SaveTest"); - notebookRepo.save(note); + notebookRepo.save(note, null); assertEquals(note.getName(), "SaveTest"); } @@ -146,7 +146,7 @@ public class VFSNotebookRepoTest implements JobListenerFactory { @Override public void run() { try { - notebookRepo.save(note); + notebookRepo.save(note, null); } catch (IOException e) { LOG.error(e.toString(), e); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java index 1e83354..938521a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java @@ -123,14 +123,14 @@ public class ZeppelinHubRepoTest { @Test public void testGetAllNotes() throws IOException { - List<NoteInfo> notebooks = repo.list(); + List<NoteInfo> notebooks = repo.list(null); assertThat(notebooks).isNotEmpty(); assertThat(notebooks.size()).isEqualTo(3); } @Test public void testGetNote() throws IOException { - Note notebook = repo.get("AAAAA"); + Note notebook = repo.get("AAAAA", null); assertThat(notebook).isNotNull(); assertThat(notebook.id()).isEqualTo("2A94M5J1Z"); } @@ -138,13 +138,13 @@ public class ZeppelinHubRepoTest { @Test public void testRemoveNote() throws IOException { // not suppose to throw - repo.remove("AAAAA"); + repo.remove("AAAAA", null); } @Test public void testRemoveNoteError() throws IOException { // not suppose to throw - repo.remove("BBBBB"); + repo.remove("BBBBB", null); } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b422bdf2/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java index dcb68c8..3641929 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/search/LuceneSearchTest.java @@ -204,7 +204,7 @@ public class LuceneSearchTest { //when Paragraph p1 = note1.getLastParagraph(); p1.setText("no no no"); - note1.persist(); + note1.persist(null); //then assertThat(resultForQuery("Notebook1").size()).isEqualTo(1); @@ -228,7 +228,7 @@ public class LuceneSearchTest { //when note1.setName("NotebookN"); - note1.persist(); + note1.persist(null); //then assertThat(resultForQuery("Notebook1")).isEmpty();