From 37dccf322a9173eb29ada978b91557771c5a58a5 Mon Sep 17 00:00:00 2001 From: James Rosewell Date: Mon, 16 Nov 2026 11:07:57 +0000 Subject: [PATCH] Fix: build the Device Detection example tests from a fresh clone, through the examples' own helpers --- .../examples/console/GettingStartedOnPremTest.java | 6 ++---- .../examples/console/ManualDataUpdateTest.java | 8 +++----- .../examples/console/MetadataOnPremTest.java | 7 +++---- .../examples/console/OfflineProcessingTest.java | 9 +++------ .../examples/console/UpdateDataFileTest.java | 6 +++--- .../examples/web/GettingStartedWebOnPremTest.java | 7 ++----- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/GettingStartedOnPremTest.java b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/GettingStartedOnPremTest.java index 4584988a4..7ceb26b14 100644 --- a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/GettingStartedOnPremTest.java +++ b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/GettingStartedOnPremTest.java @@ -22,17 +22,15 @@ package fiftyone.devicedetection.examples.console; +import fiftyone.devicedetection.examples.shared.DataFileHelper; import fiftyone.devicedetection.examples.shared.EvidenceHelper; -import fiftyone.devicedetection.shared.testhelpers.TestFileUtils; import org.junit.Test; public class GettingStartedOnPremTest { @Test public void gettingStartedOnPremTest() throws Exception { - GettingStartedOnPrem.run(TestFileUtils.getHashFileName() == null - ? TestFileUtils.LITE_HASH_DATA_FILE_PATH - : TestFileUtils.getHashFileName(), + GettingStartedOnPrem.run(DataFileHelper.getDataFileLocation(null), EvidenceHelper.setUpEvidence(), System.out); } } \ No newline at end of file diff --git a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/ManualDataUpdateTest.java b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/ManualDataUpdateTest.java index 24cead133..b33d91b5a 100644 --- a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/ManualDataUpdateTest.java +++ b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/ManualDataUpdateTest.java @@ -22,7 +22,7 @@ package fiftyone.devicedetection.examples.console; -import fiftyone.devicedetection.shared.testhelpers.TestFileUtils; +import fiftyone.devicedetection.examples.shared.DataFileHelper; import org.junit.Test; import java.io.ByteArrayOutputStream; @@ -42,10 +42,8 @@ public class ManualDataUpdateTest { @Test public void manualDataUpdate_ReloadsTheDataFile() throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - ManualDataUpdate.run(TestFileUtils.getHashFileName() == null - ? TestFileUtils.LITE_HASH_DATA_FILE_PATH - : TestFileUtils.getHashFileName(), - buffer); + ManualDataUpdate.run( + DataFileHelper.getDataFileLocation(null), buffer); String output = buffer.toString("UTF-8"); System.out.println(output); diff --git a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/MetadataOnPremTest.java b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/MetadataOnPremTest.java index ffbc67a2d..cc2fa6573 100644 --- a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/MetadataOnPremTest.java +++ b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/MetadataOnPremTest.java @@ -22,14 +22,13 @@ package fiftyone.devicedetection.examples.console; -import fiftyone.devicedetection.shared.testhelpers.TestFileUtils; +import fiftyone.devicedetection.examples.shared.DataFileHelper; import org.junit.Test; public class MetadataOnPremTest { @Test public void gettingMetaDataOnPremTest() throws Exception { - MetadataOnPrem.run(TestFileUtils.getHashFileName() == null - ? TestFileUtils.LITE_HASH_DATA_FILE_PATH - : TestFileUtils.getHashFileName(), System.out); + MetadataOnPrem.run( + DataFileHelper.getDataFileLocation(null), System.out); } } \ No newline at end of file diff --git a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/OfflineProcessingTest.java b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/OfflineProcessingTest.java index 54605a354..15d517f04 100644 --- a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/OfflineProcessingTest.java +++ b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/OfflineProcessingTest.java @@ -22,19 +22,16 @@ package fiftyone.devicedetection.examples.console; -import fiftyone.devicedetection.shared.testhelpers.TestFileUtils; +import fiftyone.devicedetection.examples.shared.DataFileHelper; import org.junit.Test; import java.io.FileInputStream; -import java.util.Objects; public class OfflineProcessingTest { @Test public void offlineProcessingTest() throws Exception { - OfflineProcessing.run(TestFileUtils.getHashFileName() == null - ? TestFileUtils.LITE_HASH_DATA_FILE_PATH - : TestFileUtils.getHashFileName(), - new FileInputStream(Objects.requireNonNull(TestFileUtils.getEvidenceFile())), + OfflineProcessing.run(DataFileHelper.getDataFileLocation(null), + new FileInputStream(DataFileHelper.getEvidenceFile(null)), System.out); } diff --git a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/UpdateDataFileTest.java b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/UpdateDataFileTest.java index 1c37b8d11..d05d8061d 100644 --- a/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/UpdateDataFileTest.java +++ b/examples/device-detection/console/src/test/java/fiftyone/devicedetection/examples/console/UpdateDataFileTest.java @@ -22,7 +22,7 @@ package fiftyone.devicedetection.examples.console; -import fiftyone.devicedetection.shared.testhelpers.TestKeyUtils; +import fiftyone.devicedetection.examples.shared.KeyHelper; import org.junit.Test; import static fiftyone.devicedetection.examples.console.UpdateDataFile.run; @@ -33,9 +33,9 @@ public class UpdateDataFileTest { @Test public void updateExampleTest () throws Exception { - String licenseKey = TestKeyUtils.getNamedKey(UpdateDataFile.UPDATE_EXAMPLE_LICENSE_KEY_NAME); + String licenseKey = KeyHelper.getNamedKey(UpdateDataFile.UPDATE_EXAMPLE_LICENSE_KEY_NAME); assumeFalse("Skipping test, no license key found", - TestKeyUtils.isInvalidKey(licenseKey)); + KeyHelper.isInvalidKey(licenseKey)); try { run(null, licenseKey, false); } catch (IllegalStateException e) { diff --git a/examples/device-detection/web/getting-started.onprem/src/test/java/fiftyone/devicedetection/examples/web/GettingStartedWebOnPremTest.java b/examples/device-detection/web/getting-started.onprem/src/test/java/fiftyone/devicedetection/examples/web/GettingStartedWebOnPremTest.java index e24c4a0c3..8de867e3f 100644 --- a/examples/device-detection/web/getting-started.onprem/src/test/java/fiftyone/devicedetection/examples/web/GettingStartedWebOnPremTest.java +++ b/examples/device-detection/web/getting-started.onprem/src/test/java/fiftyone/devicedetection/examples/web/GettingStartedWebOnPremTest.java @@ -24,7 +24,6 @@ import fiftyone.devicedetection.examples.shared.DataFileHelper; import fiftyone.devicedetection.examples.shared.FindOutMore; -import fiftyone.devicedetection.shared.testhelpers.TestFileUtils; import org.eclipse.jetty.server.Server; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -47,10 +46,8 @@ public class GettingStartedWebOnPremTest { public static void startJetty() throws Exception { // With no Enterprise file, the free Lite file is found, or // downloaded, as the example finds it, so a fresh clone runs this. - System.setProperty("TestDataFile", TestFileUtils.getHashFile() == null - ? DataFileHelper.findDataFile( - TestFileUtils.LITE_HASH_DATA_FILE_PATH).getAbsolutePath() - : TestFileUtils.getHashFile().getAbsolutePath()); + System.setProperty( + "TestDataFile", DataFileHelper.getDataFileLocation(null)); SERVER = EmbedJetty.startWebApp(getFilePath(resourceBase).getAbsolutePath(), 8081); }