@Test public void testEnableRemoteShell() throws Exception { int port = 8085; GraphDatabaseService graphDb = new ImpermanentGraphDatabase(stringMap(ENABLE_REMOTE_SHELL, "port=" + port)); ShellLobby.newClient(port); graphDb.shutdown(); }
@Test public void testEnableServerOnDefaultPort() throws Exception { GraphDatabaseService graphDb = new ImpermanentGraphDatabase(stringMap(ENABLE_REMOTE_SHELL, "true")); try { ShellLobby.newClient(); } finally { graphDb.shutdown(); } }
@Test public void canConnectAsAgent() throws Exception { Integer port = Integer.valueOf(1234); String name = "test-shell"; GraphDatabaseService graphDb = new ImpermanentGraphDatabase(); try { new ShellServerExtension().loadAgent(new ShellBootstrap(port.toString(), name).serialize()); } finally { graphDb.shutdown(); } ShellLobby.newClient(port.intValue(), name); }
private void startRemote(Args args, CtrlCHandler signalHandler) { try { String host = args.get(ARG_HOST, "localhost"); int port = args.getNumber(ARG_PORT, SimpleAppServer.DEFAULT_PORT).intValue(); String name = args.get(ARG_NAME, SimpleAppServer.DEFAULT_NAME); ShellClient client = ShellLobby.newClient( RmiLocation.location(host, port, name), getSessionVariablesFromArgs(args), signalHandler); if (!isCommandLine(args)) { System.out.println( "NOTE: Remote Neo4j graph database service '" + name + "' at port " + port); } grabPromptOrJustExecuteCommand(client, args); } catch (Exception e) { handleException(e, args); } }
private void tryStartLocalServerAndClient( String dbPath, boolean readOnly, Args args, CtrlCHandler signalHandler) throws Exception { String configFile = args.get(ARG_CONFIG, null); final GraphDatabaseShellServer server = new GraphDatabaseShellServer(dbPath, readOnly, configFile); Runtime.getRuntime() .addShutdownHook( new Thread() { @Override public void run() { shutdownIfNecessary(server); } }); if (!isCommandLine(args)) { System.out.println("NOTE: Local Neo4j graph database service at '" + dbPath + "'"); } ShellClient client = ShellLobby.newClient(server, getSessionVariablesFromArgs(args), signalHandler); grabPromptOrJustExecuteCommand(client, args); shutdownIfNecessary(server); }