use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldDeriveBoltListenAddressFromDefaultListenAddressAndSpecifiedPort.
@Test
void shouldDeriveBoltListenAddressFromDefaultListenAddressAndSpecifiedPort() {
// given
Config config = Config.newBuilder().set(GraphDatabaseSettings.default_listen_address, new SocketAddress("0.0.0.0")).set(BoltConnector.enabled, true).set(BoltConnector.listen_address, new SocketAddress(8000)).build();
// then
assertEquals(new SocketAddress("0.0.0.0", 8000), config.get(BoltConnector.listen_address));
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldDeriveBoltListenAddressFromDefaultListenAddress.
@Test
void shouldDeriveBoltListenAddressFromDefaultListenAddress() {
// given
Config config = Config.newBuilder().set(BoltConnector.enabled, true).set(GraphDatabaseSettings.default_listen_address, new SocketAddress("0.0.0.0")).build();
// then
assertEquals(new SocketAddress("0.0.0.0", 7687), config.get(BoltConnector.listen_address));
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method testDefaultAddressMigration.
@Test
void testDefaultAddressMigration() {
String oldDefaultListen = "dbms.connectors.default_listen_address";
String oldDefaultAdvertised = "dbms.connectors.default_advertised_address";
var config = Config.newBuilder().setRaw(Map.of(oldDefaultListen, "foo", oldDefaultAdvertised, "bar")).build();
var logProvider = new AssertableLogProvider();
config.setLogger(logProvider.getLog(Config.class));
assertThrows(IllegalArgumentException.class, () -> config.getSetting(oldDefaultListen));
assertThrows(IllegalArgumentException.class, () -> config.getSetting(oldDefaultAdvertised));
assertEquals(new SocketAddress("foo"), config.get(default_listen_address));
assertEquals(new SocketAddress("bar"), config.get(default_advertised_address));
var messageMatcher = assertThat(logProvider).forClass(Config.class).forLevel(WARN);
messageMatcher.containsMessageWithArguments("Use of deprecated setting %s. It is replaced by %s", oldDefaultListen, default_listen_address.name()).containsMessageWithArguments("Use of deprecated setting %s. It is replaced by %s", oldDefaultAdvertised, default_advertised_address.name());
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class SettingTest method testSocketSolve.
@Test
void testSocketSolve() {
var setting = (SettingImpl<SocketAddress>) setting("setting", SOCKET_ADDRESS);
assertEquals(new SocketAddress("localhost", 7473), setting.solveDependency(setting.parse("localhost:7473"), setting.parse("127.0.0.1:7474")));
assertEquals(new SocketAddress("127.0.0.1", 7473), setting.solveDependency(setting.parse(":7473"), setting.parse("127.0.0.1:7474")));
assertEquals(new SocketAddress("127.0.0.1", 7473), setting.solveDependency(setting.parse(":7473"), setting.parse("127.0.0.1")));
assertEquals(new SocketAddress("localhost", 7474), setting.solveDependency(setting.parse("localhost"), setting.parse(":7474")));
assertEquals(new SocketAddress("localhost", 7474), setting.solveDependency(setting.parse("localhost"), setting.parse("127.0.0.1:7474")));
assertEquals(new SocketAddress("localhost", 7474), setting.solveDependency(null, setting.parse("localhost:7474")));
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class SettingTest method testSocket.
@Test
void testSocket() {
var setting = (SettingImpl<SocketAddress>) setting("setting", SOCKET_ADDRESS);
assertEquals(new SocketAddress("127.0.0.1", 7474), setting.parse("127.0.0.1:7474"));
assertEquals(new SocketAddress("127.0.0.1", 7474), setting.parse(" 127.0.0.1:7474 "));
assertEquals(new SocketAddress("127.0.0.1", -1), setting.parse("127.0.0.1"));
assertEquals(new SocketAddress(null, 7474), setting.parse(":7474"));
}
Aggregations