Fix test ignore/exclude issues, bump test cases

This commit is contained in:
dotasek 2023-10-24 14:29:05 -04:00
parent 74a5c4cf43
commit 3ea42ca1b0
9 changed files with 55 additions and 20 deletions

View File

@ -5,6 +5,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@ -245,4 +246,7 @@ public class TestingUtilities {
return null;
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -5,6 +5,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@ -245,4 +246,8 @@ public class TestingUtilities {
return null;
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@ -276,5 +277,7 @@ public class TestingUtilities extends BaseTestingUtilities {
return null;
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -38,6 +38,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@ -528,4 +529,7 @@ public class TestingUtilities {
}
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -5,10 +5,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -499,4 +496,8 @@ public class TestingUtilities extends BaseTestingUtilities {
return path;
}
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.fhir.ucum.UcumEssenceService;
@ -175,5 +176,7 @@ public class TestingUtilities extends BaseTestingUtilities {
FilesystemPackageCacheManager.setPackageProvider(new TestingUtilities.PackageProvider());
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -4,11 +4,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
@ -27,11 +23,9 @@ import org.hl7.fhir.utilities.json.model.JsonObject;
import org.hl7.fhir.utilities.settings.FhirSettings;
import org.hl7.fhir.validation.special.TxTester;
import org.hl7.fhir.validation.special.TxTester.ITxTesterLoader;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.condition.EnabledIf;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@ -39,8 +33,7 @@ import org.junit.runners.Parameterized.Parameters;
import com.google.common.base.Charsets;
@RunWith(Parameterized.class)
@EnabledIf("localTxRunning")
@Disabled
public class LocalTerminologyServiceTests implements ITxTesterLoader {
public static class JsonObjectPair {
@ -60,6 +53,8 @@ public class LocalTerminologyServiceTests implements ITxTesterLoader {
return new File("/Users/grahamegrieve/work/server/serverx").exists();
}
@Parameters(name = "{index}: id {0}")
public static Iterable<Object[]> data() throws IOException {
@ -99,10 +94,16 @@ public class LocalTerminologyServiceTests implements ITxTesterLoader {
}
@SuppressWarnings("deprecation")
@Test
@Tag("excludedInSurefire")
@Disabled
@Test
public void test() throws Exception {
if (TestUtilities.runningAsSurefire()) {
logTestSkip("Running in surefire.");
return;
}
if (!localTxRunning()) {
logTestSkip("No local terminology server available.");
return;
}
if (SERVER != null) {
if (tester == null) {
tester = new TxTester(this, SERVER, true, externals);
@ -114,6 +115,10 @@ public class LocalTerminologyServiceTests implements ITxTesterLoader {
}
}
private void logTestSkip(String reason) {
System.out.println("Skipping test: " + setup.suite.asString("name") + " " + setup.test.asString("name") + " reason: " + reason);
}
public Resource loadResource(String filename) throws IOException, FHIRFormatError, FileNotFoundException, FHIRException, DefinitionException {
String contents = TestingUtilities.loadTestResource("tx", filename);
try (InputStream inputStream = IOUtils.toInputStream(contents, Charsets.UTF_8)) {

View File

@ -1,6 +1,7 @@
package org.hl7.fhir.validation.tests.utilities;
import java.nio.file.Paths;
import java.util.Locale;
import org.hl7.fhir.r5.context.TerminologyCache;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
@ -65,4 +66,8 @@ public class TestUtilities {
return validationEngine;
}
public static boolean runningAsSurefire() {
return "true".equals(System.getProperty("runningAsSurefire") != null ? System.getProperty("runningAsSurefire").toLowerCase(Locale.ENGLISH) : "");
}
}

View File

@ -20,7 +20,7 @@
<properties>
<guava_version>32.0.1-jre</guava_version>
<hapi_fhir_version>6.4.1</hapi_fhir_version>
<validator_test_case_version>1.4.12-SNAPSHOT</validator_test_case_version>
<validator_test_case_version>1.4.13-SNAPSHOT</validator_test_case_version>
<jackson_version>2.15.2</jackson_version>
<junit_jupiter_version>5.9.2</junit_jupiter_version>
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
@ -341,8 +341,13 @@
<argLine>@{argLine} -Xmx5632m</argLine>
<systemPropertyVariables>
<java.locale.providers>COMPAT</java.locale.providers>
<!-- For JUnit4 use TestUtilities.runningAsSurefire() or
TestingUtilities.runningAsSurefire() to exclude a test from surefire executions-->
<runningAsSurefire>true</runningAsSurefire>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<!-- For JUnit5 use an excludedInSurefire tag to exclude a test from surefire executions -->
<excludedGroups>excludedInSurefire</excludedGroups>
</configuration>
</plugin>