Search in sources :

Example 1 with PrettyConfig

use of org.neo4j.shell.prettyprint.PrettyConfig in project neo4j by neo4j.

the class MainIntegrationTest method getShell.

private ShellAndConnection getShell(CliArgs cliArgs, LinePrinter linePrinter) {
    PrettyConfig prettyConfig = new PrettyConfig(cliArgs);
    ConnectionConfig connectionConfig = getConnectionConfig(cliArgs);
    return new ShellAndConnection(new CypherShell(linePrinter, prettyConfig, true, new ShellParameterMap()), connectionConfig);
}
Also used : PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig)

Example 2 with PrettyConfig

use of org.neo4j.shell.prettyprint.PrettyConfig in project neo4j by neo4j.

the class MainIntegrationTest method interactiveShell.

private CypherShell interactiveShell(LinePrinter linePrinter) throws Exception {
    PrettyConfig prettyConfig = new PrettyConfig(new CliArgs());
    CypherShell shell = new CypherShell(linePrinter, prettyConfig, true, new ShellParameterMap());
    main.connectMaybeInteractively(shell, connectionConfig, true, true, true);
    shell.setCommandHelper(new CommandHelper(mock(Logger.class), Historian.empty, shell));
    return shell;
}
Also used : PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) CommandHelper(org.neo4j.shell.commands.CommandHelper) CliArgs(org.neo4j.shell.cli.CliArgs)

Example 3 with PrettyConfig

use of org.neo4j.shell.prettyprint.PrettyConfig in project neo4j by neo4j.

the class CypherShellMultiDatabaseIntegrationTest method switchingToNonExistingDatabaseShouldGiveErrorResponseFromServerInteractive.

@Test
public void switchingToNonExistingDatabaseShouldGiveErrorResponseFromServerInteractive() throws CommandException {
    shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), true, new ShellParameterMap());
    useCommand = new Use(shell);
    shell.connect(new ConnectionConfig("bolt", "localhost", 7687, "neo4j", "neo", Encryption.DEFAULT, ABSENT_DB_NAME));
    useCommand.execute(SYSTEM_DB_NAME);
    try {
        useCommand.execute("this_database_name_does_not_exist_in_test_container");
        fail("No ClientException thrown");
    } catch (ClientException e) {
        // In interactive we do not want to switch if the database does not exist
        assertOnSystemDB();
    }
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) ClientException(org.neo4j.driver.exceptions.ClientException) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) ConnectionConfig(org.neo4j.shell.ConnectionConfig) Test(org.junit.Test)

Example 4 with PrettyConfig

use of org.neo4j.shell.prettyprint.PrettyConfig in project neo4j by neo4j.

the class CypherShellProtocolIntegrationTest method shouldConnectWithBoltSSCProtocol.

@Test
public void shouldConnectWithBoltSSCProtocol() throws Exception {
    CypherShell shell = new CypherShell(new StringLinePrinter(), new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
    // Given 3.X series where X > 1, where SSC are the default. Hard to test in 4.0 sadly.
    onlyIn3_2to3_6(shell);
    shell.connect(new ConnectionConfig("bolt+ssc", "localhost", 7687, "neo4j", "neo", Encryption.DEFAULT, ABSENT_DB_NAME));
    assertTrue(shell.isConnected());
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) StringLinePrinter(org.neo4j.shell.StringLinePrinter) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) ConnectionConfig(org.neo4j.shell.ConnectionConfig) Test(org.junit.Test)

Example 5 with PrettyConfig

use of org.neo4j.shell.prettyprint.PrettyConfig in project neo4j by neo4j.

the class CypherShellProtocolIntegrationTest method shouldConnectWithNeo4jSSCProtocol.

@Test
public void shouldConnectWithNeo4jSSCProtocol() throws Exception {
    CypherShell shell = new CypherShell(new StringLinePrinter(), new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
    // Given 3.X series where X > 1, where SSC are the default. Hard to test in 4.0 sadly.
    onlyIn3_2to3_6(shell);
    // This should work by falling back to bolt+ssc
    shell.connect(new ConnectionConfig("neo4j+ssc", "localhost", 7687, "neo4j", "neo", Encryption.DEFAULT, ABSENT_DB_NAME));
    assertTrue(shell.isConnected());
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) StringLinePrinter(org.neo4j.shell.StringLinePrinter) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) ConnectionConfig(org.neo4j.shell.ConnectionConfig) Test(org.junit.Test)

Aggregations

PrettyConfig (org.neo4j.shell.prettyprint.PrettyConfig)14 CypherShell (org.neo4j.shell.CypherShell)11 ShellParameterMap (org.neo4j.shell.ShellParameterMap)11 Test (org.junit.Test)6 ConnectionConfig (org.neo4j.shell.ConnectionConfig)6 Before (org.junit.Before)5 StringLinePrinter (org.neo4j.shell.StringLinePrinter)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 ClientException (org.neo4j.driver.exceptions.ClientException)1 CliArgs (org.neo4j.shell.cli.CliArgs)1 CommandHelper (org.neo4j.shell.commands.CommandHelper)1 AnsiLogger (org.neo4j.shell.log.AnsiLogger)1 Logger (org.neo4j.shell.log.Logger)1