use of org.neo4j.kernel.configuration.BoltConnector 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.kernel.configuration.BoltConnector 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.kernel.configuration.BoltConnector in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method groupToScopeSetting.
@Test
public void groupToScopeSetting() throws Exception {
// given
String hostname = "my_other_host";
int port = 9999;
String scoping = "bla";
Map<String, String> config = stringMap(GraphDatabaseSettings.default_advertised_address.name(), hostname, new BoltConnector(scoping).advertised_address.name(), ":" + port);
// when
BoltConnector boltConnector = new BoltConnector(scoping);
Setting<AdvertisedSocketAddress> advertised_address = boltConnector.advertised_address;
AdvertisedSocketAddress advertisedSocketAddress = advertised_address.apply(config::get);
// then
assertEquals(hostname, advertisedSocketAddress.getHostname());
assertEquals(port, advertisedSocketAddress.getPort());
}
use of org.neo4j.kernel.configuration.BoltConnector 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));
}
use of org.neo4j.kernel.configuration.BoltConnector in project neo4j by neo4j.
the class HazelcastClusterTopologyTest method shouldLogAndExcludeMembersWithMissingAttributes.
@Test
public void shouldLogAndExcludeMembersWithMissingAttributes() throws Exception {
// given
Set<Member> hazelcastMembers = new HashSet<>();
List<MemberId> coreMembers = new ArrayList<>();
for (int i = 0; i < 4; i++) {
MemberId memberId = new MemberId(UUID.randomUUID());
coreMembers.add(memberId);
Config config = Config.defaults();
HashMap<String, String> settings = new HashMap<>();
settings.put(new BoltConnector("bolt").type.name(), "BOLT");
settings.put(new BoltConnector("bolt").enabled.name(), "true");
settings.put(new BoltConnector("bolt").advertised_address.name(), "bolt:" + (i + 1));
settings.put(new BoltConnector("http").type.name(), "HTTP");
settings.put(new BoltConnector("http").enabled.name(), "true");
settings.put(new BoltConnector("http").advertised_address.name(), "http:" + (i + 1));
config.augment(settings);
Map<String, Object> attributes = buildMemberAttributesForCore(memberId, config).getAttributes();
if (i == 2) {
attributes.remove(HazelcastClusterTopology.RAFT_SERVER);
}
hazelcastMembers.add(new MemberImpl(new Address("localhost", i), null, attributes, false));
}
// when
Map<MemberId, CoreServerInfo> map = toCoreMemberMap(hazelcastMembers, NullLog.getInstance(), hzInstance);
// then
assertThat(map.keySet(), hasItems(coreMembers.get(0), coreMembers.get(1), coreMembers.get(3)));
assertThat(map.keySet(), not(hasItems(coreMembers.get(2))));
}
Aggregations