use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class RoutingResultFormat method parseRows.
private static Map<Role, List<SocketAddress>> parseRows(ListValue rows) {
Map<Role, List<SocketAddress>> endpoints = new HashMap<>();
for (AnyValue single : rows) {
MapValue row = (MapValue) single;
Role role = Role.valueOf(((TextValue) row.get("role")).stringValue());
List<SocketAddress> addresses = parseEndpoints((ListValue) row.get("addresses"));
endpoints.put(role, addresses);
}
Arrays.stream(Role.values()).forEach(r -> endpoints.putIfAbsent(r, Collections.emptyList()));
return endpoints;
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldDeriveListenAddressFromDefaultListenAddressAndSpecifiedPorts.
@Test
void shouldDeriveListenAddressFromDefaultListenAddressAndSpecifiedPorts() {
// given
Config config = Config.newBuilder().set(GraphDatabaseSettings.default_listen_address, new SocketAddress("0.0.0.0")).set(HttpConnector.listen_address, new SocketAddress(8000)).set(HttpsConnector.listen_address, new SocketAddress(9000)).set(BoltConnector.listen_address, new SocketAddress(10000)).build();
// then
assertEquals(new SocketAddress("0.0.0.0", 9000), config.get(HttpsConnector.listen_address));
assertEquals(new SocketAddress("0.0.0.0", 8000), config.get(HttpConnector.listen_address));
assertEquals(new SocketAddress("0.0.0.0", 10000), config.get(BoltConnector.listen_address));
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldBeAbleToOverrideBoltListenAddressesWithJustOneParameter.
@Test
void shouldBeAbleToOverrideBoltListenAddressesWithJustOneParameter() {
// given
Config config = Config.newBuilder().set(BoltConnector.enabled, true).set(BoltConnector.listen_address, new SocketAddress(8000)).build();
// then
assertEquals(new SocketAddress("localhost", 8000), config.get(BoltConnector.listen_address));
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldDeriveListenAddressFromDefaultListenAddress.
@Test
void shouldDeriveListenAddressFromDefaultListenAddress() {
// given
Config config = Config.newBuilder().set(GraphDatabaseSettings.default_listen_address, new SocketAddress("0.0.0.0")).setDefaults(GraphDatabaseSettings.SERVER_DEFAULTS).build();
// then
assertEquals("0.0.0.0", config.get(HttpConnector.listen_address).getHostname());
assertEquals("0.0.0.0", config.get(HttpsConnector.listen_address).getHostname());
assertEquals("0.0.0.0", config.get(BoltConnector.listen_address).getHostname());
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldEnableBoltByDefault.
@Test
void shouldEnableBoltByDefault() {
// given
Config config = Config.newBuilder().setDefaults(GraphDatabaseSettings.SERVER_DEFAULTS).build();
// when
SocketAddress listenSocketAddress = config.get(BoltConnector.listen_address);
// then
assertEquals(new SocketAddress("localhost", 7687), listenSocketAddress);
}
Aggregations