Search in sources :

Example 6 with HttpConnector

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

the class GraphDatabaseSettingsTest method shouldBeAbleToOverrideHttpsListenAddressWithJustOneParameter.

@Test
public void shouldBeAbleToOverrideHttpsListenAddressWithJustOneParameter() throws Exception {
    // given
    Config config = Config.embeddedDefaults(stringMap("dbms.connector.https.enabled", "true", "dbms.connector.https.listen_address", ":8000"));
    // then
    assertEquals(1, config.enabledHttpConnectors().size());
    HttpConnector httpConnector = config.enabledHttpConnectors().get(0);
    assertEquals(new ListenSocketAddress("localhost", 8000), config.get(httpConnector.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)

Example 7 with HttpConnector

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

the class AbstractInProcessServerBuilder method init.

private void init(File workingDir) {
    setDirectory(workingDir);
    withConfig(auth_enabled, "false");
    withConfig(pagecache_memory, "8m");
    BoltConnector bolt0 = new BoltConnector("bolt");
    HttpConnector http1 = new HttpConnector("http", Encryption.NONE);
    HttpConnector http2 = new HttpConnector("https", Encryption.TLS);
    withConfig(http1.type, "HTTP");
    withConfig(http1.encryption, Encryption.NONE.name());
    withConfig(http1.enabled, "true");
    withConfig(http1.address, "localhost:" + Integer.toString(freePort(1001, 3000)));
    withConfig(http2.type, "HTTP");
    withConfig(http2.encryption, Encryption.TLS.name());
    withConfig(http2.enabled, "false");
    withConfig(http2.address, "localhost:" + Integer.toString(freePort(3001, 5000)));
    withConfig(bolt0.type, "BOLT");
    withConfig(bolt0.enabled, "true");
    withConfig(bolt0.address, "localhost:" + Integer.toString(freePort(5001, 9000)));
}
Also used : HttpConnector(org.neo4j.kernel.configuration.HttpConnector) BoltConnector(org.neo4j.kernel.configuration.BoltConnector)

Example 8 with HttpConnector

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

the class InProcessBuilderTest method shouldAllowCustomServerAndDbConfig.

@Test
public void shouldAllowCustomServerAndDbConfig() throws Exception {
    // Given
    trustAllSSLCerts();
    // When
    HttpConnector httpConnector = new HttpConnector("0", Encryption.NONE);
    HttpConnector httpsConnector = new HttpConnector("1", Encryption.TLS);
    try (ServerControls server = getTestServerBuilder(testDir.directory()).withConfig(httpConnector.type, "HTTP").withConfig(httpConnector.enabled, "true").withConfig(httpConnector.encryption, "NONE").withConfig(httpsConnector.type, "HTTP").withConfig(httpsConnector.enabled, "true").withConfig(httpsConnector.encryption, "TLS").withConfig(httpsConnector.address, "localhost:7473").withConfig(ServerSettings.certificates_directory.name(), testDir.directory("certificates").getAbsolutePath()).withConfig(GraphDatabaseSettings.dense_node_threshold, "20").newServer()) {
        // Then
        assertThat(HTTP.GET(server.httpsURI().get().toString()).status(), equalTo(200));
        assertDBConfig(server, "20", GraphDatabaseSettings.dense_node_threshold.name());
    }
}
Also used : HttpConnector(org.neo4j.kernel.configuration.HttpConnector) Test(org.junit.Test)

Example 9 with HttpConnector

use of org.neo4j.kernel.configuration.HttpConnector in project neo4j-documentation by neo4j.

the class CommunityServerBuilder method createConfiguration.

private Map<String, String> createConfiguration(File temporaryFolder) {
    Map<String, String> properties = stringMap(ServerSettings.management_api_path.name(), managementUri, ServerSettings.rest_api_path.name(), restUri);
    ServerTestUtils.addDefaultRelativeProperties(properties, temporaryFolder);
    if (dataDir != null) {
        properties.put(GraphDatabaseSettings.data_directory.name(), dataDir);
    }
    if (maxThreads != null) {
        properties.put(ServerSettings.webserver_max_threads.name(), maxThreads);
    }
    if (thirdPartyPackages.keySet().size() > 0) {
        properties.put(ServerSettings.third_party_packages.name(), asOneLine(thirdPartyPackages));
    }
    if (autoIndexedNodeKeys != null && autoIndexedNodeKeys.length > 0) {
        properties.put("dbms.auto_index.nodes.enabled", "true");
        String propertyKeys = org.apache.commons.lang.StringUtils.join(autoIndexedNodeKeys, ",");
        properties.put("dbms.auto_index.nodes.keys", propertyKeys);
    }
    if (autoIndexedRelationshipKeys != null && autoIndexedRelationshipKeys.length > 0) {
        properties.put("dbms.auto_index.relationships.enabled", "true");
        String propertyKeys = org.apache.commons.lang.StringUtils.join(autoIndexedRelationshipKeys, ",");
        properties.put("dbms.auto_index.relationships.keys", propertyKeys);
    }
    if (securityRuleClassNames != null && securityRuleClassNames.length > 0) {
        String propertyKeys = org.apache.commons.lang.StringUtils.join(securityRuleClassNames, ",");
        properties.put(ServerSettings.security_rules.name(), propertyKeys);
    }
    HttpConnector httpConnector = new HttpConnector("http");
    HttpConnector httpsConnector = new HttpConnector("https");
    properties.put(httpConnector.type.name(), "HTTP");
    properties.put(httpConnector.enabled.name(), "true");
    properties.put(httpConnector.address.name(), address.toString());
    properties.put(httpConnector.encryption.name(), "NONE");
    properties.put(httpsConnector.type.name(), "HTTP");
    properties.put(httpsConnector.enabled.name(), String.valueOf(httpsEnabled));
    properties.put(httpsConnector.address.name(), httpsAddress.toString());
    properties.put(httpsConnector.encryption.name(), "TLS");
    properties.put(GraphDatabaseSettings.auth_enabled.name(), "false");
    properties.put(LegacySslPolicyConfig.certificates_directory.name(), new File(temporaryFolder, "certificates").getAbsolutePath());
    properties.put(GraphDatabaseSettings.logs_directory.name(), new File(temporaryFolder, "logs").getAbsolutePath());
    properties.put(GraphDatabaseSettings.pagecache_memory.name(), "8m");
    for (Object key : arbitraryProperties.keySet()) {
        properties.put(String.valueOf(key), String.valueOf(arbitraryProperties.get(key)));
    }
    return properties;
}
Also used : HttpConnector(org.neo4j.kernel.configuration.HttpConnector) File(java.io.File)

Aggregations

HttpConnector (org.neo4j.kernel.configuration.HttpConnector)9 Test (org.junit.Test)5 Config (org.neo4j.kernel.configuration.Config)4 File (java.io.File)3 ListenSocketAddress (org.neo4j.helpers.ListenSocketAddress)3 BoltConnector (org.neo4j.kernel.configuration.BoltConnector)2 FileWriter (java.io.FileWriter)1 Properties (java.util.Properties)1 Before (org.junit.Before)1 CoreTopologyService (org.neo4j.causalclustering.discovery.CoreTopologyService)1 HazelcastDiscoveryServiceFactory (org.neo4j.causalclustering.discovery.HazelcastDiscoveryServiceFactory)1 MemberId (org.neo4j.causalclustering.identity.MemberId)1 Neo4jJobScheduler (org.neo4j.kernel.impl.util.Neo4jJobScheduler)1 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)1