use of org.neo4j.shell.CypherShell 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();
}
}
use of org.neo4j.shell.CypherShell 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());
}
use of org.neo4j.shell.CypherShell 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());
}
use of org.neo4j.shell.CypherShell 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)");
}
use of org.neo4j.shell.CypherShell 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);
}
Aggregations