mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-06 11:29:30 +00:00
turn off snapshot consistency checking by default + add ability to provide package in line in tests
This commit is contained in:
parent
5c12048749
commit
96e44048ce
@ -184,6 +184,14 @@ public interface IResourceValidator {
|
|||||||
public boolean isShowMessagesFromReferences();
|
public boolean isShowMessagesFromReferences();
|
||||||
public void setShowMessagesFromReferences(boolean value);
|
public void setShowMessagesFromReferences(boolean value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this is used internally in the publishing stack to ensure that everything is water tight, but
|
||||||
|
* this check is not necessary or appropriate at run time when the validator is hosted in HAPI
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isWantCheckSnapshotUnchanged();
|
||||||
|
public void setWantCheckSnapshotUnchanged(boolean wantCheckSnapshotUnchanged);
|
||||||
|
|
||||||
//FIXME: don't need that, gets never used?
|
//FIXME: don't need that, gets never used?
|
||||||
// public String getValidationLanguage();
|
// public String getValidationLanguage();
|
||||||
// public void setValidationLanguage(String value);
|
// public void setValidationLanguage(String value);
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
package org.hl7.fhir.validation.tests;
|
package org.hl7.fhir.validation.tests;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import java.io.FileNotFoundException;
|
||||||
import com.google.gson.GsonBuilder;
|
import java.io.IOException;
|
||||||
import com.google.gson.JsonArray;
|
import java.io.InputStream;
|
||||||
import com.google.gson.JsonElement;
|
import java.net.MalformedURLException;
|
||||||
import com.google.gson.JsonObject;
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.NotImplementedException;
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||||
@ -43,11 +52,11 @@ import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy;
|
|||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.VersionUtilities;
|
import org.hl7.fhir.utilities.VersionUtilities;
|
||||||
|
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||||
import org.hl7.fhir.validation.ValidationEngine;
|
import org.hl7.fhir.validation.ValidationEngine;
|
||||||
import org.hl7.fhir.validation.instance.InstanceValidator;
|
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -55,19 +64,11 @@ import org.junit.runner.RunWith;
|
|||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import com.google.common.base.Charsets;
|
||||||
import java.io.IOException;
|
import com.google.gson.GsonBuilder;
|
||||||
import java.io.InputStream;
|
import com.google.gson.JsonArray;
|
||||||
import java.net.MalformedURLException;
|
import com.google.gson.JsonElement;
|
||||||
import java.net.URL;
|
import com.google.gson.JsonObject;
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class ValidationTests implements IEvaluationContext, IValidatorResourceFetcher {
|
public class ValidationTests implements IEvaluationContext, IValidatorResourceFetcher {
|
||||||
@ -100,7 +101,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||||||
private String version;
|
private String version;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private static final String DEF_TX = "http://tx.fhir.org";
|
private static final String DEF_TX = "http://tx.fhir.org";
|
||||||
// private static final String DEF_TX = "http://local.fhir.org:960";
|
// private static final String DEF_TX = "http://local.fhir.org:960";
|
||||||
private static Map<String, ValidationEngine> ve = new HashMap<>();
|
private static Map<String, ValidationEngine> ve = new HashMap<>();
|
||||||
private static ValidationEngine vCurr;
|
private static ValidationEngine vCurr;
|
||||||
@ -154,8 +155,8 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
String testCaseContent = TestingUtilities.loadTestResource("validator", name);
|
String testCaseContent = TestingUtilities.loadTestResource("validator", name);
|
||||||
|
|
||||||
InstanceValidator val = vCurr.getValidator();
|
InstanceValidator val = vCurr.getValidator();
|
||||||
|
val.setWantCheckSnapshotUnchanged(true);
|
||||||
val.getContext().setClientRetryCount(4);
|
val.getContext().setClientRetryCount(4);
|
||||||
val.setDebug(false);
|
val.setDebug(false);
|
||||||
if (content.has("allowed-extension-domain"))
|
if (content.has("allowed-extension-domain"))
|
||||||
@ -170,7 +171,13 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||||||
val.setFetcher(this);
|
val.setFetcher(this);
|
||||||
if (content.has("packages")) {
|
if (content.has("packages")) {
|
||||||
for (JsonElement e : content.getAsJsonArray("packages")) {
|
for (JsonElement e : content.getAsJsonArray("packages")) {
|
||||||
vCurr.loadIg(e.getAsString(), true);
|
String n = e.getAsString();
|
||||||
|
InputStream cnt = n.endsWith(".tgz") ? TestingUtilities.loadTestResourceStream("validator", n) : null;
|
||||||
|
if (cnt != null) {
|
||||||
|
vCurr.loadPackage(NpmPackage.fromPackage(cnt));
|
||||||
|
} else {
|
||||||
|
vCurr.loadIg(n, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (content.has("crumb-trail")) {
|
if (content.has("crumb-trail")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user