Search in sources :

Example 1 with NotebookService

use of org.apache.zeppelin.service.NotebookService in project zeppelin by apache.

the class ClusterEventTest method init.

@BeforeClass
public static void init() throws Exception {
    ZeppelinConfiguration zconf = genZeppelinConf();
    ZeppelinServerMock.startUp("ClusterEventTest", zconf);
    notebook = TestUtils.getInstance(Notebook.class);
    authorizationService = TestUtils.getInstance(AuthorizationService.class);
    schedulerService = new QuartzSchedulerService(zconf, notebook);
    schedulerService.waitForFinishInit();
    notebookServer = spy(NotebookServer.getInstance());
    notebookService = new NotebookService(notebook, authorizationService, zconf, schedulerService);
    ConfigurationService configurationService = new ConfigurationService(notebook.getConf());
    when(notebookServer.getNotebookService()).thenReturn(notebookService);
    when(notebookServer.getConfigurationService()).thenReturn(configurationService);
    startOtherZeppelinClusterNode(zconf);
    // wait zeppelin cluster startup
    Thread.sleep(10000);
    // mock cluster manager client
    clusterClient = ClusterManagerClient.getInstance(zconf);
    clusterClient.start(metaKey);
    // Waiting for cluster startup
    int wait = 0;
    while (wait++ < 100) {
        if (clusterIsStartup() && clusterClient.raftInitialized()) {
            LOGGER.info("wait {}(ms) found cluster leader", wait * 500);
            break;
        }
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
    Thread.sleep(3000);
    assertEquals(true, clusterIsStartup());
    getClusterServerMeta();
}
Also used : Notebook(org.apache.zeppelin.notebook.Notebook) AuthorizationService(org.apache.zeppelin.notebook.AuthorizationService) QuartzSchedulerService(org.apache.zeppelin.notebook.scheduler.QuartzSchedulerService) ZeppelinConfiguration(org.apache.zeppelin.conf.ZeppelinConfiguration) ConfigurationService(org.apache.zeppelin.service.ConfigurationService) NotebookService(org.apache.zeppelin.service.NotebookService) BeforeClass(org.junit.BeforeClass)

Aggregations

ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)1 AuthorizationService (org.apache.zeppelin.notebook.AuthorizationService)1 Notebook (org.apache.zeppelin.notebook.Notebook)1 QuartzSchedulerService (org.apache.zeppelin.notebook.scheduler.QuartzSchedulerService)1 ConfigurationService (org.apache.zeppelin.service.ConfigurationService)1 NotebookService (org.apache.zeppelin.service.NotebookService)1 BeforeClass (org.junit.BeforeClass)1