From 5629052761c1e60f057bbc2260c36a98f9ff5c89 Mon Sep 17 00:00:00 2001 From: Jan van Mansum Date: Tue, 19 Nov 2024 12:42:51 +0100 Subject: [PATCH] Also look for example properties from root of dans-core-systems --- .../main/java/nl/knaw/dans/lib/dataverse/ExampleBase.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/src/main/java/nl/knaw/dans/lib/dataverse/ExampleBase.java b/examples/src/main/java/nl/knaw/dans/lib/dataverse/ExampleBase.java index d66c6a493..84c981082 100644 --- a/examples/src/main/java/nl/knaw/dans/lib/dataverse/ExampleBase.java +++ b/examples/src/main/java/nl/knaw/dans/lib/dataverse/ExampleBase.java @@ -22,6 +22,8 @@ import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Path; public abstract class ExampleBase { @@ -30,7 +32,9 @@ public abstract class ExampleBase { static { try { - PropertiesConfiguration props = new PropertiesConfiguration("examples/dataverse.properties"); + String propsFiles = Files.exists(Path.of("examples/dataverse.properties")) ? + "examples/dataverse.properties" : "modules/dans-dataverse-client-lib/examples/dataverse.properties"; + PropertiesConfiguration props = new PropertiesConfiguration(propsFiles); DataverseClientConfig config = new DataverseClientConfig(new URI(props.getString("baseUrl")), props.getString("apiToken"), props.getString("unblockKey", null)); client = new DataverseClient(config); }