Search in sources :

Example 1 with VFSNotebookRepoMock

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);
}
Also used : VFSNotebookRepoMock(org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock) ZeppelinConfiguration(org.apache.zeppelin.conf.ZeppelinConfiguration) File(java.io.File) Test(org.junit.Test)

Example 2 with 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);
}
Also used : VFSNotebookRepoMock(org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock) ZeppelinConfiguration(org.apache.zeppelin.conf.ZeppelinConfiguration) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)2 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)2 VFSNotebookRepoMock (org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock)2 Test (org.junit.Test)2