diff --git a/src/main/java/org/icij/datashare/Neo4jResource.java b/src/main/java/org/icij/datashare/Neo4jResource.java index c8682b9f..fc11e7c4 100644 --- a/src/main/java/org/icij/datashare/Neo4jResource.java +++ b/src/main/java/org/icij/datashare/Neo4jResource.java @@ -87,16 +87,20 @@ public class Neo4jResource implements AutoCloseable { "Name of the single project which will be able to user the extension when using neo4j" + " Community Edition" ), - List.of("neo4jHost", "neo4j", "Hostname of the neo4j DB."), + List.of("neo4jHost", "127.0.0.1", "Hostname of the neo4j DB."), List.of("neo4jPort", 7687, "Port of the neo4j DB."), List.of( "neo4jUriScheme", - "", + "bolt", "URI scheme used to connect to the neo4j DB (can be: bolt, neo4j, bolt+s, neo4j+s," + " ....)" ), - List.of("neo4jUser", "", "User name used to connect to the neo4j DB"), - List.of("neo4jPassword", "", "Password used to connect to the neo4j DB"), + List.of("neo4jUser", "neo4j", "User name used to connect to the neo4j DB"), + List.of( + "neo4jPassword", + "please-change-this-password", + "Password used to connect to the neo4j DB" + ), List.of( TASK_POLL_INTERVAL_S, 2, @@ -139,9 +143,7 @@ public class Neo4jResource implements AutoCloseable { protected Neo4jResource(PropertiesProvider propertiesProvider) { this.propertiesProvider = propertiesProvider; Properties neo4jDefaultProps = new Properties(); - neo4jDefaultProps.putAll(DEFAULT_NEO4J_PROPERTIES_MAP.entrySet().stream() - .filter(entry -> !entry.getValue().isEmpty()) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); + neo4jDefaultProps.putAll(DEFAULT_NEO4J_PROPERTIES_MAP); this.propertiesProvider.mergeWith(neo4jDefaultProps); this.appLoader = new Neo4jAppLoader(this.propertiesProvider); this.port = Integer.parseInt(propertiesProvider.get("neo4jAppPort").orElse("8080")); @@ -226,10 +228,11 @@ protected void startServerProcess(boolean forceMigrations) { logger.debug("Copying Datashare properties to temporary location {}", lazy(propertiesFile::getAbsolutePath)); + Properties setProperties = filterUnset(this.propertiesProvider.getProperties()); + try { - this.propertiesProvider - .getProperties() - .store(Files.newOutputStream(propertiesFile.toPath().toAbsolutePath()), null); + setProperties.store( + Files.newOutputStream(propertiesFile.toPath().toAbsolutePath()), null); } catch (IOException e) { throw new RuntimeException("Failed to write properties in temporary location", e); } @@ -306,6 +309,7 @@ protected void startServerProcess(boolean forceMigrations) { } } + protected boolean supportsNeo4jEnterprise() { checkNeo4jAppStarted(); synchronized (Neo4jResource.class) { @@ -613,6 +617,16 @@ private long getDocumentNodesLimit() { .orElse(NEO4J_DEFAULT_DUMPED_DOCUMENTS); } + static Properties filterUnset(Properties properties) { + Properties filtered = new Properties(properties.size()); + properties.forEach((key, value) -> { + if (!((String) value).isEmpty()) { + filtered.setProperty(key.toString(), value.toString()); + } + }); + return filtered; + } + @Override public void close() throws Exception { this.client.close();