use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainIntegrationTest method shouldNotBePromptedIfRunningWithExplicitNonInteractiveCypherThatDoesntUpdatePassword.
@Test
public void shouldNotBePromptedIfRunningWithExplicitNonInteractiveCypherThatDoesntUpdatePassword() throws Exception {
// given a user that require a password change
int majorVersion = getVersionAndCreateUserWithPasswordChangeRequired();
// when
assumeTrue(majorVersion >= 4);
// when interactively asked for a password use this
inputBuffer.put(String.format("pass2%n").getBytes());
baos.reset();
CliArgs args = args(DEFAULT_DEFAULT_DB_NAME, "foo", "pass", "MATCH (n) RETURN n");
args.setNonInteractive(true);
assertEquals(EXIT_FAILURE, main.runShell(args, shell, mock(Logger.class)));
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class ShellRunnerTest method inputIsNonInteractiveIfForced.
@Test
public void inputIsNonInteractiveIfForced() throws Exception {
CliArgs args = new CliArgs();
args.setNonInteractive(true);
ShellRunner runner = getShellRunner(args, mock(CypherShell.class), mock(Logger.class), connectionConfig);
assertTrue("Should be non-interactive shell runner when forced", runner instanceof NonInteractiveShellRunner);
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class Main method main.
public static void main(String[] args) {
CliArgs cliArgs = CliArgHelper.parse(args);
// CliArgs has already printed errors.
if (cliArgs == null) {
System.exit(1);
}
Main main = new Main();
main.startShell(cliArgs);
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainTest method printsVersionAndExits.
@Test
public void printsVersionAndExits() {
CliArgs args = new CliArgs();
args.setVersion(true);
PrintStream printStream = mock(PrintStream.class);
Main main = new Main(System.in, printStream);
main.startShell(args);
ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
verify(printStream).println(argument.capture());
assertTrue(argument.getValue().matches("Cypher-Shell \\d+\\.\\d+\\.\\d+.*"));
}
use of org.neo4j.shell.cli.CliArgs in project neo4j by neo4j.
the class MainTest method printsDriverVersionAndExits.
@Test
public void printsDriverVersionAndExits() {
CliArgs args = new CliArgs();
args.setDriverVersion(true);
PrintStream printStream = mock(PrintStream.class);
Main main = new Main(System.in, printStream);
main.startShell(args);
ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
verify(printStream).println(argument.capture());
assertTrue(argument.getValue().matches("Neo4j Driver \\d+\\.\\d+\\.\\d+.*"));
}
Aggregations