Search in sources :

Example 11 with BoltConnector

use of org.neo4j.kernel.configuration.BoltConnector in project neo4j by neo4j.

the class BoltIT method startServerWithBoltEnabled.

private void startServerWithBoltEnabled(String advertisedHost, int advertisedPort, String listenHost, int listenPort) throws IOException {
    server = server().withProperty(new BoltConnector("bolt").type.name(), "BOLT").withProperty(new BoltConnector("bolt").enabled.name(), "true").withProperty(new BoltConnector("bolt").encryption_level.name(), "REQUIRED").withProperty(new BoltConnector("bolt").advertised_address.name(), advertisedHost + ":" + advertisedPort).withProperty(new BoltConnector("bolt").listen_address.name(), listenHost + ":" + listenPort).usingDataDir(tmpDir.getRoot().getAbsolutePath()).build();
    server.start();
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector)

Example 12 with BoltConnector

use of org.neo4j.kernel.configuration.BoltConnector in project neo4j by neo4j.

the class CausalClusterConfigurationValidatorTest method validateSuccess.

@Test
public void validateSuccess() throws Exception {
    // when
    Config config = Config.embeddedDefaults(stringMap(ClusterSettings.mode.name(), mode.name(), initial_discovery_members.name(), "localhost:99,remotehost:2", new BoltConnector("bolt").enabled.name(), "true"), Collections.singleton(new CausalClusterConfigurationValidator()));
    // then
    assertEquals(asList(new AdvertisedSocketAddress("localhost", 99), new AdvertisedSocketAddress("remotehost", 2)), config.get(initial_discovery_members));
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) AdvertisedSocketAddress(org.neo4j.helpers.AdvertisedSocketAddress) Test(org.junit.Test)

Example 13 with BoltConnector

use of org.neo4j.kernel.configuration.BoltConnector in project neo4j by neo4j.

the class HazelcastClientTest method config.

private Config config() {
    Config defaults = 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:3001");
    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:3001");
    return defaults.augment(settings);
}
Also used : HashMap(java.util.HashMap) BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) Matchers.anyString(org.mockito.Matchers.anyString)

Example 14 with BoltConnector

use of org.neo4j.kernel.configuration.BoltConnector in project neo4j by neo4j.

the class HazelcastClusterTopologyTest method shouldCollectMembersAsAMap.

@Test
public void shouldCollectMembersAsAMap() throws Exception {
    // given
    Set<Member> hazelcastMembers = new HashSet<>();
    List<MemberId> coreMembers = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
        MemberId memberId = new MemberId(UUID.randomUUID());
        coreMembers.add(memberId);
        Config config = Config.defaults();
        HashMap<String, String> settings = new HashMap<>();
        settings.put(CausalClusteringSettings.transaction_advertised_address.name(), "tx:" + (i + 1));
        settings.put(CausalClusteringSettings.raft_advertised_address.name(), "raft:" + (i + 1));
        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();
        hazelcastMembers.add(new MemberImpl(new Address("localhost", i), null, attributes, false));
    }
    // when
    Map<MemberId, CoreServerInfo> coreMemberMap = toCoreMemberMap(hazelcastMembers, NullLog.getInstance(), hzInstance);
    // then
    for (int i = 0; i < 5; i++) {
        CoreServerInfo coreServerInfo = coreMemberMap.get(coreMembers.get(i));
        assertEquals(new AdvertisedSocketAddress("tx", i + 1), coreServerInfo.getCatchupServer());
        assertEquals(new AdvertisedSocketAddress("raft", i + 1), coreServerInfo.getRaftServer());
        assertEquals(new AdvertisedSocketAddress("bolt", i + 1), coreServerInfo.connectors().boltAddress());
        assertEquals(coreServerInfo.groups(), GROUPS);
    }
}
Also used : Address(com.hazelcast.nio.Address) AdvertisedSocketAddress(org.neo4j.helpers.AdvertisedSocketAddress) HashMap(java.util.HashMap) BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) MemberImpl(com.hazelcast.client.impl.MemberImpl) ArrayList(java.util.ArrayList) AdvertisedSocketAddress(org.neo4j.helpers.AdvertisedSocketAddress) Matchers.anyString(org.mockito.Matchers.anyString) MemberId(org.neo4j.causalclustering.identity.MemberId) Member(com.hazelcast.core.Member) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 15 with BoltConnector

