use of org.apache.zeppelin.notebook.AuthorizationService in project zeppelin by apache.
the class ZeppelinRestApiTest method testListNotes.
@Test
public void testListNotes() throws IOException {
LOG.info("testListNotes");
CloseableHttpResponse get = httpGet("/notebook/");
assertThat("List notes method", get, isAllowed());
Map<String, Object> resp = gson.fromJson(EntityUtils.toString(get.getEntity(), StandardCharsets.UTF_8), new TypeToken<Map<String, Object>>() {
}.getType());
List<Map<String, String>> body = (List<Map<String, String>>) resp.get("body");
// TODO(khalid): anonymous or specific user notes?
HashSet<String> anonymous = new HashSet<>(Arrays.asList("anonymous"));
AuthorizationService authorizationService = TestUtils.getInstance(AuthorizationService.class);
assertEquals("List notes are equal", TestUtils.getInstance(Notebook.class).getNotesInfo(noteId -> authorizationService.isReader(noteId, anonymous)).size(), body.size());
get.close();
}
use of org.apache.zeppelin.notebook.AuthorizationService in project zeppelin by apache.
the class HeliumApplicationFactoryTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
// set AppEventListener properly
for (InterpreterSetting interpreterSetting : interpreterSettingManager.get()) {
interpreterSetting.setAppEventListener(heliumAppFactory);
}
AuthorizationService authorizationService = mock(AuthorizationService.class);
notebookRepo = mock(NotebookRepo.class);
notebook = new Notebook(conf, authorizationService, notebookRepo, new NoteManager(notebookRepo, ZeppelinConfiguration.create()), interpreterFactory, interpreterSettingManager, new Credentials());
heliumAppFactory = new HeliumApplicationFactory(notebook, null);
notebook.addNotebookEventListener(heliumAppFactory);
anonymous = new AuthenticationInfo("anonymous");
}
Aggregations