Get this test working (#4)

This commit is contained in:
James Agnew 2019-01-31 13:41:05 -05:00 committed by GitHub
parent 742dac277a
commit 0c9fe20522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 10 deletions

5
.editorconfig Normal file
View File

@ -0,0 +1,5 @@
[*.java]
charset = utf-8
indent_style = space
indent_size = 2

View File

@ -17,11 +17,11 @@
<!-- HAPI Dependencies -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<artifactId>org.hl7.fhir.utilities</artifactId>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.utilities</artifactId>
<artifactId>hapi-fhir-base</artifactId>
</dependency>
<!-- UCUM -->

View File

@ -13,6 +13,8 @@ import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.codec.Charsets;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
@ -195,9 +197,10 @@ public class SnapShotGenerationTests {
private static FHIRPathEngine fp;
@Parameters(name = "{index}: file {0}")
public static Iterable<Object[]> data() throws ParserConfigurationException, IOException, FHIRFormatError {
public static Iterable<Object[]> data() throws IOException, FHIRFormatError {
SnapShotGenerationTestsContext context = new SnapShotGenerationTestsContext();
context.tests = (TestScript) new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.home(), "tests", "resources", "snapshot-generation-tests.xml")));
String contents = readFileFromClasspathAsString("snapshot-generation-tests.xml");
context.tests = (TestScript) new XmlParser().parse(contents);
context.checkTestsDetails();
@ -209,6 +212,10 @@ public class SnapShotGenerationTests {
return objects;
}
private static String readFileFromClasspathAsString(String theClasspath) throws IOException {
return IOUtils.toString(SnapShotGenerationTests.class.getResourceAsStream(theClasspath), Charsets.UTF_8);
}
private final TestScriptTestComponent test;
private final String name;

View File

@ -43,6 +43,9 @@ public class TestingUtilities {
String s = System.getenv("FHIR_HOME");
if (!Utilities.noString(s))
return s;
s = System.getProperty("FHIR_HOME");
if (!Utilities.noString(s))
return s;
s = "C:\\work\\org.hl7.fhir\\build";
if (new File(s).exists())
return s;

View File

@ -15,14 +15,20 @@
<dependencies>
<!-- HAPI Dependencies -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.utilities</artifactId>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<exclusions>
<exclusion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- UCUM -->
<dependency>

View File

@ -66,6 +66,7 @@ public class TestingUtilities {
PackageCacheManager pcm;
try {
pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
pcm.resolvePackage("hl7.fhir.core", "4.0.0", "4.0.1"); // FIXME: JA How to get the current version?
fcontext = SimpleWorkerContext.fromPackage(pcm.loadPackageCache("hl7.fhir.core", "4.0.0"));
fcontext.setUcumService(new UcumEssenceService(TestingUtilities.resourceNameToFile("ucum", "ucum-essence.xml")));
fcontext.setExpansionProfile(new Parameters());

View File

@ -393,7 +393,8 @@ public class PackageCacheManager {
private void analysePackage(String dir, String v, Map<String, String> profiles, Map<String, String> canonicals) throws IOException {
int i = 0;
int c = 11;
for (File f : new File(Utilities.path(dir, "package")).listFiles()) {
File[] packages = new File(Utilities.path(dir, "package")).listFiles();
for (File f : packages) {
i++;
if (progress && i % 20 == 0) {
c++;

View File

@ -74,11 +74,17 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>${hapi_fhir_version}</version>
<exclusions>
<exclusion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.utilities</artifactId>
<version>${hapi_fhir_version}</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>