fix tests

This commit is contained in:
Grahame Grieve 2019-01-23 09:28:30 +11:00
parent aaa9827cad
commit d48800c056
2 changed files with 12 additions and 1 deletions

View File

@ -2028,7 +2028,7 @@
<label value="test4-1"/> <label value="test4-1"/>
<description value="The patient.identifier documentation must be right"/> <description value="The patient.identifier documentation must be right"/>
<direction value="response"/> <direction value="response"/>
<expression value="fixture('t4o').snapshot.element.where(path = 'Patient.identifier').doco.trace('doco') != '... some more doco'"/> <expression value="fixture('t4o').snapshot.element.where(path = 'Patient.identifier').definition.trace('definition') != '... some more doco'"/>
<warningOnly value="false"/> <warningOnly value="false"/>
</assert> </assert>
</action> </action>

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.r4.test; package org.hl7.fhir.r4.test;
import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -311,6 +312,7 @@ public class SnapShotGenerationTests {
StructureDefinition extd = TestingUtilities.context().fetchResource(StructureDefinition.class, sd.getBaseDefinition()); StructureDefinition extd = TestingUtilities.context().fetchResource(StructureDefinition.class, sd.getBaseDefinition());
new ProfileUtilities(TestingUtilities.context(), null, null).generateSnapshot(extd, sd, sd.getUrl(), sd.getName()); new ProfileUtilities(TestingUtilities.context(), null, null).generateSnapshot(extd, sd, sd.getUrl(), sd.getName());
TestingUtilities.context().cacheResource(sd); TestingUtilities.context().cacheResource(sd);
debugSaveResource(sd);
} }
} }
} }
@ -339,6 +341,7 @@ public class SnapShotGenerationTests {
throw new FHIRException("Sort failed: "+errors.toString()); throw new FHIRException("Sort failed: "+errors.toString());
} }
pu.generateSnapshot(base, output, source.getUrl(), source.getName()); pu.generateSnapshot(base, output, source.getUrl(), source.getName());
debugSaveResource(output);
context.fixtures.put(op.getResponseId(), output); context.fixtures.put(op.getResponseId(), output);
context.snapshots.put(output.getUrl(), output); context.snapshots.put(output.getUrl(), output);
@ -378,6 +381,14 @@ public class SnapShotGenerationTests {
} }
private void debugSaveResource(Resource r) throws IOException {
String dir = System.getProperty("java.io.tmpdir");
if (new File("c:\\temp").exists())
dir = "c:\\temp";
String fn = Utilities.path(dir, r.fhirType()+"-"+r.getId()+".xml");
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), r);
}
private StructureDefinition getSD(String url) throws DefinitionException, FHIRException { private StructureDefinition getSD(String url) throws DefinitionException, FHIRException {
StructureDefinition sd = context.snapshots.get(url); StructureDefinition sd = context.snapshots.get(url);
if (sd == null) if (sd == null)