mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-2114] adding reload endpoint
* ability to reload note list from repo by API
This commit is contained in:
parent
eb88b0b9e7
commit
cf66c2b7f1
2 changed files with 22 additions and 2 deletions
|
|
@ -75,6 +75,18 @@ public class NotebookRepoRestApi {
|
|||
return new JsonResponse<>(Status.OK, "", settings).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload notebook repository
|
||||
*/
|
||||
@GET
|
||||
@Path("reload")
|
||||
@ZeppelinApi
|
||||
public Response refreshRepo(){
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
notebookWsServer.broadcastReloadedNoteList(subject, null);
|
||||
return new JsonResponse<>(Status.OK, "", null).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a specific note repo.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.apache.zeppelin.rest;
|
|||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.anyOf;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -80,6 +81,13 @@ public class NotebookRepoRestApiTest extends AbstractTestRestApi {
|
|||
List<Map<String, Object>> listOfRepositories = getListOfReposotiry();
|
||||
assertThat(listOfRepositories.size(), is(not(0)));
|
||||
}
|
||||
|
||||
@Test public void reloadRepositories() throws IOException {
|
||||
GetMethod get = httpGet("/notebook-repositories/reload");
|
||||
int status = get.getStatusCode();
|
||||
get.releaseConnection();
|
||||
assertThat(status, is(200));
|
||||
}
|
||||
|
||||
@Test public void setNewDirectoryForLocalDirectory() throws IOException {
|
||||
List<Map<String, Object>> listOfRepositories = getListOfReposotiry();
|
||||
|
|
@ -95,7 +103,7 @@ public class NotebookRepoRestApiTest extends AbstractTestRestApi {
|
|||
}
|
||||
|
||||
if (StringUtils.isBlank(localVfs)) {
|
||||
// no loval VFS set...
|
||||
// no local VFS set...
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +119,7 @@ public class NotebookRepoRestApiTest extends AbstractTestRestApi {
|
|||
break;
|
||||
}
|
||||
}
|
||||
assertThat(updatedPath, is("/tmp/newDir"));
|
||||
assertThat(updatedPath, anyOf(is("/tmp/newDir"),is("/tmp/newDir/")));
|
||||
|
||||
// go back to normal
|
||||
payload = "{ \"name\": \"" + className + "\", \"settings\" : { \"Notebook Path\" : \"" + localVfs + "\" } }";
|
||||
|
|
|
|||
Loading…
Reference in a new issue