use of org.neo4j.shell.test.bolt.FakeDriver in project neo4j by neo4j.
the class BoltStateHandlerTest method serverVersionIsNotEmptyAfterConnect.
@Test
public void serverVersionIsNotEmptyAfterConnect() throws CommandException {
Driver fakeDriver = new FakeDriver();
BoltStateHandler handler = new BoltStateHandler((s, authToken, config) -> fakeDriver, false);
handler.connect(config);
assertEquals("4.3.0", handler.getServerVersion());
}
use of org.neo4j.shell.test.bolt.FakeDriver in project neo4j by neo4j.
the class BoltStateHandlerTest method fallbackTest.
private void fallbackTest(String initialScheme, String fallbackScheme, Runnable failer) throws CommandException {
final String[] uriScheme = new String[1];
RecordingDriverProvider provider = new RecordingDriverProvider() {
@Override
public Driver apply(String uri, AuthToken authToken, Config config) {
uriScheme[0] = uri.substring(0, uri.indexOf(':'));
if (uriScheme[0].equals(initialScheme)) {
failer.run();
}
super.apply(uri, authToken, config);
return new FakeDriver();
}
};
BoltStateHandler handler = new BoltStateHandler(provider, false);
ConnectionConfig config = new ConnectionConfig(initialScheme, "", -1, "", "", Encryption.DEFAULT, ABSENT_DB_NAME);
handler.connect(config);
assertEquals(fallbackScheme, uriScheme[0]);
}
Aggregations