use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldSupportMultipleBoltConnectorsWithDefaultAndCustomName.
@Test
public void shouldSupportMultipleBoltConnectorsWithDefaultAndCustomName() throws Exception {
Config config = Config.embeddedDefaults(stringMap("dbms.connector.bolt.type", "BOLT", "dbms.connector.bolt.enabled", "true", "dbms.connector.bolt.listen_address", ":8000", "dbms.connector.bolt2.type", "BOLT", "dbms.connector.bolt2.enabled", "true", "dbms.connector.bolt2.listen_address", ":9000"));
// when
BoltConnector boltConnector1 = config.boltConnectors().get(0);
BoltConnector boltConnector2 = config.boltConnectors().get(1);
// then
assertEquals(new ListenSocketAddress("localhost", 8000), config.get(boltConnector1.listen_address));
assertEquals(new ListenSocketAddress("localhost", 9000), config.get(boltConnector2.listen_address));
}
use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldEnableBoltByDefault.
@Test
public void shouldEnableBoltByDefault() throws Exception {
// given
Config config = Config.serverDefaults();
// when
BoltConnector boltConnector = config.boltConnectors().get(0);
ListenSocketAddress listenSocketAddress = config.get(boltConnector.listen_address);
// then
assertEquals(new ListenSocketAddress("localhost", 7687), listenSocketAddress);
}
use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method testServerDefaultSettings.
/// JONAS HTTP FOLLOWS
@Test
public void testServerDefaultSettings() throws Exception {
// given
Config config = Config.serverDefaults();
// when
List<HttpConnector> connectors = config.httpConnectors();
// then
assertEquals(2, connectors.size());
if (connectors.get(0).encryptionLevel().equals(TLS)) {
assertEquals(new ListenSocketAddress("localhost", 7474), config.get(connectors.get(1).listen_address));
assertEquals(new ListenSocketAddress("localhost", 7473), config.get(connectors.get(0).listen_address));
} else {
assertEquals(new ListenSocketAddress("localhost", 7474), config.get(connectors.get(0).listen_address));
assertEquals(new ListenSocketAddress("localhost", 7473), config.get(connectors.get(1).listen_address));
}
}
use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldSupportMultipleBoltConnectorsWithCustomNames.
@Test
public void shouldSupportMultipleBoltConnectorsWithCustomNames() throws Exception {
Config config = Config.embeddedDefaults(stringMap("dbms.connector.bolt1.type", "BOLT", "dbms.connector.bolt1.enabled", "true", "dbms.connector.bolt1.listen_address", ":8000", "dbms.connector.bolt2.type", "BOLT", "dbms.connector.bolt2.enabled", "true", "dbms.connector.bolt2.listen_address", ":9000"));
// when
List<ListenSocketAddress> addresses = config.boltConnectors().stream().map(c -> config.get(c.listen_address)).collect(Collectors.toList());
// then
assertEquals(2, addresses.size());
if (addresses.get(0).getPort() == 8000) {
assertEquals(new ListenSocketAddress("localhost", 8000), addresses.get(0));
assertEquals(new ListenSocketAddress("localhost", 9000), addresses.get(1));
} else {
assertEquals(new ListenSocketAddress("localhost", 8000), addresses.get(1));
assertEquals(new ListenSocketAddress("localhost", 9000), addresses.get(0));
}
}
use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldStillSupportCustomNameForBoltConnector.
@Test
public void shouldStillSupportCustomNameForBoltConnector() throws Exception {
Config config = Config.embeddedDefaults(stringMap("dbms.connector.random_name_that_will_be_unsupported.type", "BOLT", "dbms.connector.random_name_that_will_be_unsupported.enabled", "true", "dbms.connector.random_name_that_will_be_unsupported.listen_address", ":8000"));
// when
BoltConnector boltConnector = config.boltConnectors().get(0);
// then
assertEquals(new ListenSocketAddress("localhost", 8000), config.get(boltConnector.listen_address));
}
Aggregations