fix up tests to pass
This commit is contained in:
parent
4995134716
commit
5aec9978bd
|
@ -75,6 +75,7 @@ import org.hl7.fhir.r5.model.NamingSystem;
|
||||||
import org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType;
|
import org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType;
|
||||||
import org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent;
|
import org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent;
|
||||||
import org.hl7.fhir.r5.model.OperationDefinition;
|
import org.hl7.fhir.r5.model.OperationDefinition;
|
||||||
|
import org.hl7.fhir.r5.model.OperationOutcome;
|
||||||
import org.hl7.fhir.r5.model.Parameters;
|
import org.hl7.fhir.r5.model.Parameters;
|
||||||
import org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent;
|
import org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent;
|
||||||
import org.hl7.fhir.r5.model.PlanDefinition;
|
import org.hl7.fhir.r5.model.PlanDefinition;
|
||||||
|
@ -91,8 +92,10 @@ import org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCode
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
import org.hl7.fhir.r5.model.ValueSet;
|
||||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||||
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
import org.hl7.fhir.r5.model.Bundle.BundleType;
|
||||||
|
import org.hl7.fhir.r5.model.Bundle.HTTPVerb;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
|
||||||
|
import org.hl7.fhir.r5.renderers.OperationOutcomeRenderer;
|
||||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||||
import org.hl7.fhir.r5.terminologies.TerminologyClient;
|
import org.hl7.fhir.r5.terminologies.TerminologyClient;
|
||||||
import org.hl7.fhir.r5.terminologies.ValueSetCheckerSimple;
|
import org.hl7.fhir.r5.terminologies.ValueSetCheckerSimple;
|
||||||
|
@ -751,6 +754,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
setTerminologyOptions(options, pIn);
|
setTerminologyOptions(options, pIn);
|
||||||
BundleEntryComponent be = batch.addEntry();
|
BundleEntryComponent be = batch.addEntry();
|
||||||
be.setResource(pIn);
|
be.setResource(pIn);
|
||||||
|
be.getRequest().setMethod(HTTPVerb.POST);
|
||||||
be.getRequest().setUrl("ValueSet/$validate-code");
|
be.getRequest().setUrl("ValueSet/$validate-code");
|
||||||
be.setUserData("source", t);
|
be.setUserData("source", t);
|
||||||
systems.add(t.getCoding().getSystem());
|
systems.add(t.getCoding().getSystem());
|
||||||
|
@ -768,16 +772,19 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
for (int i = 0; i < batch.getEntry().size(); i++) {
|
for (int i = 0; i < batch.getEntry().size(); i++) {
|
||||||
CodingValidationRequest t = (CodingValidationRequest) batch.getEntry().get(i).getUserData("source");
|
CodingValidationRequest t = (CodingValidationRequest) batch.getEntry().get(i).getUserData("source");
|
||||||
BundleEntryComponent r = resp.getEntry().get(i);
|
BundleEntryComponent r = resp.getEntry().get(i);
|
||||||
if (r.getResponse().getStatus().startsWith("2")) {
|
if (r.getResource() instanceof Parameters) {
|
||||||
t.setResult(new ValidationResult(IssueSeverity.ERROR, getResponseText(r.getResource())).setTxLink(txLog == null ? null : txLog.getLastId()));
|
|
||||||
} else {
|
|
||||||
t.setResult(processValidationResult((Parameters) r.getResource()));
|
t.setResult(processValidationResult((Parameters) r.getResource()));
|
||||||
|
} else {
|
||||||
|
t.setResult(new ValidationResult(IssueSeverity.ERROR, getResponseText(r.getResource())).setTxLink(txLog == null ? null : txLog.getLastId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getResponseText(Resource resource) {
|
private String getResponseText(Resource resource) {
|
||||||
|
if (resource instanceof OperationOutcome) {
|
||||||
|
return OperationOutcomeRenderer.toString((OperationOutcome) resource);
|
||||||
|
}
|
||||||
return "Todo";
|
return "Todo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.hl7.fhir.r5.model.StringType;
|
||||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||||
|
|
||||||
public class OperationOutcomeRenderer extends ResourceRenderer {
|
public class OperationOutcomeRenderer extends ResourceRenderer {
|
||||||
|
@ -89,4 +90,11 @@ public class OperationOutcomeRenderer extends ResourceRenderer {
|
||||||
return display((OperationOutcome) r);
|
return display((OperationOutcome) r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String toString(OperationOutcome oo) {
|
||||||
|
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||||
|
for (OperationOutcomeIssueComponent issue : oo.getIssue()) {
|
||||||
|
b.append(issue.getSeverity().toCode()+": "+issue.getDetails().getText());
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,6 @@ public class FHIRToolingClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
||||||
public <T extends Resource> OperationOutcome validate(Class<T> resourceClass, T resource, String id) {
|
public <T extends Resource> OperationOutcome validate(Class<T> resourceClass, T resource, String id) {
|
||||||
ResourceRequest<T> result = null;
|
ResourceRequest<T> result = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
|
||||||
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 Map<String, ValidationEngine> ve = new HashMap<>();
|
private static Map<String, ValidationEngine> ve = new HashMap<>();
|
||||||
private static ValidationEngine vCurr;
|
private static ValidationEngine vCurr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue