use of org.neo4j.shell.cli.CliArgs 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;
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainIntegrationTest method ensureDefaultDatabaseStarted.
private void ensureDefaultDatabaseStarted() throws Exception {
CliArgs cliArgs = new CliArgs();
cliArgs.setUsername("neo4j", "");
cliArgs.setPassword("neo", "");
cliArgs.setDatabase("system");
ShellAndConnection sac = getShell(cliArgs);
main.connectMaybeInteractively(sac.shell, sac.connectionConfig, true, false, true);
sac.shell.execute("START DATABASE " + DatabaseManager.DEFAULT_DEFAULT_DB_NAME);
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainIntegrationTest method setup.
@Before
public void setup() {
// given
inputBuffer = ByteBuffer.allocate(256);
inputBuffer.put(inputString.getBytes());
inputStream = new ByteArrayInputStream(inputBuffer.array());
baos = new ByteArrayOutputStream();
printStream = new PrintStream(baos);
main = new Main(inputStream, printStream);
cliArgs = new CliArgs();
cliArgs.setUsername("", "");
cliArgs.setPassword("", "");
ShellAndConnection sac = getShell(cliArgs);
shell = sac.shell;
connectionConfig = sac.connectionConfig;
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainIntegrationTest method wrongPortWithBolt.
@Test
public void wrongPortWithBolt() {
// given
CliArgs cliArgs = new CliArgs();
cliArgs.setScheme("bolt", "");
cliArgs.setPort(1234);
ShellAndConnection sac = getShell(cliArgs);
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
var exception = assertThrows(ServiceUnavailableException.class, () -> main.connectMaybeInteractively(shell, connectionConfig, true, true, true));
var expectedMesssage = "Unable to connect to localhost:1234, ensure the database is running and that there is a working network connection to it";
assertThat(exception.getMessage(), containsString(expectedMesssage));
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainIntegrationTest method wrongPortWithNeo4j.
@Test
public void wrongPortWithNeo4j() {
// given
CliArgs cliArgs = new CliArgs();
cliArgs.setScheme("neo4j", "");
cliArgs.setPort(1234);
ShellAndConnection sac = getShell(cliArgs);
CypherShell shell = sac.shell;
ConnectionConfig connectionConfig = sac.connectionConfig;
// The error message here may be subject to change and is not stable across versions so let us not assert on it
assertThrows(ServiceUnavailableException.class, () -> main.connectMaybeInteractively(shell, connectionConfig, true, true, true));
}
Aggregations