Search in sources :

Example 6 with BoltConnector

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

the class ConfigLoaderTest method loadOfflineConfigShouldDisableBolt.

@Test
public void loadOfflineConfigShouldDisableBolt() throws IOException {
    // given
    BoltConnector defaultBoltConf = new BoltConnector("bolt");
    Optional<File> configFile = ConfigFileBuilder.builder(folder.getRoot()).withNameValue(defaultBoltConf.enabled.name(), Settings.TRUE).build();
    // when
    Config testConf = ConfigLoader.loadConfigWithConnectorsDisabled(Optional.of(folder.getRoot()), configFile);
    // then
    assertNotNull(testConf);
    assertEquals(false, testConf.get(defaultBoltConf.enabled));
    assertEquals(false, testConf.get(new BoltConnector().enabled));
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) File(java.io.File) Test(org.junit.Test)

Example 7 with BoltConnector

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))));
}
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) 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 8 with BoltConnector

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

the class TransactionGuardIntegrationTest method startNeoServer.

private CommunityNeoServer startNeoServer(GraphDatabaseFacade database) throws IOException {
    if (neoServer == null) {
        GuardingServerBuilder serverBuilder = new GuardingServerBuilder(database);
        BoltConnector boltConnector = new BoltConnector("bolt");
        serverBuilder.withProperty(boltConnector.type.name(), "BOLT").withProperty(boltConnector.enabled.name(), "true").withProperty(boltConnector.encryption_level.name(), BoltConnector.EncryptionLevel.DISABLED.name()).withProperty(GraphDatabaseSettings.auth_enabled.name(), "false");
        neoServer = serverBuilder.build();
        cleanupRule.add(neoServer);
        neoServer.start();
    }
    return neoServer;
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector)

Example 9 with BoltConnector

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

the class DiscoveryServiceTest method mockConfig.

private Config mockConfig() throws URISyntaxException {
    Config config = Config.defaults();
    HashMap<String, String> settings = new HashMap<>();
    settings.put(GraphDatabaseSettings.auth_enabled.name(), "false");
    settings.put(new BoltConnector("bolt").type.name(), "BOLT");
    settings.put(new BoltConnector("bolt").enabled.name(), "true");
    settings.put(new BoltConnector("bolt").advertised_address.name(), boltAddress.toString());
    settings.put(ServerSettings.management_api_path.name(), managementUri.toString());
    settings.put(ServerSettings.rest_api_path.name(), dataUri.toString());
    config.augment(settings);
    return config;
}
Also used : HashMap(java.util.HashMap) BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 10 with BoltConnector

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

the class ConnectionInfoIT method hzTest.

@Test
public void hzTest() throws Throwable {
    // given
    testSocket = bindPort("0.0.0.0", 4243);
    //when
    AssertableLogProvider logProvider = new AssertableLogProvider();
    AssertableLogProvider userLogProvider = new AssertableLogProvider();
    HazelcastDiscoveryServiceFactory hzFactory = new HazelcastDiscoveryServiceFactory();
    Config config = embeddedDefaults(stringMap(discovery_listen_address.name(), ":" + testSocket.getLocalPort(), CausalClusteringSettings.initial_discovery_members.name(), "localhost:" + testSocket.getLocalPort(), new BoltConnector("bolt").enabled.name(), "true", new HttpConnector("http").enabled.name(), "true"));
    Neo4jJobScheduler jobScheduler = new Neo4jJobScheduler();
    jobScheduler.init();
    CoreTopologyService coreTopologyService = hzFactory.coreTopologyService(config, new MemberId(UUID.randomUUID()), jobScheduler, logProvider, userLogProvider);
    try {
        coreTopologyService.init();
        coreTopologyService.start();
    }//then
     catch (Throwable throwable) {
    //expected
    }
    logProvider.assertContainsMessageContaining("Hazelcast was unable to start with setting");
    userLogProvider.assertContainsMessageContaining("Hazelcast was unable to start with setting");
}
Also used : Neo4jJobScheduler(org.neo4j.kernel.impl.util.Neo4jJobScheduler) MemberId(org.neo4j.causalclustering.identity.MemberId) HttpConnector(org.neo4j.kernel.configuration.HttpConnector) HazelcastDiscoveryServiceFactory(org.neo4j.causalclustering.discovery.HazelcastDiscoveryServiceFactory) CoreTopologyService(org.neo4j.causalclustering.discovery.CoreTopologyService) BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) 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