Search in sources :

Example 1 with ListenSocketAddress

use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.

the class GraphDatabaseSettingsTest method shouldStillSupportCustomNameForHttpConnector.

@Test
public void shouldStillSupportCustomNameForHttpConnector() throws Exception {
    Config config = Config.embeddedDefaults(stringMap("dbms.connector.random_name_that_will_be_unsupported.type", "HTTP", "dbms.connector.random_name_that_will_be_unsupported.encryption", "NONE", "dbms.connector.random_name_that_will_be_unsupported.enabled", "true", "dbms.connector.random_name_that_will_be_unsupported.listen_address", ":8000"));
    // then
    assertEquals(1, config.enabledHttpConnectors().size());
    assertEquals(new ListenSocketAddress("localhost", 8000), config.get(config.enabledHttpConnectors().get(0).listen_address));
}
Also used : Config(org.neo4j.kernel.configuration.Config) ListenSocketAddress(org.neo4j.helpers.ListenSocketAddress) Test(org.junit.Test)

Example 2 with ListenSocketAddress

use of org.neo4j.helpers.ListenSocketAddress in project neo4j by neo4j.

the class GraphDatabaseSettingsTest method shouldStillSupportCustomNameForHttpsConnector.

@Test
public void shouldStillSupportCustomNameForHttpsConnector() throws Exception {
    Config config = Config.embeddedDefaults(stringMap("dbms.connector.random_name_that_will_be_unsupported.type", "HTTP", "dbms.connector.random_name_that_will_be_unsupported.encryption", "TLS", "dbms.connector.random_name_that_will_be_unsupported.enabled", "true", "dbms.connector.random_name_that_will_be_unsupported.listen_address", ":9000"));
    // then
    assertEquals(1, config.enabledHttpConnectors().size());
    assertEquals(new ListenSocketAddress("localhost", 9000), config.get(config.enabledHttpConnectors().get(0).listen_address));
}
Also used : Config(org.neo4j.kernel.configuration.Config) ListenSocketAddress(org.neo4j.helpers.ListenSocketAddress) Test(org.junit.Test)

Example 3 with ListenSocketAddress

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));
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) ListenSocketAddress(org.neo4j.helpers.ListenSocketAddress) Test(org.junit.Test)

Example 4 with ListenSocketAddress

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);
}
Also used : BoltConnector(org.neo4j.kernel.configuration.BoltConnector) Config(org.neo4j.kernel.configuration.Config) ListenSocketAddress(org.neo4j.helpers.ListenSocketAddress) Test(org.junit.Test)

Example 5 with 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));
    }
}
Also used : HttpConnector(org.neo4j.kernel.configuration.HttpConnector) Config(org.neo4j.kernel.configuration.Config) ListenSocketAddress(org.neo4j.helpers.ListenSocketAddress) Test(org.junit.Test)

Aggregations

ListenSocketAddress (org.neo4j.helpers.ListenSocketAddress)29 Test (org.junit.Test)26 Config (org.neo4j.kernel.configuration.Config)15 BoltConnector (org.neo4j.kernel.configuration.BoltConnector)8 ServerSocket (java.net.ServerSocket)4 AdvertisedSocketAddress (org.neo4j.helpers.AdvertisedSocketAddress)4 HttpConnector (org.neo4j.kernel.configuration.HttpConnector)4 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)4 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 BiFunction (java.util.function.BiFunction)2 NettyServer (org.neo4j.bolt.transport.NettyServer)2 Configuration (org.neo4j.graphdb.config.Configuration)2 Setting (org.neo4j.graphdb.config.Setting)2 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)2 InterfacesConfig (com.hazelcast.config.InterfacesConfig)1 JoinConfig (com.hazelcast.config.JoinConfig)1 MemberAttributeConfig (com.hazelcast.config.MemberAttributeConfig)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1