Search in sources :

Example 1 with GraphDatabaseShellServer

use of org.neo4j.shell.kernel.GraphDatabaseShellServer in project neo4j by neo4j.

the class DontShutdownClient method main.

public static void main(String[] args) throws Exception {
    File path = new File(args[0]);
    File configFile = createDefaultConfigFile(path);
    GraphDatabaseShellServer server = new GraphDatabaseShellServer(path, false, configFile.getAbsolutePath());
    new SameJvmClient(new HashMap<>(), server, /* Temporary, switch back to SilentOutput once flaky test is resolved. */
    new SystemOutput(), InterruptSignalHandler.getHandler());
    server.shutdown();
// Intentionally don't shutdown the client
}
Also used : SameJvmClient(org.neo4j.shell.impl.SameJvmClient) GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) SystemOutput(org.neo4j.shell.impl.SystemOutput) RmiPublicationIT.createDefaultConfigFile(org.neo4j.shell.RmiPublicationIT.createDefaultConfigFile) File(java.io.File)

Example 2 with GraphDatabaseShellServer

use of org.neo4j.shell.kernel.GraphDatabaseShellServer in project neo4j by neo4j.

the class DontShutdownLocalServer method main.

public static void main(String[] args) throws Exception {
    File path = new File(args[0]);
    File configFile = createDefaultConfigFile(path);
    new GraphDatabaseShellServer(path, false, configFile.getAbsolutePath());
// Intentionally don't shutdown the server
}
Also used : GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) RmiPublicationIT.createDefaultConfigFile(org.neo4j.shell.RmiPublicationIT.createDefaultConfigFile) File(java.io.File)

Example 3 with GraphDatabaseShellServer

use of org.neo4j.shell.kernel.GraphDatabaseShellServer in project neo4j by neo4j.

the class TransactionGuardIntegrationTest method terminateLongRunningShellPeriodicCommitQuery.

@Test
public void terminateLongRunningShellPeriodicCommitQuery() throws Exception {
    GraphDatabaseAPI database = startDatabaseWithTimeoutCustomGuard();
    GraphDatabaseShellServer shellServer = getGraphDatabaseShellServer(database);
    try {
        SameJvmClient client = getShellClient(shellServer);
        CollectingOutput commandOutput = new CollectingOutput();
        URL url = prepareTestImportFile(8);
        execute(shellServer, commandOutput, client.getId(), "USING PERIODIC COMMIT 5 LOAD CSV FROM '" + url + "' AS line CREATE ();");
        fail("Transaction should be already terminated.");
    } catch (ShellException e) {
        assertThat(e.getMessage(), containsString("Transaction timeout."));
    }
    assertDatabaseDoesNotHaveNodes(database);
}
Also used : SameJvmClient(org.neo4j.shell.impl.SameJvmClient) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) CollectingOutput(org.neo4j.shell.impl.CollectingOutput) ShellException(org.neo4j.shell.ShellException) URL(java.net.URL) Test(org.junit.Test)

Example 4 with GraphDatabaseShellServer

use of org.neo4j.shell.kernel.GraphDatabaseShellServer in project neo4j by neo4j.

the class StartClientIT method shouldNotStartBolt.

@Test
public void shouldNotStartBolt() throws IOException {
    // Given
    AssertableLogProvider log = new AssertableLogProvider();
    // When
    new StartClient(System.out, System.err) {

        @Override
        protected GraphDatabaseShellServer getGraphDatabaseShellServer(File path, boolean readOnly, String configFile) throws RemoteException {
            return new GraphDatabaseShellServer(new TestGraphDatabaseFactory().setUserLogProvider(log), path, readOnly, configFile);
        }
    }.start(new String[] { "-c", "RETURN 1;", "-path", db.getStoreDir(), "-config", getClass().getResource("/config-with-bolt-connector.conf").getFile() }, mock(CtrlCHandler.class));
    // Then
    log.assertNone(inLog(startsWith(WorkerFactory.class.getPackage().getName())).any());
}
Also used : GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) RemoteException(java.rmi.RemoteException) File(java.io.File) WorkerFactory(org.neo4j.bolt.v1.runtime.WorkerFactory) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Example 5 with GraphDatabaseShellServer

use of org.neo4j.shell.kernel.GraphDatabaseShellServer in project neo4j by neo4j.

the class CdTest method setup.

@Before
public void setup() throws Exception {
    db = dbRule.getGraphDatabaseAPI();
    server = new GraphDatabaseShellServer(db);
    session.set(Variables.TITLE_KEYS_KEY, "name");
}
Also used : GraphDatabaseShellServer(org.neo4j.shell.kernel.GraphDatabaseShellServer) Before(org.junit.Before)

Aggregations

GraphDatabaseShellServer (org.neo4j.shell.kernel.GraphDatabaseShellServer)20 Test (org.junit.Test)13 TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)7 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)6 File (java.io.File)5 ShellException (org.neo4j.shell.ShellException)5 Serializable (java.io.Serializable)3 RemoteException (java.rmi.RemoteException)3 Before (org.junit.Before)3 Transaction (org.neo4j.graphdb.Transaction)3 ShellServer (org.neo4j.shell.ShellServer)3 SystemOutput (org.neo4j.shell.impl.SystemOutput)3 PrintWriter (java.io.PrintWriter)2 HashSet (java.util.HashSet)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 GraphDatabaseFactory (org.neo4j.graphdb.factory.GraphDatabaseFactory)2 Output (org.neo4j.shell.Output)2 Response (org.neo4j.shell.Response)2 RmiPublicationIT.createDefaultConfigFile (org.neo4j.shell.RmiPublicationIT.createDefaultConfigFile)2 SameJvmClient (org.neo4j.shell.impl.SameJvmClient)2