Search in sources :

Example 1 with ShellParameterMap

use of org.neo4j.shell.ShellParameterMap 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 2 with ShellParameterMap

use of org.neo4j.shell.ShellParameterMap 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 3 with ShellParameterMap

use of org.neo4j.shell.ShellParameterMap 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)

Example 4 with ShellParameterMap

use of org.neo4j.shell.ShellParameterMap in project neo4j by neo4j.

the class CypherShellTransactionIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    linePrinter.clear();
    shell = new CypherShell(linePrinter, new PrettyConfig(Format.VERBOSE, true, 1000), false, new ShellParameterMap());
    rollbackCommand = new Rollback(shell);
    commitCommand = new Commit(shell);
    beginCommand = new Begin(shell);
    connect("neo");
    shell.execute("MATCH (n) DETACH DELETE (n)");
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) Before(org.junit.Before)

Example 5 with ShellParameterMap

use of org.neo4j.shell.ShellParameterMap in project neo4j by neo4j.

the class CommandHelperTest method shouldIgnoreCaseForCommands.

@Test
public void shouldIgnoreCaseForCommands() {
    // Given
    AnsiLogger logger = new AnsiLogger(false);
    CommandHelper commandHelper = new CommandHelper(logger, Historian.empty, new CypherShell(logger, PrettyConfig.DEFAULT, false, new ShellParameterMap()));
    // When
    Command begin = commandHelper.getCommand(":BEGIN");
    // Then
    assertTrue(begin instanceof Begin);
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) Command(org.neo4j.shell.commands.Command) Begin(org.neo4j.shell.commands.Begin) CypherShell(org.neo4j.shell.CypherShell) AnsiLogger(org.neo4j.shell.log.AnsiLogger) CommandHelper(org.neo4j.shell.commands.CommandHelper) Test(org.junit.Test)

Aggregations

CypherShell (org.neo4j.shell.CypherShell)12 ShellParameterMap (org.neo4j.shell.ShellParameterMap)12 PrettyConfig (org.neo4j.shell.prettyprint.PrettyConfig)11 Test (org.junit.Test)7 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 Begin (org.neo4j.shell.commands.Begin)1 Command (org.neo4j.shell.commands.Command)1 CommandHelper (org.neo4j.shell.commands.CommandHelper)1 AnsiLogger (org.neo4j.shell.log.AnsiLogger)1