commit
dc6f04c512
|
@ -1 +1,8 @@
|
|||
* fix for issue 383
|
||||
Validator Changes:
|
||||
* no effective changes
|
||||
|
||||
Other Code Changes:
|
||||
* fix bug converting type mode in Structure Map
|
||||
* fix bug converting Timing.when (issue 383)
|
||||
* fix bug doing date time comparisons with seconds in FHIRPath
|
||||
* Add support for instance-name and instance-description extensions
|
|
@ -3,6 +3,7 @@ package org.hl7.fhir.convertors.conv40_50;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -220,8 +221,11 @@ public class StructureMap40_50 extends VersionConvertor_40_50 {
|
|||
tgt.setNameElement(convertId(src.getNameElement()));
|
||||
if (src.hasExtends())
|
||||
tgt.setExtendsElement(convertId(src.getExtendsElement()));
|
||||
if (src.hasTypeMode())
|
||||
if (src.hasTypeMode()) {
|
||||
tgt.setTypeModeElement(convertStructureMapGroupTypeMode(src.getTypeModeElement()));
|
||||
} else {
|
||||
tgt.setTypeMode(StructureMapGroupTypeMode.NONE);
|
||||
}
|
||||
if (src.hasDocumentation())
|
||||
tgt.setDocumentationElement(convertString(src.getDocumentationElement()));
|
||||
for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) tgt.addInput(convertStructureMapGroupInputComponent(t));
|
||||
|
|
|
@ -812,6 +812,10 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
return loadedPackages.contains(id+"#"+ver);
|
||||
}
|
||||
|
||||
public boolean hasPackage(String idAndver) {
|
||||
return loadedPackages.contains(idAndver);
|
||||
}
|
||||
|
||||
public void setClock(TimeTracker tt) {
|
||||
clock = tt;
|
||||
}
|
||||
|
|
|
@ -899,16 +899,12 @@ public abstract class BaseDateTimeType extends PrimitiveType<Date> {
|
|||
lowRight = lowRight - (14 * DateUtils.MILLIS_PER_HOUR);
|
||||
highRight = highRight + (14 * DateUtils.MILLIS_PER_HOUR);
|
||||
}
|
||||
System.out.print("["+((lowLeft / 1000) - 130000000)+"-"+((highLeft / 1000) - 130000000)+"] vs ["+((lowRight / 1000) - 130000000)+"-"+((highRight / 1000) - 130000000)+"] = ");
|
||||
if (highRight < lowLeft) {
|
||||
System.out.println("false");
|
||||
return false;
|
||||
}
|
||||
if (highLeft < lowRight) {
|
||||
System.out.println("false");
|
||||
return false;
|
||||
}
|
||||
System.out.println("true");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1000,6 +996,14 @@ public abstract class BaseDateTimeType extends PrimitiveType<Date> {
|
|||
return def;
|
||||
}
|
||||
|
||||
if (left.getSecond() < right.getSecond()) {
|
||||
return -1;
|
||||
} else if (left.getSecond() > right.getSecond()) {
|
||||
return 1;
|
||||
} else if (left.getPrecision() == TemporalPrecisionEnum.SECOND && right.getPrecision() == TemporalPrecisionEnum.SECOND) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (left.getSecondsMilli() < right.getSecondsMilli()) {
|
||||
return -1;
|
||||
} else if (left.getSecondsMilli() > right.getSecondsMilli()) {
|
||||
|
|
|
@ -523,7 +523,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
InputStream stream = fetchFromUrlSpecific(Utilities.pathURL("http://build.fhir.org", id + ".tgz"), false);
|
||||
return new InputStreamWithSrc(stream, Utilities.pathURL("http://build.fhir.org", id + ".tgz"), "current");
|
||||
} else {
|
||||
throw new FHIRException("The package '" + id + "' has not entry on the current build server");
|
||||
throw new FHIRException("The package '" + id + "' has no entry on the current build server");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1087,6 +1087,12 @@ public class NpmPackage {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (Utilities.existsInList(name(), "fhir.test.data.r2", "fhir.test.data.r3", "fhir.test.data.r4", "fhir.tx.support.r2", "fhir.tx.support.r3", "fhir.tx.support.r4", "us.nlm.vsac")) {
|
||||
return true;
|
||||
}
|
||||
if (JSONUtil.bool(npm, "lazy-load")) {
|
||||
return true;
|
||||
}
|
||||
if (!hasFile("other", "spec.internals")) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
|
||||
public class XhtmlParser {
|
||||
public static final String XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
private static final char END_OF_CHARS = (char) -1;
|
||||
|
||||
public class NSMap {
|
||||
private Map<String, String> nslist = new HashMap<String, String>();
|
||||
|
@ -515,7 +516,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
private void parseElementInner(XhtmlNode node, List<XhtmlNode> parents, NSMap nsm, boolean escaping) throws FHIRFormatError, IOException
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
while (peekChar() != '\0' && !parents.contains(unwindPoint) && !(node == unwindPoint))
|
||||
while (peekChar() != END_OF_CHARS && !parents.contains(unwindPoint) && !(node == unwindPoint))
|
||||
{
|
||||
if (peekChar() == '<')
|
||||
{
|
||||
|
@ -606,7 +607,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
{
|
||||
while (Character.isWhitespace(peekChar()))
|
||||
readChar();
|
||||
while (peekChar() != '>' && peekChar() != '/' && peekChar() != '\0')
|
||||
while (peekChar() != '>' && peekChar() != '/' && peekChar() != END_OF_CHARS)
|
||||
{
|
||||
String name = readName();
|
||||
if (name.length() == 0)
|
||||
|
@ -630,7 +631,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
if (peekChar() == '"' || peekChar() == '\'')
|
||||
node.getAttributes().put(name, parseAttributeValue(readChar()));
|
||||
else
|
||||
node.getAttributes().put(name, parseAttributeValue('\0'));
|
||||
node.getAttributes().put(name, parseAttributeValue(END_OF_CHARS));
|
||||
}
|
||||
while (Character.isWhitespace(peekChar()))
|
||||
readChar();
|
||||
|
@ -640,7 +641,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
private String parseAttributeValue(char term) throws IOException, FHIRFormatError
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
while (peekChar() != '\0' && peekChar() != '>' && (term != '\0' || peekChar() != '/') && peekChar() != term)
|
||||
while (peekChar() != END_OF_CHARS && peekChar() != '>' && (term != END_OF_CHARS || peekChar() != '/') && peekChar() != term)
|
||||
{
|
||||
if (peekChar() == '&')
|
||||
{
|
||||
|
@ -704,15 +705,15 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
if (cache.length() > 0)
|
||||
return cache.charAt(0);
|
||||
else if (!rdr.ready())
|
||||
return '\0';
|
||||
return END_OF_CHARS;
|
||||
else
|
||||
{
|
||||
char c = (char)rdr.read();
|
||||
if (c == (char)-1)
|
||||
{
|
||||
int i = rdr.read();
|
||||
if (i == -1) {
|
||||
cache = "";
|
||||
return '\0';
|
||||
return END_OF_CHARS;
|
||||
}
|
||||
char c = (char) i;
|
||||
cache = Character.toString(c);
|
||||
return c;
|
||||
}
|
||||
|
@ -727,7 +728,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
cache = cache.length() == 1 ? "" : cache.substring(1);
|
||||
}
|
||||
else if (!rdr.ready())
|
||||
c = '\0';
|
||||
c = END_OF_CHARS;
|
||||
else
|
||||
c = (char)rdr.read();
|
||||
if (c == '\r' || c == '\n') {
|
||||
|
@ -744,9 +745,9 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
private String readToTagEnd() throws IOException, FHIRFormatError
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
while (peekChar() != '>' && peekChar() != '\0')
|
||||
while (peekChar() != '>' && peekChar() != END_OF_CHARS)
|
||||
s.append(readChar());
|
||||
if (peekChar() != '\0')
|
||||
if (peekChar() != END_OF_CHARS)
|
||||
{
|
||||
readChar();
|
||||
skipWhiteSpace();
|
||||
|
@ -765,7 +766,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
if (c == '>') {
|
||||
done = true;
|
||||
readChar();
|
||||
} else if (c != '\0')
|
||||
} else if (c != END_OF_CHARS)
|
||||
s.append(readChar());
|
||||
else if (mustBeWellFormed)
|
||||
throw new FHIRFormatError("Unexpected termination of html source"+descLoc());
|
||||
|
@ -814,12 +815,12 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
|
|||
} else if (c == '[' && s.toString().startsWith("DOCTYPE ")) {
|
||||
doctypeEntities = true;
|
||||
s.append(readChar());
|
||||
} else if (c != '\0')
|
||||
} else if (c != END_OF_CHARS)
|
||||
s.append(readChar());
|
||||
else if (mustBeWellFormed)
|
||||
throw new FHIRFormatError("Unexpected termination of html source"+descLoc());
|
||||
}
|
||||
if (peekChar() != '\0')
|
||||
if (peekChar() != END_OF_CHARS)
|
||||
{
|
||||
readChar();
|
||||
skipWhiteSpace();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.hl7.fhir.utilities.tests;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -88,4 +90,9 @@ public class XhtmlNodeTest {
|
|||
ObjectOutputStream oout = new ObjectOutputStream(bout);
|
||||
oout.writeObject(node);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseBadChars() throws FHIRFormatError, IOException {
|
||||
XhtmlNode x = new XhtmlParser().parse(BaseTestingUtilities.loadTestResource("xhtml", "bad-chars.html"), "div");
|
||||
}
|
||||
}
|
|
@ -1007,7 +1007,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst
|
|||
}
|
||||
|
||||
public void loadIg(String src, boolean recursive) throws IOException, FHIRException {
|
||||
NpmPackage npm = src.matches(FilesystemPackageCacheManager.PACKAGE_VERSION_REGEX_OPT) ? pcm.loadPackage(src, null) : null;
|
||||
NpmPackage npm = src.matches(FilesystemPackageCacheManager.PACKAGE_VERSION_REGEX_OPT) && !new File(src).exists() ? pcm.loadPackage(src, null) : null;
|
||||
if (npm != null) {
|
||||
for (String s : npm.dependencies()) {
|
||||
if (!context.getLoadedPackages().contains(s)) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -52,6 +52,7 @@ import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy;
|
|||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.json.JSONUtil;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
|
@ -81,8 +82,9 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||
|
||||
Map<String, JsonObject> examples = new HashMap<String, JsonObject>();
|
||||
manifest = (JsonObject) new com.google.gson.JsonParser().parse(contents);
|
||||
for (Entry<String, JsonElement> e : manifest.getAsJsonObject("test-cases").entrySet()) {
|
||||
examples.put(e.getKey(), e.getValue().getAsJsonObject());
|
||||
for (JsonElement e : manifest.getAsJsonArray("test-cases")) {
|
||||
JsonObject o = (JsonObject) e;
|
||||
examples.put(JSONUtil.str(o, "name"), o);
|
||||
}
|
||||
|
||||
List<String> names = new ArrayList<String>(examples.size());
|
||||
|
@ -154,7 +156,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||
if (content.has("use-test") && !content.get("use-test").getAsBoolean())
|
||||
return;
|
||||
|
||||
String testCaseContent = TestingUtilities.loadTestResource("validator", name);
|
||||
String testCaseContent = TestingUtilities.loadTestResource("validator", JSONUtil.str(content, "file"));
|
||||
InstanceValidator val = vCurr.getValidator();
|
||||
val.setWantCheckSnapshotUnchanged(true);
|
||||
val.getContext().setClientRetryCount(4);
|
||||
|
@ -226,7 +228,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||
if (content.has("logical")==false) {
|
||||
val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false);
|
||||
System.out.println(String.format("Start Validating (%d to set up)", (System.nanoTime() - setup) / 1000000));
|
||||
if (name.endsWith(".json"))
|
||||
if (JSONUtil.str(content, "file").endsWith(".json"))
|
||||
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON);
|
||||
else
|
||||
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML);
|
||||
|
@ -258,7 +260,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||
val.getContext().cacheResource(sd);
|
||||
val.setAssumeValidRestReferences(profile.has("assumeValidRestReferences") ? profile.get("assumeValidRestReferences").getAsBoolean() : false);
|
||||
List<ValidationMessage> errorsProfile = new ArrayList<ValidationMessage>();
|
||||
if (name.endsWith(".json"))
|
||||
if (JSONUtil.str(content, "file").endsWith(".json"))
|
||||
val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON, asSdList(sd));
|
||||
else
|
||||
val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML, asSdList(sd));
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.50</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.51-SNAPSHOT</validator_test_case_version>
|
||||
<junit_jupiter_version>5.6.2</junit_jupiter_version>
|
||||
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
||||
<jacoco_version>0.8.5</jacoco_version>
|
||||
|
|
Loading…
Reference in New Issue