From 698849b9f2e861eac272976be610c436e4817b17 Mon Sep 17 00:00:00 2001 From: dotasek Date: Wed, 29 Nov 2023 14:48:18 -0500 Subject: [PATCH] Remove fhir-test-cases from Validator CLI JAR (#1497) * WIP drop fhir-test-cases from CLI jar * Fix missing JUnit4 tests, update to JUnit5 where possible * Fix unused import * Include hamcrest dependency * Fix breaking ValidationEngineTests * Give kinder error message for missing param --- .../org/hl7/fhir/utilities/IniFileTest.java | 4 ++- org.hl7.fhir.validation.cli/pom.xml | 31 +++++++++---------- .../fhir/validation/cli/tasks/TestsTask.java | 5 +++ .../validation/testexecutor/TestModules.java | 6 +++- .../StandAloneValidatorFetcherTests.java | 4 ++- .../tests/ValidationEngineTests.java | 4 +-- 6 files changed, 33 insertions(+), 21 deletions(-) diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/IniFileTest.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/IniFileTest.java index 8699c1c37..59f2f38cf 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/IniFileTest.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/IniFileTest.java @@ -1,6 +1,8 @@ package org.hl7.fhir.utilities; -import org.junit.Test; + + +import org.junit.jupiter.api.Test; import java.io.IOException; import java.nio.file.Files; diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index 1dd4ce376..134d4350e 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -76,14 +76,6 @@ option need to be included here. --> - - org.hl7.fhir.testcases - fhir-test-cases - ${validator_test_case_version} - compile - - - ca.uhn.hapi.fhir org.hl7.fhir.utilities @@ -220,14 +212,6 @@ compile - - org.everit.json org.everit.json.schema @@ -264,6 +248,20 @@ compile + + org.hamcrest + hamcrest-library + ${hamcrest_version} + compile + + + + org.hamcrest + hamcrest + ${hamcrest_version} + compile + + + ch.qos.logback logback-classic diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/tasks/TestsTask.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/tasks/TestsTask.java index 342b04fca..cbf08b05a 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/tasks/TestsTask.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/tasks/TestsTask.java @@ -40,6 +40,11 @@ public class TestsTask extends StandaloneTask{ final String testModuleParam = Params.getParam(args, Params.TEST_MODULES); final String testClassnameFilter = Params.getParam(args, Params.TEST_NAME_FILTER); final String testCasesDirectory = Params.getParam(args, Params.TEST); + if (testCasesDirectory == null) { + System.out.println("No fhir-test-cases directory provided. Required usage: -tests "); + System.exit(1); + } + final String txCacheDirectory = Params.getParam(args, Params.TERMINOLOGY_CACHE); assert TestExecutorParams.isValidModuleParam(testModuleParam) : "Invalid test module param: " + testModuleParam; final String[] moduleNamesArg = TestExecutorParams.parseModuleParam(testModuleParam); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/testexecutor/TestModules.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/testexecutor/TestModules.java index 91afdf92f..1b3150439 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/testexecutor/TestModules.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/testexecutor/TestModules.java @@ -17,5 +17,9 @@ public class TestModules { VALIDATION_MODULE }; - public static final List JUNIT4_CLASSNAMES = Arrays.asList("org.hl7.fhir.validation.tests.ValidationTests", "org.hl7.fhir.terminologies.tests.TerminologyServiceTests"); + public static final List JUNIT4_CLASSNAMES = Arrays.asList( + "org.hl7.fhir.terminology.tests.LocalTerminologyServiceTests", + "org.hl7.fhir.validation.tests.ValidationTests", + "org.hl7.fhir.terminology.tests.ExternalTerminologyServiceTests", + "org.hl7.fhir.terminology.tests.TerminologyServiceTests"); } diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcherTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcherTests.java index dd01462b5..9d11d8e89 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcherTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/StandAloneValidatorFetcherTests.java @@ -4,7 +4,9 @@ import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.terminologies.client.ITerminologyClient; import org.hl7.fhir.utilities.VersionUtil; import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; -import org.junit.Test; + +import org.junit.jupiter.api.Test; + import java.net.URISyntaxException; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java index 6f30fd303..0c87664d0 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java @@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test; public class ValidationEngineTests { -// private static final String DEF_TX = FhirSettings.getTxFhirDevelopment(); - private static final String DEF_TX = FhirSettings.getTxFhirLocal(); + private static final String DEF_TX = FhirSettings.getTxFhirDevelopment(); + //private static final String DEF_TX = FhirSettings.getTxFhirLocal(); public static boolean inbuild;