Add tests and get :below queries working for built-in code systems
This commit is contained in:
parent
9b6f548970
commit
b8f1f39ead
|
@ -44,7 +44,6 @@ import org.hl7.fhir.instance.model.api.IAnyResource;
|
|||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IBaseElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseMetaType;
|
||||
|
@ -402,9 +401,9 @@ public abstract class BaseParser implements IParser {
|
|||
String childName = theChild.getChildNameByDatatype(type);
|
||||
BaseRuntimeElementDefinition<?> childDef = theChild.getChildElementDefinitionByDatatype(type);
|
||||
if (childDef == null) {
|
||||
if (theValue instanceof IBaseExtension) {
|
||||
return null;
|
||||
}
|
||||
// if (theValue instanceof IBaseExtension) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
/*
|
||||
* For RI structures Enumeration class, this replaces the child def
|
||||
|
|
|
@ -143,14 +143,23 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
|
||||
/**
|
||||
* Returns the system for this token. Note that if a {@link #getModifier()} is being used, the entire value of the
|
||||
* parameter will be placed in {@link #getValue() value} and this method will return <code>null</code>.
|
||||
* parameter will be placed in {@link #getValue() value} and this method will return <code>null</code>.
|
||||
* <p
|
||||
* Also note that this value may be <code>null</code> or <code>""</code> (empty string) and that
|
||||
* each of these have a different meaning. When a token is passed on a URL and it has no
|
||||
* vertical bar (often meaning "return values that match the given code in any codesystem")
|
||||
* this method will return <code>null</code>. When a token is passed on a URL and it has
|
||||
* a vetical bar but nothing before the bar (often meaning "return values that match the
|
||||
* given code but that have no codesystem) this method will return <code>""</code>
|
||||
* </p>
|
||||
*/
|
||||
public String getSystem() {
|
||||
return mySystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value for the token
|
||||
* Returns the value for the token (generally the value to the right of the
|
||||
* vertical bar on the URL)
|
||||
*/
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
|
|
|
@ -331,7 +331,7 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test {
|
|||
ValueSet vs = new ValueSet();
|
||||
ConceptSetComponent include = vs.getCompose().addInclude();
|
||||
include.setSystem(URL_MY_CODE_SYSTEM);
|
||||
// include.addConcept().setCode("A");
|
||||
include.addConcept().setCode("A");
|
||||
// include.addConcept().setCode("AA");
|
||||
// include.addConcept().setCode("AAA");
|
||||
// include.addConcept().setCode("AB");
|
||||
|
@ -344,11 +344,12 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test {
|
|||
ourLog.info(encoded);
|
||||
|
||||
ArrayList<String> codes = toCodesContains(result.getExpansion().getContains());
|
||||
assertThat(codes, containsInAnyOrder("AAA"));
|
||||
assertThat(codes, containsInAnyOrder("A", "AAA"));
|
||||
|
||||
assertEquals("AAA", result.getExpansion().getContains().get(0).getCode());
|
||||
assertEquals("Code AAA", result.getExpansion().getContains().get(0).getDisplay());
|
||||
assertEquals(URL_MY_CODE_SYSTEM, result.getExpansion().getContains().get(0).getSystem());
|
||||
int idx = codes.indexOf("AAA");
|
||||
assertEquals("AAA", result.getExpansion().getContains().get(idx).getCode());
|
||||
assertEquals("Code AAA", result.getExpansion().getContains().get(idx).getDisplay());
|
||||
assertEquals(URL_MY_CODE_SYSTEM, result.getExpansion().getContains().get(idx).getSystem());
|
||||
//
|
||||
}
|
||||
|
||||
|
@ -612,7 +613,6 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test {
|
|||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSearchCodeInEmptyValueSet() {
|
||||
ValueSet valueSet = new ValueSet();
|
||||
valueSet.setUrl(URL_MY_VALUE_SET);
|
||||
|
|
|
@ -24,7 +24,6 @@ import ca.uhn.fhir.jpa.entity.TermConcept;
|
|||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class TerminologySvcImplTest extends BaseJpaDstu3Test {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('SA', 'HFJ_SEARCH_RESULT', 1);
|
||||
CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE( 'SA', 'HFJ_SEARCH_RESULT', 0, 0, 1 );
|
||||
|
|
@ -33,7 +33,7 @@ import ca.uhn.fhir.util.PortUtil;
|
|||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
|
||||
public class TokenParameterTest {
|
||||
public class TokenParamTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static FhirContext ourCtx = FhirContext.forDstu1();
|
||||
|
@ -63,6 +63,32 @@ public class TokenParameterTest {
|
|||
assertEquals("b", ourLastOrList.getValuesAsQueryTokens().get(0).getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSystem() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=b");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(1, ourLastOrList.getListAsCodings().size());
|
||||
assertEquals(null, ourLastOrList.getValuesAsQueryTokens().get(0).getSystem());
|
||||
assertEquals("b", ourLastOrList.getValuesAsQueryTokens().get(0).getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptySystem() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=%7Cb");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(1, ourLastOrList.getListAsCodings().size());
|
||||
assertEquals("", ourLastOrList.getValuesAsQueryTokens().get(0).getSystem());
|
||||
assertEquals("b", ourLastOrList.getValuesAsQueryTokens().get(0).getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetModifiersText() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier:text=a%7Cb");
|
Loading…
Reference in New Issue