This commit is contained in:
markiantorno 2020-04-29 14:55:47 -04:00
parent 5893249747
commit 1086a46a6c
1 changed files with 20 additions and 32 deletions

View File

@ -1,34 +1,28 @@
package org.hl7.fhir.r5.test.misc;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.model.StructureMap;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.r5.utils.StructureMapUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.junit.Test;
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.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import junit.framework.Assert;
import javax.xml.parsers.ParserConfigurationException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
@RunWith(Parameterized.class)
@Disabled
public class StructureMapTests {
@Parameters(name = "{index}: file {0}")
public static Iterable<Object[]> data() throws ParserConfigurationException, IOException, FHIRFormatError {
public static Stream<Arguments> data() throws ParserConfigurationException, IOException, FHIRFormatError {
List<String> files = new ArrayList<>();
// File dir = new File(Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R3toR4"));
// for (File f : dir.listFiles())
@ -38,22 +32,16 @@ public class StructureMapTests {
// for (File f : dir.listFiles())
// if (f.getName().endsWith(".map"))
// files.add(f.getAbsolutePath());
List<Object[]> objects = new ArrayList<Object[]>(files.size());
//
List<Arguments> objects = new ArrayList<>();
// for (String fn : files) {
// objects.add(new Object[] { new File(fn).getName(), fn });
// }
return objects;
return objects.stream();
}
private String filename;
public StructureMapTests(String name, String filename) {
this.filename = filename;
}
@SuppressWarnings("deprecation")
@Test
public void test() throws FHIRException, FileNotFoundException, IOException {
@ParameterizedTest
@MethodSource("data")
public void test(String name, String filename) throws FHIRException, FileNotFoundException, IOException {
// if (TestingUtilities.context == null) {
// TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.content(), "definitions.xml.zip"));
// }
@ -68,7 +56,7 @@ public class StructureMapTests {
// String s = TestingUtilities.checkTextIsSame(source, output);
// Assert.assertTrue(s, s == null);
}
// private void testParse(String path) throws FileNotFoundException, IOException, FHIRException {
// if (TestingUtilities.context == null)
// TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.content(), "definitions.xml.zip"));
@ -77,7 +65,7 @@ public class StructureMapTests {
// StructureMap map = scm.parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), path)), path);
// TextFile.stringToFile(scm.render(map), Utilities.path(TestingUtilities.home(), path+".out"));
// }
// @Test
// public void testParseAny() throws FHIRException, IOException {
// testParse("guides\\ccda2\\mapping\\map\\any.map");