use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class InProcessServerBuilderIT method testStartupWithConnectors.
private void testStartupWithConnectors(boolean httpEnabled, boolean httpsEnabled, boolean boltEnabled) {
var certificates = directory.directory("certificates");
Neo4jBuilder serverBuilder = Neo4jBuilders.newInProcessBuilder(directory.homePath()).withConfig(HttpConnector.enabled, httpEnabled).withConfig(HttpConnector.listen_address, new SocketAddress(0)).withConfig(HttpsConnector.enabled, httpsEnabled).withConfig(HttpsConnector.listen_address, new SocketAddress(0)).withConfig(BoltConnector.enabled, boltEnabled).withConfig(BoltConnector.listen_address, new SocketAddress(0));
if (httpsEnabled) {
SelfSignedCertificateFactory.create(certificates);
serverBuilder.withConfig(SslPolicyConfig.forScope(HTTPS).enabled, Boolean.TRUE);
serverBuilder.withConfig(SslPolicyConfig.forScope(HTTPS).base_directory, certificates);
}
try (Neo4j neo4j = serverBuilder.build()) {
GraphDatabaseService db = neo4j.defaultDatabaseService();
assertDbAccessible(db);
verifyConnector(db, "http", httpEnabled);
verifyConnector(db, "https", httpsEnabled);
verifyConnector(db, "bolt", boltEnabled);
}
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class DiscoverableURIsTest method shouldLookupBoltPort.
@Test
void shouldLookupBoltPort() {
var config = Config.newBuilder().set(Map.of(BoltConnector.enabled, true, BoltConnector.advertised_address, new SocketAddress(0))).build();
var register = new ConnectorPortRegister();
register.register(BoltConnector.NAME, new InetSocketAddress(1337));
var discoverables = new DiscoverableURIs.Builder().addBoltEndpoint(config, register).build();
discoverables.forEach(consumer);
verify(consumer).accept("bolt_direct", "bolt://localhost:1337");
verify(consumer).accept("bolt_routing", "neo4j://localhost:1337");
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class DiscoverableURIsTest method shouldOverrideBoltHostWhenHostIsExplicitlySet.
@Test
void shouldOverrideBoltHostWhenHostIsExplicitlySet() {
var config = Config.newBuilder().set(Map.of(BoltConnector.enabled, true, GraphDatabaseSettings.default_advertised_address, new SocketAddress("myDog.com"), BoltConnector.advertised_address, new SocketAddress("myCat.com", 1234))).build();
var discoverables = new DiscoverableURIs.Builder().addBoltEndpoint(config, portRegister).build();
discoverables.forEach(consumer);
verify(consumer).accept("bolt_direct", "bolt://myCat.com:1234");
verify(consumer).accept("bolt_routing", "neo4j://myCat.com:1234");
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class DiscoverableURIsTest method shouldNotSetBoltHostWhenHostIsNotExplicitlySet.
@Test
void shouldNotSetBoltHostWhenHostIsNotExplicitlySet() {
var config = Config.newBuilder().set(Map.of(BoltConnector.enabled, true, BoltConnector.advertised_address, new SocketAddress(1234))).build();
var discoverables = new DiscoverableURIs.Builder().addBoltEndpoint(config, portRegister).build();
discoverables.forEach(consumer);
verify(consumer).accept("bolt_direct", "bolt://localhost:1234");
verify(consumer).accept("bolt_routing", "neo4j://localhost:1234");
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class DiscoverableURIsTest method shouldOverrideBoltEndpoints.
@Test
void shouldOverrideBoltEndpoints() {
var config = Config.newBuilder().set(Map.of(BoltConnector.enabled, true, // ignored
GraphDatabaseSettings.default_advertised_address, // ignored
new SocketAddress("myDog.com"), // ignored
BoltConnector.advertised_address, // ignored
new SocketAddress("myCat.com", 1234), ServerSettings.bolt_discoverable_address, URI.create("dog://myDog.com"), ServerSettings.bolt_routing_discoverable_address, URI.create("cat://myCat.com"))).build();
var discoverables = new DiscoverableURIs.Builder().addBoltEndpoint(config, portRegister).build();
discoverables.forEach(consumer);
verify(consumer).accept("bolt_direct", "dog://myDog.com");
verify(consumer).accept("bolt_routing", "cat://myCat.com");
}
Aggregations