use of org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock in project zeppelin by apache.
the class NotebookRepoSyncInitializationTest method validInitTwoStorageTest.
@Test
public void validInitTwoStorageTest() throws IOException {
// initialize folders for each storage
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(), validTwoStorageConf);
ZeppelinConfiguration conf = ZeppelinConfiguration.create();
// create repo
NotebookRepoSync notebookRepoSync = new NotebookRepoSync(conf);
// check that both initialized
assertEquals(notebookRepoSync.getRepoCount(), 2);
assertTrue(notebookRepoSync.getRepo(0) instanceof VFSNotebookRepo);
assertTrue(notebookRepoSync.getRepo(1) instanceof VFSNotebookRepoMock);
}
use of org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock 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);
}
Aggregations