use of org.neo4j.kernel.configuration.HttpConnector 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));
}
}
use of org.neo4j.kernel.configuration.HttpConnector in project neo4j by neo4j.
the class GraphDatabaseSettingsTest method shouldBeAbleToOverrideHttpListenAddressWithJustOneParameter.
@Test
public void shouldBeAbleToOverrideHttpListenAddressWithJustOneParameter() throws Exception {
// given
Config config = Config.embeddedDefaults(stringMap("dbms.connector.http.enabled", "true", "dbms.connector.http.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));
}
use of org.neo4j.kernel.configuration.HttpConnector 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");
}
use of org.neo4j.kernel.configuration.HttpConnector in project neo4j 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(DatabaseManagementSystemSettings.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", Encryption.NONE);
HttpConnector httpsConnector = new HttpConnector("https", Encryption.TLS);
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(ServerSettings.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;
}
use of org.neo4j.kernel.configuration.HttpConnector in project neo4j by neo4j.
the class DatabaseActionsTest method createFiles.
@Before
public void createFiles() throws IOException {
storeDir = new File(testDirectory.directory(), "store_dir");
storeDir.mkdirs();
configFile = new File(testDirectory.directory(), "neo4j.conf");
Properties props = new Properties();
props.setProperty(new HttpConnector("http").type.name(), "HTTP");
props.setProperty(new HttpConnector("http").encryption.name(), "NONE");
props.setProperty(new HttpConnector("http").enabled.name(), "true");
try (FileWriter writer = new FileWriter(configFile)) {
props.store(writer, "");
}
}
Aggregations