use of org.apache.zeppelin.conf.ZeppelinConfiguration in project zeppelin by apache.
the class NotebookRepoSyncInitializationTest method initEmptyStorageTest.
@Test
public void initEmptyStorageTest() throws IOException {
// set confs
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), emptyStorageConf);
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
// create repo
NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf);
// check initialization of one default storage
assertEquals(notebookRepoSync.getRepoCount(), 1);
assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo);
}
use of org.apache.zeppelin.conf.ZeppelinConfiguration in project zeppelin by apache.
the class NotebookRepoSyncInitializationTest method initUnsupportedNumberStoragesTest.
@Test
public void initUnsupportedNumberStoragesTest() throws IOException {
// initialize folders for each storage, currently for 2 only
String zpath = System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis();
File mainZepDir = new File(zpath);
mainZepDir.mkdirs();
new File(mainZepDir, "conf").mkdirs();
String mainNotePath = zpath + "/notebook";
String secNotePath = mainNotePath + "_secondary";
File mainNotebookDir = new File(mainNotePath);
File secNotebookDir = new File(secNotePath);
mainNotebookDir.mkdirs();
secNotebookDir.mkdirs();
// set confs
System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), mainZepDir.getAbsolutePath());
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), mainNotebookDir.getAbsolutePath());
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), unsupportedStorageConf);
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
// create repo
NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf);
// check that first two storages initialized instead of three
assertEquals(notebookRepoSync.getRepoCount(), 2);
assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo);
assertTrue(notebookRepoSync.getRepo(1) instanceof VFSNotebookRepoMock);
}
use of org.apache.zeppelin.conf.ZeppelinConfiguration in project zeppelin by apache.
the class NotebookRepoSyncInitializationTest method validInitOneStorageTest.
@Test
public void validInitOneStorageTest() throws IOException {
// no need to initialize folder due to one storage
// set confs
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), validOneStorageConf);
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
// create repo
NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf);
// check proper initialization of one storage
assertEquals(notebookRepoSync.getRepoCount(), 1);
assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo);
}
use of org.apache.zeppelin.conf.ZeppelinConfiguration in project zeppelin by apache.
the class NotebookRepoSyncInitializationTest method invalidInitTwoStorageTest.
@Test
public void invalidInitTwoStorageTest() throws IOException {
// set confs
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), invalidTwoStorageConf);
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
// create repo
NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf);
// check that second didn't initialize
LOG.info(" " + notebookRepoSync.getRepoCount());
assertEquals(notebookRepoSync.getRepoCount(), 1);
assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo);
}
use of org.apache.zeppelin.conf.ZeppelinConfiguration in project zeppelin by apache.
the class ConfigurationsRestApi method getAll.
@GET
@Path("all")
@ZeppelinApi
public Response getAll() {
ZeppelinConfiguration conf = notebook.getConf();
Map<String, String> configurations = conf.dumpConfigurations(conf, new ZeppelinConfiguration.ConfigurationKeyPredicate() {
@Override
public boolean apply(String key) {
return !key.contains("password") && !key.equals(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING.getVarName());
}
});
return new JsonResponse(Status.OK, "", configurations).build();
}
Aggregations