ZeppelinHubRepo implements NotebookRepo { String getZeppelinhubWebsocketUri(ZeppelinConfiguration conf) { String zeppelinHubUri = StringUtils.EMPTY; try { zeppelinHubUri = getZeppelinHubWsUri(new URI(conf.getString("ZEPPELINHUB_API_ADDRESS", ZEPPELIN_CONF_PROP_NAME_SERVER, DEFAULT_SERVER))); } catch (URISyntaxException e) { LOG.error("Cannot get ZeppelinHub URI", e); } return zeppelinHubUri; } ZeppelinHubRepo(ZeppelinConfiguration conf); @Override List<NoteInfo> list(AuthenticationInfo subject); @Override Note get(String noteId, AuthenticationInfo subject); @Override void save(Note note, AuthenticationInfo subject); @Override void remove(String noteId, AuthenticationInfo subject); @Override void close(); @Override Revision checkpoint(String noteId, String checkpointMsg, AuthenticationInfo subject); @Override Note get(String noteId, Revision rev, AuthenticationInfo subject); @Override List<Revision> revisionHistory(String noteId, AuthenticationInfo subject); static final String TOKEN_HEADER; }
@Test public void testGetZeppelinHubWsEndpoint() { System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, testAddr); ZeppelinConfiguration config = new ZeppelinConfiguration(); ZeppelinHubRepo repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("ws: System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "https: config = new ZeppelinConfiguration(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss: System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "yolow"); config = new ZeppelinConfiguration(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss: System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "http: config = new ZeppelinConfiguration(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("ws: System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "https: config = new ZeppelinConfiguration(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss: System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "http: config = new ZeppelinConfiguration(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("ws: System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "https: config = new ZeppelinConfiguration(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss: }