wip
This commit is contained in:
parent
0ef4b01e90
commit
29d101fa09
|
@ -138,6 +138,7 @@
|
|||
<version>${validator_test_case_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
package org.hl7.fhir.conversion.tests;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
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 com.google.gson.*;
|
||||
import org.hl7.fhir.convertors.R3ToR4Loader;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
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.Manager;
|
||||
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.r4.model.Base;
|
||||
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.*;
|
||||
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.utils.IResourceValidator;
|
||||
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.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@Disabled
|
||||
public class R3R4ConversionTests implements ITransformerServices, IValidatorResourceFetcher {
|
||||
|
||||
private static final boolean SAVING = true;
|
||||
private PackageCacheManager pcm = null;
|
||||
|
||||
@Parameters(name = "{index}: id {0}")
|
||||
public static Iterable<Object[]> data() throws ParserConfigurationException, SAXException, IOException {
|
||||
public static Stream<Arguments> data() throws ParserConfigurationException, SAXException, IOException {
|
||||
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");
|
||||
r3r4Outcomes = (JsonObject) new com.google.gson.JsonParser().parse(
|
||||
|
@ -97,13 +74,13 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
|
|||
names.addAll(examples.keySet());
|
||||
Collections.sort(names);
|
||||
|
||||
List<Object[]> objects = new ArrayList<Object[]>(examples.size());
|
||||
List<Arguments> objects = new ArrayList<>();
|
||||
|
||||
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;
|
||||
|
@ -111,20 +88,14 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
|
|||
private static JsonObject r3r4Outcomes;
|
||||
private static IniFile rules;
|
||||
private List<Resource> extras;
|
||||
private final byte[] content;
|
||||
private final String name;
|
||||
private String workingid;
|
||||
private static Map<String, Exception> loadErrors = new HashMap<String, Exception>();
|
||||
private static String filter;
|
||||
|
||||
public R3R4ConversionTests(String name, byte[] content) {
|
||||
this.name = name;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
@ParameterizedTest(name = "{index}: id {0}")
|
||||
@MethodSource("data")
|
||||
public void test(String name, byte[] content) throws Exception {
|
||||
checkLoad();
|
||||
StructureMapUtilities smu4 = new StructureMapUtilities(contextR4, this);
|
||||
StructureMapUtilities smu3 = new StructureMapUtilities(contextR3, this);
|
||||
|
@ -153,7 +124,7 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
|
|||
tn + "-" + workingid + ".input.json"));
|
||||
}
|
||||
|
||||
String mapFile = Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R3toR4", r3.fhirType()+".map");
|
||||
String mapFile = Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R3toR4", r3.fhirType() + ".map");
|
||||
if (new File(mapFile).exists()) {
|
||||
StructureMap sm = smu4.parse(TextFile.fileToString(mapFile), mapFile);
|
||||
|
||||
|
@ -183,7 +154,7 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
|
|||
validator.validate(null, r4validationErrors, r4);
|
||||
|
||||
// load the R4 to R3 map
|
||||
mapFile = Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R4toR3", getMapFor(r4.fhirType(), r3.fhirType())+".map");
|
||||
mapFile = Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R4toR3", getMapFor(r4.fhirType(), r3.fhirType()) + ".map");
|
||||
sm = smu3.parse(TextFile.fileToString(mapFile), mapFile);
|
||||
|
||||
// convert to R3
|
||||
|
@ -321,7 +292,7 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso
|
|||
contextR3 = new SimpleWorkerContext();
|
||||
contextR3.setAllowLoadingDuplicates(true);
|
||||
contextR3.setOverrideVersionNs("http://hl7.org/fhir/3.0/StructureDefinition");
|
||||
contextR3.loadFromPackage(pcm.loadPackage("hl7.fhir.core", "3.0.1"), ldr, new String[] {});
|
||||
contextR3.loadFromPackage(pcm.loadPackage("hl7.fhir.core", "3.0.1"), ldr, new String[]{});
|
||||
|
||||
System.out.println("loading R4");
|
||||
contextR4 = new SimpleWorkerContext();
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.hl7.fhir.validation.tests;
|
|||
import org.hl7.fhir.r4.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
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 {
|
||||
|
||||
private SimpleWorkerContext context;
|
||||
|
|
|
@ -5,8 +5,10 @@ import java.io.File;
|
|||
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.validation.Validator;
|
||||
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 {
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue