This commit is contained in:
markiantorno 2020-04-23 17:02:54 -04:00
parent 0ef4b01e90
commit 29d101fa09
4 changed files with 48 additions and 72 deletions

View File

@ -138,6 +138,7 @@
<version>${validator_test_case_version}</version> <version>${validator_test_case_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -1,21 +1,6 @@
package org.hl7.fhir.conversion.tests; package org.hl7.fhir.conversion.tests;
import java.io.ByteArrayInputStream; import com.google.gson.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.hl7.fhir.convertors.R3ToR4Loader; import org.hl7.fhir.convertors.R3ToR4Loader;
import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
@ -25,16 +10,8 @@ import org.hl7.fhir.r4.context.SimpleWorkerContext;
import org.hl7.fhir.r4.elementmodel.Element; import org.hl7.fhir.r4.elementmodel.Element;
import org.hl7.fhir.r4.elementmodel.Manager; import org.hl7.fhir.r4.elementmodel.Manager;
import org.hl7.fhir.r4.formats.IParser.OutputStyle; import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.r4.model.Base; import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.MetadataResource;
import org.hl7.fhir.r4.model.PractitionerRole;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.ResourceFactory;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.model.StructureMap;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.test.utils.TestingUtilities; import org.hl7.fhir.r4.test.utils.TestingUtilities;
import org.hl7.fhir.r4.utils.IResourceValidator; import org.hl7.fhir.r4.utils.IResourceValidator;
import org.hl7.fhir.r4.utils.IResourceValidator.IValidatorResourceFetcher; import org.hl7.fhir.r4.utils.IResourceValidator.IValidatorResourceFetcher;
@ -48,26 +25,26 @@ import org.hl7.fhir.utilities.cache.PackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion; import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.junit.Test; import org.junit.jupiter.api.Disabled;
import org.junit.runner.RunWith; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.runners.Parameterized; import org.junit.jupiter.params.provider.Arguments;
import org.junit.runners.Parameterized.Parameters; import org.junit.jupiter.params.provider.MethodSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.google.gson.Gson; import javax.xml.parsers.ParserConfigurationException;
import com.google.gson.GsonBuilder; import java.io.*;
import com.google.gson.JsonArray; import java.util.*;
import com.google.gson.JsonObject; import java.util.stream.Stream;
import com.google.gson.JsonPrimitive; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@RunWith(Parameterized.class) @Disabled
public class R3R4ConversionTests implements ITransformerServices, IValidatorResourceFetcher { public class R3R4ConversionTests implements ITransformerServices, IValidatorResourceFetcher {
private static final boolean SAVING = true; private static final boolean SAVING = true;
private PackageCacheManager pcm = null; private PackageCacheManager pcm = null;
@Parameters(name = "{index}: id {0}") public static Stream<Arguments> data() throws ParserConfigurationException, SAXException, IOException {
public static Iterable<Object[]> data() throws ParserConfigurationException, SAXException, IOException {
if (!(new File(Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "outcomes.json")).exists())) if (!(new File(Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "outcomes.json")).exists()))
throw new Error("You must set the default directory to the build directory when you execute these tests"); throw new Error("You must set the default directory to the build directory when you execute these tests");
r3r4Outcomes = (JsonObject) new com.google.gson.JsonParser().parse( r3r4Outcomes = (JsonObject) new com.google.gson.JsonParser().parse(
@ -97,13 +74,13 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
names.addAll(examples.keySet()); names.addAll(examples.keySet());
Collections.sort(names); Collections.sort(names);
List<Object[]> objects = new ArrayList<Object[]>(examples.size()); List<Arguments> objects = new ArrayList<>();
for (String id : names) { for (String id : names) {
objects.add(new Object[] { id, examples.get(id) }); objects.add(Arguments.of(id, examples.get(id)));
} }
return objects; return objects.stream();
} }
private static SimpleWorkerContext contextR3; private static SimpleWorkerContext contextR3;
@ -111,20 +88,14 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
private static JsonObject r3r4Outcomes; private static JsonObject r3r4Outcomes;
private static IniFile rules; private static IniFile rules;
private List<Resource> extras; private List<Resource> extras;
private final byte[] content;
private final String name;
private String workingid; private String workingid;
private static Map<String, Exception> loadErrors = new HashMap<String, Exception>(); private static Map<String, Exception> loadErrors = new HashMap<String, Exception>();
private static String filter; private static String filter;
public R3R4ConversionTests(String name, byte[] content) {
this.name = name;
this.content = content;
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Test @ParameterizedTest(name = "{index}: id {0}")
public void test() throws Exception { @MethodSource("data")
public void test(String name, byte[] content) throws Exception {
checkLoad(); checkLoad();
StructureMapUtilities smu4 = new StructureMapUtilities(contextR4, this); StructureMapUtilities smu4 = new StructureMapUtilities(contextR4, this);
StructureMapUtilities smu3 = new StructureMapUtilities(contextR3, this); StructureMapUtilities smu3 = new StructureMapUtilities(contextR3, this);

View File

@ -3,8 +3,10 @@ package org.hl7.fhir.validation.tests;
import org.hl7.fhir.r4.context.SimpleWorkerContext; import org.hl7.fhir.r4.context.SimpleWorkerContext;
import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.validation.Validator; import org.hl7.fhir.validation.Validator;
import org.junit.Test; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
public class CDAValidationTestCase { public class CDAValidationTestCase {
private SimpleWorkerContext context; private SimpleWorkerContext context;

View File

@ -5,8 +5,10 @@ import java.io.File;
import org.hl7.fhir.r4.test.utils.TestingUtilities; import org.hl7.fhir.r4.test.utils.TestingUtilities;
import org.hl7.fhir.validation.Validator; import org.hl7.fhir.validation.Validator;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.junit.Test; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
public class TransformationTests { public class TransformationTests {
@Test @Test