Search in sources :

Example 1 with SameJvmClient

use of org.neo4j.shell.impl.SameJvmClient in project neo4j by neo4j.

the class AppsIT method canDisableWelcomeMessage.

@Test
public void canDisableWelcomeMessage() throws Exception {
    Map<String, Serializable> values = genericMap("quiet", "true");
    final CollectingOutput out = new CollectingOutput();
    ShellClient client = new SameJvmClient(values, shellServer, out);
    client.shutdown();
    final String outString = out.asString();
    assertEquals("Shows welcome message: " + outString, false, outString.contains("Welcome to the Neo4j Shell! Enter 'help' for a list of commands"));
}
Also used : SameJvmClient(org.neo4j.shell.impl.SameJvmClient) Serializable(java.io.Serializable) CollectingOutput(org.neo4j.shell.impl.CollectingOutput) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 2 with SameJvmClient

use of org.neo4j.shell.impl.SameJvmClient in project neo4j by neo4j.

the class AppsIT method doesShowWelcomeMessage.

@Test
public void doesShowWelcomeMessage() throws Exception {
    Map<String, Serializable> values = genericMap();
    final CollectingOutput out = new CollectingOutput();
    ShellClient client = new SameJvmClient(values, shellServer, out);
    client.shutdown();
    final String outString = out.asString();
    assertEquals("Shows welcome message: " + outString, true, outString.contains("Welcome to the Neo4j Shell! Enter 'help' for a list of commands"));
}
Also used : SameJvmClient(org.neo4j.shell.impl.SameJvmClient) Serializable(java.io.Serializable) CollectingOutput(org.neo4j.shell.impl.CollectingOutput) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 3 with SameJvmClient

use of org.neo4j.shell.impl.SameJvmClient 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 4 with SameJvmClient

use of org.neo4j.shell.impl.SameJvmClient 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 5 with SameJvmClient

use of org.neo4j.shell.impl.SameJvmClient in project neo4j by neo4j.

the class FakeShellServer method doBefore.

@Before
public void doBefore() throws Exception {
    db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabase();
    shellServer = new FakeShellServer(db);
    shellClient = new SameJvmClient(new HashMap<String, Serializable>(), shellServer, new CollectingOutput());
}
Also used : SameJvmClient(org.neo4j.shell.impl.SameJvmClient) HashMap(java.util.HashMap) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) CollectingOutput(org.neo4j.shell.impl.CollectingOutput) Before(org.junit.Before)

Aggregations

SameJvmClient (org.neo4j.shell.impl.SameJvmClient)7 CollectingOutput (org.neo4j.shell.impl.CollectingOutput)6 Test (org.junit.Test)4 GraphDatabaseShellServer (org.neo4j.shell.kernel.GraphDatabaseShellServer)3 Serializable (java.io.Serializable)2 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)2 ShellException (org.neo4j.shell.ShellException)2 File (java.io.File)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 RmiPublicationIT.createDefaultConfigFile (org.neo4j.shell.RmiPublicationIT.createDefaultConfigFile)1 SystemOutput (org.neo4j.shell.impl.SystemOutput)1 TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)1