use of org.neo4j.kernel.configuration.BoltConnector in project neo4j by neo4j.

the class BoltMetricsIT method shouldMonitorBolt.

@Test
public void shouldMonitorBolt() throws Throwable {
    // Given
    File metricsFolder = tmpDir.newFolder("metrics");
    db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().setConfig(new BoltConnector("bolt").type, "BOLT").setConfig(new BoltConnector("bolt").enabled, "true").setConfig(GraphDatabaseSettings.auth_enabled, "false").setConfig(MetricsSettings.boltMessagesEnabled, "true").setConfig(MetricsSettings.csvEnabled, "true").setConfig(MetricsSettings.csvInterval, "100ms").setConfig(MetricsSettings.csvPath, metricsFolder.getAbsolutePath()).newGraphDatabase();
    // When
    conn = new SocketConnection().connect(new HostnamePort("localhost", 7687)).send(acceptedVersions(1, 0, 0, 0)).send(chunk(InitMessage.init("TestClient", map("scheme", "basic", "principal", "neo4j", "credentials", "neo4j"))));
    // Then
    assertEventually("session shows up as started", () -> readLongValue(metricsCsv(metricsFolder, SESSIONS_STARTED)), equalTo(1L), 5, SECONDS);
    assertEventually("init request shows up as received", () -> readLongValue(metricsCsv(metricsFolder, MESSAGES_RECIEVED)), equalTo(1L), 5, SECONDS);
    assertEventually("init request shows up as started", () -> readLongValue(metricsCsv(metricsFolder, MESSAGES_STARTED)), equalTo(1L), 5, SECONDS);
    assertEventually("init request shows up as done", () -> readLongValue(metricsCsv(metricsFolder, MESSAGES_DONE)), equalTo(1L), 5, SECONDS);
    assertEventually("queue time shows up", () -> readLongValue(metricsCsv(metricsFolder, TOTAL_QUEUE_TIME)), greaterThanOrEqualTo(0L), 5, SECONDS);
    assertEventually("processing time shows up", () -> readLongValue(metricsCsv(metricsFolder, TOTAL_PROCESSING_TIME)), greaterThanOrEqualTo(0L), 5, SECONDS);
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector) SocketConnection(org.neo4j.bolt.v1.transport.socket.client.SocketConnection) HostnamePort(org.neo4j.helpers.HostnamePort) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) File(java.io.File) Test(org.junit.Test)

Aggregations

BoltConnector (org.neo4j.kernel.configuration.BoltConnector)21 Test (org.junit.Test)15 Config (org.neo4j.kernel.configuration.Config)14 ListenSocketAddress (org.neo4j.helpers.ListenSocketAddress)6 HashMap (java.util.HashMap)5 AdvertisedSocketAddress (org.neo4j.helpers.AdvertisedSocketAddress)4 File (java.io.File)3 Matchers.anyString (org.mockito.Matchers.anyString)3 MemberId (org.neo4j.causalclustering.identity.MemberId)3 MemberImpl (com.hazelcast.client.impl.MemberImpl)2 Member (com.hazelcast.core.Member)2 Address (com.hazelcast.nio.Address)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 HttpConnector (org.neo4j.kernel.configuration.HttpConnector)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 SocketConnection (org.neo4j.bolt.v1.transport.socket.client.SocketConnection)1 CoreTopologyService (org.neo4j.causalclustering.discovery.CoreTopologyService)1 HazelcastDiscoveryServiceFactory (org.neo4j.causalclustering.discovery.HazelcastDiscoveryServiceFactory)1 HostnamePort (org.neo4j.helpers.HostnamePort)1