|
|
|
@ -1,31 +1,19 @@
|
|
|
|
|
package ca.uhn.fhir.jpa.provider.dstu3;
|
|
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.not;
|
|
|
|
|
import static org.hamcrest.Matchers.stringContainsInOrder;
|
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
|
import static org.junit.Assert.assertThat;
|
|
|
|
|
import static org.junit.Assert.fail;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
import org.hl7.fhir.dstu3.model.BooleanType;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.CodeSystem;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.CodeType;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.Coding;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.Parameters;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.StringType;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.UriType;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.ValueSet;
|
|
|
|
|
import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest;
|
|
|
|
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|
|
|
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
|
|
|
import ca.uhn.fhir.util.TestUtil;
|
|
|
|
|
import org.hl7.fhir.dstu3.model.*;
|
|
|
|
|
import org.hl7.fhir.instance.model.api.IIdType;
|
|
|
|
|
import org.junit.AfterClass;
|
|
|
|
|
import org.junit.Before;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest;
|
|
|
|
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|
|
|
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
|
|
|
import ca.uhn.fhir.util.TestUtil;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
|
|
public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDstu3Test {
|
|
|
|
|
|
|
|
|
@ -58,31 +46,31 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
|
|
|
|
|
ourLog.info(resp);
|
|
|
|
|
|
|
|
|
|
assertEquals("name", respParam.getParameter().get(0).getName());
|
|
|
|
|
assertEquals(("SYSTEM NAME"), ((StringType)respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals(("SYSTEM NAME"), ((StringType) respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("display", respParam.getParameter().get(1).getName());
|
|
|
|
|
assertEquals("Parent A", ((StringType)respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("Parent A", ((StringType) respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("abstract", respParam.getParameter().get(2).getName());
|
|
|
|
|
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
assertEquals(false, ((BooleanType) respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
|
|
|
|
|
// With HTTP GET
|
|
|
|
|
respParam = ourClient
|
|
|
|
|
.operation()
|
|
|
|
|
.onType(CodeSystem.class)
|
|
|
|
|
.named("lookup")
|
|
|
|
|
.withParameter(Parameters.class, "code", new CodeType("ParentA"))
|
|
|
|
|
.andParameter("system", new UriType(FhirResourceDaoDstu3TerminologyTest.URL_MY_CODE_SYSTEM))
|
|
|
|
|
.useHttpGet()
|
|
|
|
|
.execute();
|
|
|
|
|
.operation()
|
|
|
|
|
.onType(CodeSystem.class)
|
|
|
|
|
.named("lookup")
|
|
|
|
|
.withParameter(Parameters.class, "code", new CodeType("ParentA"))
|
|
|
|
|
.andParameter("system", new UriType(FhirResourceDaoDstu3TerminologyTest.URL_MY_CODE_SYSTEM))
|
|
|
|
|
.useHttpGet()
|
|
|
|
|
.execute();
|
|
|
|
|
|
|
|
|
|
resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
|
|
|
|
|
ourLog.info(resp);
|
|
|
|
|
|
|
|
|
|
assertEquals("name", respParam.getParameter().get(0).getName());
|
|
|
|
|
assertEquals(("SYSTEM NAME"), ((StringType)respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals(("SYSTEM NAME"), ((StringType) respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("display", respParam.getParameter().get(1).getName());
|
|
|
|
|
assertEquals("Parent A", ((StringType)respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("Parent A", ((StringType) respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("abstract", respParam.getParameter().get(2).getName());
|
|
|
|
|
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
assertEquals(false, ((BooleanType) respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -100,11 +88,11 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
|
|
|
|
|
ourLog.info(resp);
|
|
|
|
|
|
|
|
|
|
assertEquals("name", respParam.getParameter().get(0).getName());
|
|
|
|
|
assertEquals(("Unknown"), ((StringType)respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals(("Unknown"), ((StringType) respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("display", respParam.getParameter().get(1).getName());
|
|
|
|
|
assertEquals("Accession ID", ((StringType)respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("Accession ID", ((StringType) respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("abstract", respParam.getParameter().get(2).getName());
|
|
|
|
|
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
assertEquals(false, ((BooleanType) respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -141,11 +129,11 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
|
|
|
|
|
ourLog.info(resp);
|
|
|
|
|
|
|
|
|
|
assertEquals("name", respParam.getParameter().get(0).getName());
|
|
|
|
|
assertEquals(("Unknown"), ((StringType)respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals(("Unknown"), ((StringType) respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("display", respParam.getParameter().get(1).getName());
|
|
|
|
|
assertEquals(("Systolic blood pressure--expiration"), ((StringType)respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals(("Systolic blood pressure--expiration"), ((StringType) respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("abstract", respParam.getParameter().get(2).getName());
|
|
|
|
|
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
assertEquals(false, ((BooleanType) respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -181,11 +169,11 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
|
|
|
|
|
ourLog.info(resp);
|
|
|
|
|
|
|
|
|
|
assertEquals("name", respParam.getParameter().get(0).getName());
|
|
|
|
|
assertEquals(("Unknown"), ((StringType)respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals(("Unknown"), ((StringType) respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("display", respParam.getParameter().get(1).getName());
|
|
|
|
|
assertEquals(("Systolic blood pressure--expiration"), ((StringType)respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals(("Systolic blood pressure--expiration"), ((StringType) respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("abstract", respParam.getParameter().get(2).getName());
|
|
|
|
|
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
assertEquals(false, ((BooleanType) respParam.getParameter().get(2).getValue()).getValue().booleanValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -259,11 +247,11 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
|
|
|
|
|
ourLog.info(resp);
|
|
|
|
|
|
|
|
|
|
assertEquals("name", respParam.getParameter().get(0).getName());
|
|
|
|
|
assertEquals("Unknown", ((StringType)respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("Unknown", ((StringType) respParam.getParameter().get(0).getValue()).getValue());
|
|
|
|
|
assertEquals("display", respParam.getParameter().get(1).getName());
|
|
|
|
|
assertEquals("Married", ((StringType)respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("Married", ((StringType) respParam.getParameter().get(1).getValue()).getValue());
|
|
|
|
|
assertEquals("abstract", respParam.getParameter().get(2).getName());
|
|
|
|
|
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).booleanValue());
|
|
|
|
|
assertEquals(false, ((BooleanType) respParam.getParameter().get(2).getValue()).booleanValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AfterClass
|
|
|
|
|