Search in sources :

Example 11 with ConnectionConfig

use of org.neo4j.shell.ConnectionConfig in project neo4j by neo4j.

the class CypherShellMultiDatabaseIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    linePrinter.clear();
    shell = new CypherShell(linePrinter, new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
    useCommand = new Use(shell);
    beginCommand = new Begin(shell);
    rollbackCommand = new Rollback(shell);
    shell.connect(new ConnectionConfig("bolt", "localhost", 7687, "neo4j", "neo", Encryption.DEFAULT, ABSENT_DB_NAME));
    // Multiple databases are only available from 4.0
    assumeTrue(majorVersion(shell.getServerVersion()) >= 4);
}
Also used : ShellParameterMap(org.neo4j.shell.ShellParameterMap) CypherShell(org.neo4j.shell.CypherShell) PrettyConfig(org.neo4j.shell.prettyprint.PrettyConfig) ConnectionConfig(org.neo4j.shell.ConnectionConfig) Before(org.junit.Before)

Example 12 with ConnectionConfig

use of org.neo4j.shell.ConnectionConfig in project neo4j by neo4j.

the class CypherShellProtocolIntegrationTest method shouldConnectWithBoltProtocol.

@Test
public void shouldConnectWithBoltProtocol() throws Exception {
    CypherShell shell = new CypherShell(new StringLinePrinter(), new PrettyConfig(Format.PLAIN, true, 1000), false, new ShellParameterMap());
    shell.connect(new ConnectionConfig("bolt", "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 13 with ConnectionConfig

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

Aggregations

ConnectionConfig (org.neo4j.shell.ConnectionConfig)13 Test (org.junit.Test)8 CypherShell (org.neo4j.shell.CypherShell)6 ShellParameterMap (org.neo4j.shell.ShellParameterMap)6 PrettyConfig (org.neo4j.shell.prettyprint.PrettyConfig)6 StringLinePrinter (org.neo4j.shell.StringLinePrinter)4 ClientException (org.neo4j.driver.exceptions.ClientException)3 FakeDriver (org.neo4j.shell.test.bolt.FakeDriver)3 Before (org.junit.Before)2 AuthToken (org.neo4j.driver.AuthToken)2 Bookmark (org.neo4j.driver.Bookmark)2 Driver (org.neo4j.driver.Driver)2 Result (org.neo4j.driver.Result)2 Session (org.neo4j.driver.Session)2 SessionConfig (org.neo4j.driver.SessionConfig)2 InternalBookmark (org.neo4j.driver.internal.InternalBookmark)2 FakeSession (org.neo4j.shell.test.bolt.FakeSession)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Config (org.neo4j.driver.Config)1