Search in sources :

Example 11 with ShellParameterMap

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

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

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