#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Fix form detection download gate test (#8019)
Anthony Stirling1bee71a5dd25
diff --git a/app/proprietary/src/test/java/stirling/software/proprietary/formdetection/service/FormDetectionModelManagerTest.java b/app/proprietary/src/test/java/stirling/software/proprietary/formdetection/service/FormDetectionModelManagerTest.javaindex b4995072b6..7f68036842 100644--- a/app/proprietary/src/test/java/stirling/software/proprietary/formdetection/service/FormDetectionModelManagerTest.java+++ b/app/proprietary/src/test/java/stirling/software/proprietary/formdetection/service/FormDetectionModelManagerTest.java@@ -393,12 +393,12 @@ class FormDetectionModelManagerTest {@Testvoid gatesTheToolWhileASwitchIsDownloading(@TempDir Path dir) throws Exception {- CountDownLatch gate = new CountDownLatch(1);+ CountDownLatch releaseDownload = new CountDownLatch(1);server.createContext("/switch.onnx",ex -> {try {- gate.await(5, TimeUnit.SECONDS);+ releaseDownload.await();} catch (InterruptedException ignored) {Thread.currentThread().interrupt();}@@ -406,9 +406,9 @@ class FormDetectionModelManagerTest {ex.getResponseBody().write(modelBytes);ex.close();});- Files.write(dir.resolve("test-model.onnx"), modelBytes);+ Files.write(dir.resolve("active-model.onnx"), modelBytes);ApplicationProperties props = new ApplicationProperties();- props.getFormDetection().setActiveModelId("test-model");+ props.getFormDetection().setActiveModelId("active-model");EndpointConfiguration ep = Mockito.mock(EndpointConfiguration.class);FormDetectionModelManager m =manager(dir, entry(ALLOWED_URL + "/switch.onnx", modelSha), ep, props);@@ -417,10 +417,13 @@ class FormDetectionModelManagerTest {m.startInstall("test-model");- assertFalse(m.isReady(), "a download is not something the tool can serve from");- Mockito.verify(ep).disableEndpoint("form-detection", DisableReason.DEPENDENCY);+ try {+ assertFalse(m.isReady(), "a download is not something the tool can serve from");+ Mockito.verify(ep).disableEndpoint("form-detection", DisableReason.DEPENDENCY);+ } finally {+ releaseDownload.countDown();+ }- gate.countDown();- awaitState(m, "ready", 5000);+ awaitState(m, "ready", 10000);}}