Search in sources :

Example 11 with PrettyConfig

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

the class CypherShellProtocolIntegrationTest method shouldConnectWithNeo4jProtocol.

@Test
public void shouldConnectWithNeo4jProtocol() throws Exception {
    CypherShell shell = new CypherShell(new StringLinePrinter(), new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
    // This should work even on older databases without the neo4j protocol, by falling back to bolt
    shell.connect(new ConnectionConfig("neo4j", "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 12 with PrettyConfig

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

the class CypherShellVerboseIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    linePrinter.clear();
    shell = new CypherShell(linePrinter, new PrettyConfig(Format.VERBOSE, true, 1000), false, new ShellParameterMap());
    connect("neo");
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) Before(org.junit.Before)

Example 13 with PrettyConfig

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

the class CypherShellPlainIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    linePrinter.clear();
    shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
    connect("neo");
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) Before(org.junit.Before)

Example 14 with PrettyConfig

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

the class CypherShellPlainIntegrationTest method shouldUseParamFromCLIArgs.

@Test
public void shouldUseParamFromCLIArgs() throws EvaluationException, CommandException {
    // given a CLI arg
    ShellParameterMap parameterMap = new ShellParameterMap();
    parameterMap.setParameter("foo", "'bar'");
    shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false, parameterMap);
    connect("neo");
    // when
    shell.execute("CYPHER RETURN $foo");
    // then
    String actual = linePrinter.output();
    assertThat(actual, containsString("$foo"));
    assertThat(actual, containsString("bar"));
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) 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