From 04a3239a8b12c5d5faaf87492dd8b1a6595c44c1 Mon Sep 17 00:00:00 2001 From: Joel Bergstrand Date: Wed, 8 Jan 2025 10:53:40 +0100 Subject: [PATCH 1/4] Moving to database setting --- build.gradle | 2 +- common/src/main/java/apoc/ApocConfig.java | 51 ++++++++++--------- .../apoc/ApocConfigCommandExpansionTest.java | 34 ++++++++----- common/src/test/java/apoc/ApocConfigTest.java | 1 + .../apoc.conf | 0 5 files changed, 50 insertions(+), 38 deletions(-) rename common/src/test/resources/{apoc-config-command-expansion => conf}/apoc.conf (100%) diff --git a/build.gradle b/build.gradle index 1b916b09a..13e29f99e 100644 --- a/build.gradle +++ b/build.gradle @@ -170,7 +170,7 @@ apply from: "licenses-source-header.gradle" ext { publicDir = "${project.rootDir}" - neo4jVersionEffective = project.hasProperty("neo4jVersionOverride") ? project.getProperty("neo4jVersionOverride") : "2025.01.0" + neo4jVersionEffective = project.hasProperty("neo4jVersionOverride") ? project.getProperty("neo4jVersionOverride") : "2025.01.0-SNAPSHOT" testContainersVersion = '1.20.2' apacheArrowVersion = '15.0.0' } diff --git a/common/src/main/java/apoc/ApocConfig.java b/common/src/main/java/apoc/ApocConfig.java index 3f738e89a..1b7fa22d7 100644 --- a/common/src/main/java/apoc/ApocConfig.java +++ b/common/src/main/java/apoc/ApocConfig.java @@ -23,6 +23,7 @@ import static org.neo4j.configuration.BootloaderSettings.lib_directory; import static org.neo4j.configuration.BootloaderSettings.run_directory; import static org.neo4j.configuration.GraphDatabaseSettings.SYSTEM_DATABASE_NAME; +import static org.neo4j.configuration.GraphDatabaseSettings.configuration_directory; import static org.neo4j.configuration.GraphDatabaseSettings.data_directory; import static org.neo4j.configuration.GraphDatabaseSettings.load_csv_file_url_root; import static org.neo4j.configuration.GraphDatabaseSettings.logs_directory; @@ -188,30 +189,32 @@ public void init() { } protected String determineNeo4jConfFolder() { - String defaultPath = neo4jConfig - .get(neo4j_home) - .resolve(Config.DEFAULT_CONFIG_DIR_NAME) - .toString(); - String command = System.getProperty(SUN_JAVA_COMMAND); - if (command == null) { - log.warn( - "system property %s is not set, assuming %s as conf dir. This might cause `apoc.conf` not getting loaded.", - SUN_JAVA_COMMAND, defaultPath); - return defaultPath; - } else { - final String neo4jConfFolder = Stream.of(command.split("--")) - .map(String::trim) - .filter(s -> s.startsWith(CONFIG_DIR)) - .map(s -> s.substring(CONFIG_DIR.length())) - .findFirst() - .orElse(defaultPath); - if (defaultPath.equals(neo4jConfFolder)) { - log.info("cannot determine conf folder from sys property %s, assuming %s", command, defaultPath); - } else { - log.info("from system properties: NEO4J_CONF=%s", neo4jConfFolder); - } - return neo4jConfFolder; - } + return neo4jConfig.get(configuration_directory).resolve(Config.DEFAULT_CONFIG_DIR_NAME).toString(); +// String defaultPath =neo4jConfig.get(configuration_directory).toString(); //resolve(Config.DEFAULT_CONFIG_DIR_NAME).toString(); +// neo4jConfig +// .get(neo4j_home) +// .resolve(Config.DEFAULT_CONFIG_DIR_NAME) +// .toString(); +// String command = System.getProperty(SUN_JAVA_COMMAND); +// if (command == null) { +// log.warn( +// "system property %s is not set, assuming %s as conf dir. This might cause `apoc.conf` not getting loaded.", +// SUN_JAVA_COMMAND, defaultPath); +// return defaultPath; +// } else { +// final String neo4jConfFolder = Stream.of(command.split("--")) +// .map(String::trim) +// .filter(s -> s.startsWith(CONFIG_DIR)) +// .map(s -> s.substring(CONFIG_DIR.length())) +// .findFirst() +// .orElse(defaultPath); +// if (defaultPath.equals(neo4jConfFolder)) { +// log.info("cannot determine conf folder from sys property %s, assuming %s", command, defaultPath); +// } else { +// log.info("from system properties: NEO4J_CONF=%s", neo4jConfFolder); +// } +// return neo4jConfFolder; +// } } /** diff --git a/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java b/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java index 7d56d80f4..95715c529 100644 --- a/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java +++ b/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java @@ -75,15 +75,17 @@ public void setup() throws Exception { when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.get(GraphDatabaseSettings.allow_file_urls)).thenReturn(false); when(neo4jConfig.expandCommands()).thenReturn(true); - when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); +// when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); apocConfigCommandExpansionFile = new File(getClass() .getClassLoader() - .getResource("apoc-config-command-expansion/apoc.conf") + .getResource("apoc.conf") .toURI()); Files.setPosixFilePermissions( apocConfigCommandExpansionFile.toPath(), permittedFilePermissionsForCommandExpansion); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); + GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); apocConfig = @@ -93,6 +95,8 @@ public void setup() throws Exception { @After public void cleanup() { System.clearProperty(SUN_JAVA_COMMAND); + System.clearProperty(APOC_MAX_DECOMPRESSION_RATIO); + System.clearProperty("command.expansion"); } private void setApocConfigFilePermissions(Set forbidden) throws Exception { @@ -101,16 +105,16 @@ private void setApocConfigFilePermissions(Set forbidden) th Sets.union(permittedFilePermissionsForCommandExpansion, forbidden)); } - private void setApocConfigSystemProperty() { - System.setProperty( - SUN_JAVA_COMMAND, - "com.neo4j.server.enterprise.CommercialEntryPoint --home-dir=/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02 --config-dir=" - + apocConfigCommandExpansionFile.getParent()); - } +// private void setApocConfigSystemProperty() { +// System.setProperty( +// SUN_JAVA_COMMAND, +// "com.neo4j.server.enterprise.CommercialEntryPoint --home-dir=/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02 --config-dir=" +// + apocConfigCommandExpansionFile.getParent()); +// } @Test public void testApocConfWithExpandCommands() { - setApocConfigSystemProperty(); +// setApocConfigSystemProperty(); apocConfig.init(); assertEquals("expanded value", apocConfig.getConfig().getString("command.expansion")); @@ -120,7 +124,7 @@ public void testApocConfWithExpandCommands() { public void testApocConfWithInvalidExpandCommands() throws Exception { String invalidExpandLine = "command.expansion.3=$(fakeCommand 3 + 3)"; addLineToApocConfig(invalidExpandLine); - setApocConfigSystemProperty(); +// setApocConfigSystemProperty(); RuntimeException e = assertThrows(RuntimeException.class, apocConfig::init); String expectedMessage = @@ -134,7 +138,7 @@ public void testApocConfWithInvalidExpandCommands() throws Exception { public void testApocConfWithWrongFilePermissions() throws Exception { for (PosixFilePermission filePermission : forbiddenFilePermissionsForCommandExpansion) { setApocConfigFilePermissions(Set.of(filePermission)); - setApocConfigSystemProperty(); +// setApocConfigSystemProperty(); RuntimeException e = assertThrows(RuntimeException.class, apocConfig::init); String expectedMessage = "does not have the correct file permissions to evaluate commands."; @@ -152,14 +156,16 @@ public void testApocConfWithoutExpandCommands() { when(neo4jConfig.getDeclaredSettings()).thenReturn(Collections.emptyMap()); when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.expandCommands()).thenReturn(false); - when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); +// when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); +// when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); ApocConfig apocConfig = new ApocConfig(neo4jConfig, new SimpleLogService(logProvider), registry, databaseManagementService); - setApocConfigSystemProperty(); +// setApocConfigSystemProperty(); RuntimeException e = assertThrows(RuntimeException.class, apocConfig::init); String expectedMessage = @@ -177,6 +183,8 @@ public void testMaxDecompressionRatioValidation() { when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.expandCommands()).thenReturn(false); when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); +// when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); diff --git a/common/src/test/java/apoc/ApocConfigTest.java b/common/src/test/java/apoc/ApocConfigTest.java index 1f0eb7820..b3ac92917 100644 --- a/common/src/test/java/apoc/ApocConfigTest.java +++ b/common/src/test/java/apoc/ApocConfigTest.java @@ -51,6 +51,7 @@ public void setup() throws Exception { when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.get(GraphDatabaseSettings.allow_file_urls)).thenReturn(false); when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); apocConfigFile = new File(getClass().getClassLoader().getResource("apoc.conf").toURI()); diff --git a/common/src/test/resources/apoc-config-command-expansion/apoc.conf b/common/src/test/resources/conf/apoc.conf similarity index 100% rename from common/src/test/resources/apoc-config-command-expansion/apoc.conf rename to common/src/test/resources/conf/apoc.conf From 485657789bdf3a51233ee9e74af2f01184b78b0f Mon Sep 17 00:00:00 2001 From: Joel Bergstrand Date: Wed, 8 Jan 2025 11:42:26 +0100 Subject: [PATCH 2/4] Fixed tests --- common/src/main/java/apoc/ApocConfig.java | 28 +------------- .../apoc/ApocConfigCommandExpansionTest.java | 37 ++++--------------- common/src/test/java/apoc/ApocConfigTest.java | 34 ++--------------- .../apoc.conf | 0 4 files changed, 11 insertions(+), 88 deletions(-) rename common/src/test/resources/{conf => apoc-config-command-expansion}/apoc.conf (100%) diff --git a/common/src/main/java/apoc/ApocConfig.java b/common/src/main/java/apoc/ApocConfig.java index 1b7fa22d7..040439a0e 100644 --- a/common/src/main/java/apoc/ApocConfig.java +++ b/common/src/main/java/apoc/ApocConfig.java @@ -44,7 +44,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.stream.Stream; import org.apache.commons.configuration2.CombinedConfiguration; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.EnvironmentConfiguration; @@ -189,32 +188,7 @@ public void init() { } protected String determineNeo4jConfFolder() { - return neo4jConfig.get(configuration_directory).resolve(Config.DEFAULT_CONFIG_DIR_NAME).toString(); -// String defaultPath =neo4jConfig.get(configuration_directory).toString(); //resolve(Config.DEFAULT_CONFIG_DIR_NAME).toString(); -// neo4jConfig -// .get(neo4j_home) -// .resolve(Config.DEFAULT_CONFIG_DIR_NAME) -// .toString(); -// String command = System.getProperty(SUN_JAVA_COMMAND); -// if (command == null) { -// log.warn( -// "system property %s is not set, assuming %s as conf dir. This might cause `apoc.conf` not getting loaded.", -// SUN_JAVA_COMMAND, defaultPath); -// return defaultPath; -// } else { -// final String neo4jConfFolder = Stream.of(command.split("--")) -// .map(String::trim) -// .filter(s -> s.startsWith(CONFIG_DIR)) -// .map(s -> s.substring(CONFIG_DIR.length())) -// .findFirst() -// .orElse(defaultPath); -// if (defaultPath.equals(neo4jConfFolder)) { -// log.info("cannot determine conf folder from sys property %s, assuming %s", command, defaultPath); -// } else { -// log.info("from system properties: NEO4J_CONF=%s", neo4jConfFolder); -// } -// return neo4jConfFolder; -// } + return neo4jConfig.get(configuration_directory).toString(); } /** diff --git a/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java b/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java index 95715c529..885aac6b2 100644 --- a/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java +++ b/common/src/test/java/apoc/ApocConfigCommandExpansionTest.java @@ -19,7 +19,6 @@ package apoc; import static apoc.ApocConfig.APOC_MAX_DECOMPRESSION_RATIO; -import static apoc.ApocConfig.SUN_JAVA_COMMAND; import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE; import static java.nio.file.attribute.PosixFilePermission.GROUP_READ; import static java.nio.file.attribute.PosixFilePermission.GROUP_WRITE; @@ -46,7 +45,6 @@ import java.util.Collections; import java.util.Set; import org.assertj.core.api.Assertions; -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.neo4j.configuration.Config; @@ -75,16 +73,16 @@ public void setup() throws Exception { when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.get(GraphDatabaseSettings.allow_file_urls)).thenReturn(false); when(neo4jConfig.expandCommands()).thenReturn(true); -// when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); apocConfigCommandExpansionFile = new File(getClass() .getClassLoader() - .getResource("apoc.conf") + .getResource("apoc-config-command-expansion/apoc.conf") .toURI()); Files.setPosixFilePermissions( apocConfigCommandExpansionFile.toPath(), permittedFilePermissionsForCommandExpansion); - when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)) + .thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); @@ -92,29 +90,14 @@ public void setup() throws Exception { new ApocConfig(neo4jConfig, new SimpleLogService(logProvider), registry, databaseManagementService); } - @After - public void cleanup() { - System.clearProperty(SUN_JAVA_COMMAND); - System.clearProperty(APOC_MAX_DECOMPRESSION_RATIO); - System.clearProperty("command.expansion"); - } - private void setApocConfigFilePermissions(Set forbidden) throws Exception { Files.setPosixFilePermissions( apocConfigCommandExpansionFile.toPath(), Sets.union(permittedFilePermissionsForCommandExpansion, forbidden)); } -// private void setApocConfigSystemProperty() { -// System.setProperty( -// SUN_JAVA_COMMAND, -// "com.neo4j.server.enterprise.CommercialEntryPoint --home-dir=/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02 --config-dir=" -// + apocConfigCommandExpansionFile.getParent()); -// } - @Test public void testApocConfWithExpandCommands() { -// setApocConfigSystemProperty(); apocConfig.init(); assertEquals("expanded value", apocConfig.getConfig().getString("command.expansion")); @@ -124,7 +107,6 @@ public void testApocConfWithExpandCommands() { public void testApocConfWithInvalidExpandCommands() throws Exception { String invalidExpandLine = "command.expansion.3=$(fakeCommand 3 + 3)"; addLineToApocConfig(invalidExpandLine); -// setApocConfigSystemProperty(); RuntimeException e = assertThrows(RuntimeException.class, apocConfig::init); String expectedMessage = @@ -138,7 +120,6 @@ public void testApocConfWithInvalidExpandCommands() throws Exception { public void testApocConfWithWrongFilePermissions() throws Exception { for (PosixFilePermission filePermission : forbiddenFilePermissionsForCommandExpansion) { setApocConfigFilePermissions(Set.of(filePermission)); -// setApocConfigSystemProperty(); RuntimeException e = assertThrows(RuntimeException.class, apocConfig::init); String expectedMessage = "does not have the correct file permissions to evaluate commands."; @@ -156,17 +137,14 @@ public void testApocConfWithoutExpandCommands() { when(neo4jConfig.getDeclaredSettings()).thenReturn(Collections.emptyMap()); when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.expandCommands()).thenReturn(false); -// when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); -// when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); - when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)) + .thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); ApocConfig apocConfig = new ApocConfig(neo4jConfig, new SimpleLogService(logProvider), registry, databaseManagementService); -// setApocConfigSystemProperty(); - RuntimeException e = assertThrows(RuntimeException.class, apocConfig::init); String expectedMessage = "$(echo \"expanded value\") is a command, but config is not explicitly told to expand it. (Missing --expand-commands argument?)"; @@ -182,9 +160,8 @@ public void testMaxDecompressionRatioValidation() { when(neo4jConfig.getDeclaredSettings()).thenReturn(Collections.emptyMap()); when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.expandCommands()).thenReturn(false); - when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); -// when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); - when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of(apocConfigCommandExpansionFile.getParent())); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)) + .thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0/conf")); GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); diff --git a/common/src/test/java/apoc/ApocConfigTest.java b/common/src/test/java/apoc/ApocConfigTest.java index b3ac92917..bfd9c0028 100644 --- a/common/src/test/java/apoc/ApocConfigTest.java +++ b/common/src/test/java/apoc/ApocConfigTest.java @@ -18,7 +18,6 @@ */ package apoc; -import static apoc.ApocConfig.SUN_JAVA_COMMAND; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -50,11 +49,11 @@ public void setup() throws Exception { when(neo4jConfig.getDeclaredSettings()).thenReturn(Collections.emptyMap()); when(neo4jConfig.get(any())).thenReturn(null); when(neo4jConfig.get(GraphDatabaseSettings.allow_file_urls)).thenReturn(false); - when(neo4jConfig.get(GraphDatabaseSettings.neo4j_home)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); - when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)).thenReturn(Path.of("C:/neo4j/neo4j-enterprise-5.x.0")); apocConfigFile = new File(getClass().getClassLoader().getResource("apoc.conf").toURI()); + when(neo4jConfig.get(GraphDatabaseSettings.configuration_directory)) + .thenReturn(Path.of(apocConfigFile.getParent())); GlobalProceduresRegistry registry = mock(GlobalProceduresRegistry.class); DatabaseManagementService databaseManagementService = mock(DatabaseManagementService.class); @@ -62,42 +61,15 @@ public void setup() throws Exception { new ApocConfig(neo4jConfig, new SimpleLogService(logProvider), registry, databaseManagementService); } - private void setApocConfigSystemProperty() { - System.setProperty( - SUN_JAVA_COMMAND, - "com.neo4j.server.enterprise.CommercialEntryPoint --home-dir=/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02 --config-dir=" - + apocConfigFile.getParent()); - } - @Test public void testDetermineNeo4jConfFolderDefault() { - System.setProperty(SUN_JAVA_COMMAND, ""); - assertEquals("C:/neo4j/neo4j-enterprise-5.x.0/conf", apocConfig.determineNeo4jConfFolder()); - } - - @Test - public void testDetermineNeo4jConfFolder() { - System.setProperty( - SUN_JAVA_COMMAND, - "com.neo4j.server.enterprise.CommercialEntryPoint --home-dir=/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02 --config-dir=/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02/conf"); - - assertEquals("/home/stefan/neo4j-enterprise-4.0.0-alpha09mr02/conf", apocConfig.determineNeo4jConfFolder()); + assertEquals(apocConfigFile.getParent(), apocConfig.determineNeo4jConfFolder()); } @Test public void testApocConfFileBeingLoaded() { - setApocConfigSystemProperty(); apocConfig.init(); assertEquals("bar", apocConfig.getConfig().getString("foo")); } - - @Test - public void testDetermineNeo4jConfFolderWithWhitespaces() { - System.setProperty( - SUN_JAVA_COMMAND, - "com.neo4j.server.enterprise.CommercialEntryPoint --config-dir=/home/stefan/neo4j enterprise-4.0.0-alpha09mr02/conf --home-dir=/home/stefan/neo4j enterprise-4.0.0-alpha09mr02"); - - assertEquals("/home/stefan/neo4j enterprise-4.0.0-alpha09mr02/conf", apocConfig.determineNeo4jConfFolder()); - } } diff --git a/common/src/test/resources/conf/apoc.conf b/common/src/test/resources/apoc-config-command-expansion/apoc.conf similarity index 100% rename from common/src/test/resources/conf/apoc.conf rename to common/src/test/resources/apoc-config-command-expansion/apoc.conf From afa7b7397c1883736544927e59c7625990b5e7a4 Mon Sep 17 00:00:00 2001 From: JoelBergstrand Date: Wed, 8 Jan 2025 11:53:15 +0100 Subject: [PATCH 3/4] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 13e29f99e..1b916b09a 100644 --- a/build.gradle +++ b/build.gradle @@ -170,7 +170,7 @@ apply from: "licenses-source-header.gradle" ext { publicDir = "${project.rootDir}" - neo4jVersionEffective = project.hasProperty("neo4jVersionOverride") ? project.getProperty("neo4jVersionOverride") : "2025.01.0-SNAPSHOT" + neo4jVersionEffective = project.hasProperty("neo4jVersionOverride") ? project.getProperty("neo4jVersionOverride") : "2025.01.0" testContainersVersion = '1.20.2' apacheArrowVersion = '15.0.0' } From 59d39bb1c907f5b9a06be04da168140cb386c3fa Mon Sep 17 00:00:00 2001 From: Joel Bergstrand Date: Tue, 14 Jan 2025 11:04:35 +0100 Subject: [PATCH 4/4] Updated comment --- common/src/main/java/apoc/ApocConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/apoc/ApocConfig.java b/common/src/main/java/apoc/ApocConfig.java index 040439a0e..b876328d0 100644 --- a/common/src/main/java/apoc/ApocConfig.java +++ b/common/src/main/java/apoc/ApocConfig.java @@ -173,8 +173,8 @@ private String evaluateIfCommand(String settingName, String entry) { @Override public void init() { log.debug("called init"); - // grab NEO4J_CONF from environment. If not set, calculate it from sun.java.command system property or Neo4j - // default + // Grab NEO4J_CONF from environment. + // If not set get it from database internal setting: "server.directories.configuration" String neo4jConfFolder = System.getenv().getOrDefault("NEO4J_CONF", determineNeo4jConfFolder()); System.setProperty("NEO4J_CONF", neo4jConfFolder); log.info("system property NEO4J_CONF set to %s", neo4jConfFolder);