Skip to content

Commit

Permalink
Get this test working (hapifhir#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesagnew authored Jan 31, 2019
1 parent 742dac2 commit 0c9fe20
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.java]
charset = utf-8
indent_style = space
indent_size = 2

4 changes: 2 additions & 2 deletions org.hl7.fhir.dstu3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

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;
Expand Down Expand Up @@ -195,9 +197,10 @@ public Base resolveReference(Object appContext, String url) {
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();

Expand All @@ -209,6 +212,10 @@ public static Iterable<Object[]> data() throws ParserConfigurationException, IOE
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public static String home() {
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;
Expand Down
14 changes: 10 additions & 4 deletions org.hl7.fhir.r4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static IWorkerContext context() {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ public long unPackage(InputStream tgz, List<PackageEntry> files) throws IOExcept
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++;
Expand Down
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 0c9fe20

Please sign in to comment.