mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-03-09 14:33:32 +00:00
Get JPA working with new uuid: logic
This commit is contained in:
parent
127b76884a
commit
5c752cdace
@ -164,7 +164,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
|
|||||||
entity = toEntity(nextResource);
|
entity = toEntity(nextResource);
|
||||||
entity.setUpdated(updateTime);
|
entity.setUpdated(updateTime);
|
||||||
entity.setPublished(updateTime);
|
entity.setPublished(updateTime);
|
||||||
if (nextId.isEmpty() == false && "cid:".equals(nextId.getBaseUrl())) {
|
if (nextId.getIdPart() != null && nextId.getIdPart().startsWith("cid:")) {
|
||||||
ourLog.debug("Resource in transaction has ID[{}], will replace with server assigned ID", nextId.getIdPart());
|
ourLog.debug("Resource in transaction has ID[{}], will replace with server assigned ID", nextId.getIdPart());
|
||||||
} else if (nextResouceOperationIn == BundleEntryTransactionMethodEnum.POST) {
|
} else if (nextResouceOperationIn == BundleEntryTransactionMethodEnum.POST) {
|
||||||
if (nextId.isEmpty() == false) {
|
if (nextId.isEmpty() == false) {
|
||||||
@ -282,7 +282,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPlaceholder(IdDt theId) {
|
private static boolean isPlaceholder(IdDt theId) {
|
||||||
if ("cid:".equals(theId.getBaseUrl())) {
|
if (theId.getIdPart() != null && theId.getIdPart().startsWith("cid:")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -40,7 +40,6 @@ import java.util.Set;
|
|||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -634,8 +633,10 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle, MetaDt> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPlaceholder(IdDt theId) {
|
private static boolean isPlaceholder(IdDt theId) {
|
||||||
if ("urn:oid:".equals(theId.getBaseUrl()) || "urn:uuid:".equals(theId.getBaseUrl())) {
|
if (theId.getValue() != null) {
|
||||||
return true;
|
if (theId.getValue().startsWith("urn:oid:") || theId.getValue().startsWith("urn:uuid:")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -627,8 +627,10 @@ public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao<Bundle, Meta> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPlaceholder(IdType theId) {
|
private static boolean isPlaceholder(IdType theId) {
|
||||||
if ("urn:oid:".equals(theId.getBaseUrl()) || "urn:uuid:".equals(theId.getBaseUrl())) {
|
if (theId.getValue() != null) {
|
||||||
return true;
|
if (theId.getValue().startsWith("urn:oid:") || theId.getValue().startsWith("urn:uuid:")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1615,13 +1615,11 @@ public class FhirSystemDaoDstu2Test extends BaseJpaDstu2SystemTest {
|
|||||||
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Patient");
|
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Patient");
|
||||||
|
|
||||||
Observation o1 = new Observation();
|
Observation o1 = new Observation();
|
||||||
o1.setId("cid:observation1");
|
|
||||||
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
||||||
o1.setSubject(new ResourceReferenceDt("urn:oid:0.1.2.3"));
|
o1.setSubject(new ResourceReferenceDt("urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
||||||
|
|
||||||
Observation o2 = new Observation();
|
Observation o2 = new Observation();
|
||||||
o2.setId("cid:observation2");
|
|
||||||
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
||||||
o2.setSubject(new ResourceReferenceDt("urn:oid:0.1.2.3"));
|
o2.setSubject(new ResourceReferenceDt("urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
||||||
@ -1760,13 +1758,11 @@ public class FhirSystemDaoDstu2Test extends BaseJpaDstu2SystemTest {
|
|||||||
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Patient");
|
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Patient");
|
||||||
|
|
||||||
Observation o1 = new Observation();
|
Observation o1 = new Observation();
|
||||||
o1.setId("cid:observation1");
|
|
||||||
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
||||||
o1.setSubject(new ResourceReferenceDt("Patient/urn:oid:0.1.2.3"));
|
o1.setSubject(new ResourceReferenceDt("Patient/urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
||||||
|
|
||||||
Observation o2 = new Observation();
|
Observation o2 = new Observation();
|
||||||
o2.setId("cid:observation2");
|
|
||||||
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
||||||
o2.setSubject(new ResourceReferenceDt("Patient/urn:oid:0.1.2.3"));
|
o2.setSubject(new ResourceReferenceDt("Patient/urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
||||||
|
@ -93,7 +93,6 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See #410
|
* See #410
|
||||||
*/
|
*/
|
||||||
@ -104,7 +103,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
|
|
||||||
Bundle output = mySystemDao.transaction(mySrd, bundle);
|
Bundle output = mySystemDao.transaction(mySrd, bundle);
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(output));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(output));
|
||||||
|
|
||||||
IdType id = new IdType(output.getEntry().get(1).getResponse().getLocation());
|
IdType id = new IdType(output.getEntry().get(1).getResponse().getLocation());
|
||||||
MedicationRequest mo = myMedicationRequestDao.read(id);
|
MedicationRequest mo = myMedicationRequestDao.read(id);
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo));
|
||||||
@ -113,7 +112,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testTransactionOruBundle() throws IOException {
|
public void testTransactionOruBundle() throws IOException {
|
||||||
myDaoConfig.setAllowMultipleDelete(true);
|
myDaoConfig.setAllowMultipleDelete(true);
|
||||||
|
|
||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/oruBundle.json"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/oruBundle.json"), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
Bundle inputBundle;
|
Bundle inputBundle;
|
||||||
@ -135,7 +134,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Observation obs1 = new Observation();
|
Observation obs1 = new Observation();
|
||||||
obs1.setStatus(ObservationStatus.FINAL);
|
obs1.setStatus(ObservationStatus.FINAL);
|
||||||
IIdType obs1id = myObservationDao.create(obs1).getId().toUnqualifiedVersionless();
|
IIdType obs1id = myObservationDao.create(obs1).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Observation obs2 = new Observation();
|
Observation obs2 = new Observation();
|
||||||
obs2.setStatus(ObservationStatus.FINAL);
|
obs2.setStatus(ObservationStatus.FINAL);
|
||||||
IIdType obs2id = myObservationDao.create(obs2).getId().toUnqualifiedVersionless();
|
IIdType obs2id = myObservationDao.create(obs2).getId().toUnqualifiedVersionless();
|
||||||
@ -144,7 +143,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
rpt.addIdentifier().setSystem("foo").setValue("IDENTIFIER");
|
rpt.addIdentifier().setSystem("foo").setValue("IDENTIFIER");
|
||||||
rpt.addResult(new Reference(obs2id));
|
rpt.addResult(new Reference(obs2id));
|
||||||
IIdType rptId = myDiagnosticReportDao.create(rpt).getId().toUnqualifiedVersionless();
|
IIdType rptId = myDiagnosticReportDao.create(rpt).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
myObservationDao.read(obs1id);
|
myObservationDao.read(obs1id);
|
||||||
myObservationDao.read(obs2id);
|
myObservationDao.read(obs2id);
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
b.addEntry().getRequest().setMethod(HTTPVerb.DELETE).setUrl("Observation?_has:DiagnosticReport:result:identifier=foo|IDENTIFIER");
|
b.addEntry().getRequest().setMethod(HTTPVerb.DELETE).setUrl("Observation?_has:DiagnosticReport:result:identifier=foo|IDENTIFIER");
|
||||||
b.addEntry().setResource(rpt).getRequest().setMethod(HTTPVerb.PUT).setUrl("DiagnosticReport?identifier=foo|IDENTIFIER");
|
b.addEntry().setResource(rpt).getRequest().setMethod(HTTPVerb.PUT).setUrl("DiagnosticReport?identifier=foo|IDENTIFIER");
|
||||||
mySystemDao.transaction(mySrd, b);
|
mySystemDao.transaction(mySrd, b);
|
||||||
|
|
||||||
myObservationDao.read(obs1id);
|
myObservationDao.read(obs1id);
|
||||||
try {
|
try {
|
||||||
myObservationDao.read(obs2id);
|
myObservationDao.read(obs2id);
|
||||||
@ -163,11 +162,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
} catch (ResourceGoneException e) {
|
} catch (ResourceGoneException e) {
|
||||||
// good
|
// good
|
||||||
}
|
}
|
||||||
|
|
||||||
rpt = myDiagnosticReportDao.read(rptId);
|
rpt = myDiagnosticReportDao.read(rptId);
|
||||||
assertThat(rpt.getResult(), empty());
|
assertThat(rpt.getResult(), empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReindexing() {
|
public void testReindexing() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
@ -240,7 +239,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertEquals(Long.valueOf(2), entity.getIndexStatus());
|
assertEquals(Long.valueOf(2), entity.getIndexStatus());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSystemMetaOperation() {
|
public void testSystemMetaOperation() {
|
||||||
|
|
||||||
@ -254,7 +253,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue(methodName);
|
patient.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||||
patient.addName().setFamily("Tester").addGiven("Joe");
|
patient.addName().setFamily("Tester").addGiven("Joe");
|
||||||
|
|
||||||
patient.getMeta().addTag(null, "Dog", "Puppies");
|
patient.getMeta().addTag(null, "Dog", "Puppies");
|
||||||
patient.getMeta().getSecurity().add(new Coding().setSystem("seclabel:sys:1").setCode("seclabel:code:1").setDisplay("seclabel:dis:1"));
|
patient.getMeta().getSecurity().add(new Coding().setSystem("seclabel:sys:1").setCode("seclabel:code:1").setDisplay("seclabel:dis:1"));
|
||||||
patient.getMeta().getProfile().add(new IdType("http://profile/1"));
|
patient.getMeta().getProfile().add(new IdType("http://profile/1"));
|
||||||
@ -265,7 +264,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addIdentifier().setSystem("urn:system").setValue(methodName);
|
patient.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||||
patient.addName().setFamily("Tester").addGiven("Joe");
|
patient.addName().setFamily("Tester").addGiven("Joe");
|
||||||
|
|
||||||
patient.getMeta().addTag("http://foo", "Cat", "Kittens");
|
patient.getMeta().addTag("http://foo", "Cat", "Kittens");
|
||||||
patient.getMeta().getSecurity().add(new Coding().setSystem("seclabel:sys:2").setCode("seclabel:code:2").setDisplay("seclabel:dis:2"));
|
patient.getMeta().getSecurity().add(new Coding().setSystem("seclabel:sys:2").setCode("seclabel:code:2").setDisplay("seclabel:dis:2"));
|
||||||
patient.getMeta().getProfile().add(new IdType("http://profile/2"));
|
patient.getMeta().getProfile().add(new IdType("http://profile/2"));
|
||||||
@ -362,16 +361,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertThat(respEntry.getStatus(), startsWith("404"));
|
assertThat(respEntry.getStatus(), startsWith("404"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateInlineMatchUrlWithNoMatches() {
|
public void testTransactionCreateInlineMatchUrlWithNoMatches() {
|
||||||
String methodName = "testTransactionCreateInlineMatchUrlWithNoMatches";
|
String methodName = "testTransactionCreateInlineMatchUrlWithNoMatches";
|
||||||
Bundle request = new Bundle();
|
Bundle request = new Bundle();
|
||||||
|
|
||||||
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
||||||
|
|
||||||
|
|
||||||
Observation o = new Observation();
|
Observation o = new Observation();
|
||||||
o.getCode().setText("Some Observation");
|
o.getCode().setText("Some Observation");
|
||||||
o.getSubject().setReference("Patient?identifier=urn%3Asystem%7C" + methodName);
|
o.getSubject().setReference("Patient?identifier=urn%3Asystem%7C" + methodName);
|
||||||
@ -385,14 +382,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
|
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
|
||||||
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch";
|
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch";
|
||||||
Bundle request = new Bundle();
|
Bundle request = new Bundle();
|
||||||
|
|
||||||
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
||||||
|
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||||
p.setId("Patient/" + methodName);
|
p.setId("Patient/" + methodName);
|
||||||
@ -418,14 +414,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertEquals("1", o.getIdElement().getVersionIdPart());
|
assertEquals("1", o.getIdElement().getVersionIdPart());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateInlineMatchUrlWithOneMatch2() {
|
public void testTransactionCreateInlineMatchUrlWithOneMatch2() {
|
||||||
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch2";
|
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch2";
|
||||||
Bundle request = new Bundle();
|
Bundle request = new Bundle();
|
||||||
|
|
||||||
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
||||||
|
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.addName().addGiven("Heute");
|
p.addName().addGiven("Heute");
|
||||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||||
@ -493,7 +489,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Bundle request = new Bundle();
|
Bundle request = new Bundle();
|
||||||
|
|
||||||
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
myDaoConfig.setAllowInlineMatchUrlReferences(true);
|
||||||
|
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||||
myPatientDao.create(p, mySrd).getId();
|
myPatientDao.create(p, mySrd).getId();
|
||||||
@ -514,7 +510,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertEquals("Invalid match URL \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateInlineMatchUrlWithTwoMatches\" - Multiple resources match this search", e.getMessage());
|
assertEquals("Invalid match URL \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateInlineMatchUrlWithTwoMatches\" - Multiple resources match this search", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateMatchUrlWithOneMatch() {
|
public void testTransactionCreateMatchUrlWithOneMatch() {
|
||||||
String methodName = "testTransactionCreateMatchUrlWithOneMatch";
|
String methodName = "testTransactionCreateMatchUrlWithOneMatch";
|
||||||
@ -556,7 +552,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertEquals("1", o.getIdElement().getVersionIdPart());
|
assertEquals("1", o.getIdElement().getVersionIdPart());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateMatchUrlWithTwoMatch() {
|
public void testTransactionCreateMatchUrlWithTwoMatch() {
|
||||||
String methodName = "testTransactionCreateMatchUrlWithTwoMatch";
|
String methodName = "testTransactionCreateMatchUrlWithTwoMatch";
|
||||||
@ -651,16 +647,16 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
|
|
||||||
o1.getPartOf().setReference(o2.getId());
|
o1.getPartOf().setReference(o2.getId());
|
||||||
o2.getPartOf().setReference(o1.getId());
|
o2.getPartOf().setReference(o1.getId());
|
||||||
|
|
||||||
Bundle resp = mySystemDao.transaction(mySrd, request);
|
Bundle resp = mySystemDao.transaction(mySrd, request);
|
||||||
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
|
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
|
||||||
assertEquals(2, resp.getEntry().size());
|
assertEquals(2, resp.getEntry().size());
|
||||||
|
|
||||||
IdType id1 = new IdType(resp.getEntry().get(0).getResponse().getLocation());
|
IdType id1 = new IdType(resp.getEntry().get(0).getResponse().getLocation());
|
||||||
IdType id2 = new IdType(resp.getEntry().get(1).getResponse().getLocation());
|
IdType id2 = new IdType(resp.getEntry().get(1).getResponse().getLocation());
|
||||||
|
|
||||||
ourLog.info("ID1: {}", id1);
|
ourLog.info("ID1: {}", id1);
|
||||||
|
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
map.add(Organization.SP_PARTOF, new ReferenceParam(id1.toUnqualifiedVersionless().getValue()));
|
map.add(Organization.SP_PARTOF, new ReferenceParam(id1.toUnqualifiedVersionless().getValue()));
|
||||||
IBundleProvider res = myOrganizationDao.search(map);
|
IBundleProvider res = myOrganizationDao.search(map);
|
||||||
@ -690,16 +686,16 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
|
|
||||||
o1.getPartOf().setReference(o1.getId());
|
o1.getPartOf().setReference(o1.getId());
|
||||||
o2.getPartOf().setReference(o2.getId());
|
o2.getPartOf().setReference(o2.getId());
|
||||||
|
|
||||||
resp = mySystemDao.transaction(mySrd, request);
|
resp = mySystemDao.transaction(mySrd, request);
|
||||||
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
|
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
|
||||||
assertEquals(2, resp.getEntry().size());
|
assertEquals(2, resp.getEntry().size());
|
||||||
|
|
||||||
id1 = new IdType(resp.getEntry().get(0).getResponse().getLocation());
|
id1 = new IdType(resp.getEntry().get(0).getResponse().getLocation());
|
||||||
id2 = new IdType(resp.getEntry().get(1).getResponse().getLocation());
|
id2 = new IdType(resp.getEntry().get(1).getResponse().getLocation());
|
||||||
|
|
||||||
ourLog.info("ID1: {}", id1);
|
ourLog.info("ID1: {}", id1);
|
||||||
|
|
||||||
map = new SearchParameterMap();
|
map = new SearchParameterMap();
|
||||||
map.add(Organization.SP_PARTOF, new ReferenceParam(id1.toUnqualifiedVersionless().getValue()));
|
map.add(Organization.SP_PARTOF, new ReferenceParam(id1.toUnqualifiedVersionless().getValue()));
|
||||||
res = myOrganizationDao.search(map);
|
res = myOrganizationDao.search(map);
|
||||||
@ -749,7 +745,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertEquals(Patient.class, details.getResource().getClass());
|
assertEquals(Patient.class, details.getResource().getClass());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateWithDuplicateMatchUrl01() {
|
public void testTransactionCreateWithDuplicateMatchUrl01() {
|
||||||
String methodName = "testTransactionCreateWithDuplicateMatchUrl01";
|
String methodName = "testTransactionCreateWithDuplicateMatchUrl01";
|
||||||
@ -768,7 +764,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals(e.getMessage(), "Unable to process Transaction - Request would cause multiple resources to match URL: \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateWithDuplicateMatchUrl01\". Does transaction request contain duplicates?");
|
assertEquals(e.getMessage(),
|
||||||
|
"Unable to process Transaction - Request would cause multiple resources to match URL: \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateWithDuplicateMatchUrl01\". Does transaction request contain duplicates?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,7 +787,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
fail();
|
fail();
|
||||||
} catch (InvalidRequestException e) {
|
} catch (InvalidRequestException e) {
|
||||||
assertEquals(e.getMessage(), "Unable to process Transaction - Request would cause multiple resources to match URL: \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateWithDuplicateMatchUrl02\". Does transaction request contain duplicates?");
|
assertEquals(e.getMessage(),
|
||||||
|
"Unable to process Transaction - Request would cause multiple resources to match URL: \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateWithDuplicateMatchUrl02\". Does transaction request contain duplicates?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,7 +876,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.PUT).setUrl("http://localhost/server/base/Patient/" + methodName);
|
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.PUT).setUrl("http://localhost/server/base/Patient/" + methodName);
|
||||||
|
|
||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
|
|
||||||
myPatientDao.read(new IdType("Patient/" + methodName), mySrd);
|
myPatientDao.read(new IdType("Patient/" + methodName), mySrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,7 +895,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/" + methodName);
|
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/" + methodName);
|
||||||
|
|
||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
|
|
||||||
myObservationDao.read(new IdType("Observation/a" + methodName), mySrd);
|
myObservationDao.read(new IdType("Observation/a" + methodName), mySrd);
|
||||||
myPatientDao.read(new IdType("Patient/" + methodName), mySrd);
|
myPatientDao.read(new IdType("Patient/" + methodName), mySrd);
|
||||||
}
|
}
|
||||||
@ -1145,7 +1143,6 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionDeleteMatchUrlWithZeroMatch() {
|
public void testTransactionDeleteMatchUrlWithZeroMatch() {
|
||||||
String methodName = "testTransactionDeleteMatchUrlWithZeroMatch";
|
String methodName = "testTransactionDeleteMatchUrlWithZeroMatch";
|
||||||
@ -1157,7 +1154,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Bundle resp = mySystemDao.transaction(mySrd, request);
|
Bundle resp = mySystemDao.transaction(mySrd, request);
|
||||||
assertEquals(1, resp.getEntry().size());
|
assertEquals(1, resp.getEntry().size());
|
||||||
assertEquals("204 No Content", resp.getEntry().get(0).getResponse().getStatus());
|
assertEquals("204 No Content", resp.getEntry().get(0).getResponse().getStatus());
|
||||||
|
|
||||||
// fail();
|
// fail();
|
||||||
// } catch (ResourceNotFoundException e) {
|
// } catch (ResourceNotFoundException e) {
|
||||||
// assertThat(e.getMessage(), containsString("resource matching URL \"Patient?"));
|
// assertThat(e.getMessage(), containsString("resource matching URL \"Patient?"));
|
||||||
@ -1194,14 +1191,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
public void testTransactionDoesNotAllowDanglingTemporaryIds() throws Exception {
|
public void testTransactionDoesNotAllowDanglingTemporaryIds() throws Exception {
|
||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
|
||||||
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
||||||
|
|
||||||
BundleEntryComponent entry = bundle.addEntry();
|
BundleEntryComponent entry = bundle.addEntry();
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.getManagingOrganization().setReference("urn:uuid:30ce60cf-f7cb-4196-961f-cadafa8b7ff5");
|
p.getManagingOrganization().setReference("urn:uuid:30ce60cf-f7cb-4196-961f-cadafa8b7ff5");
|
||||||
entry.setResource(p);
|
entry.setResource(p);
|
||||||
entry.getRequest().setMethod(HTTPVerb.POST);
|
entry.getRequest().setMethod(HTTPVerb.POST);
|
||||||
entry.getRequest().setUrl("Patient");
|
entry.getRequest().setUrl("Patient");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mySystemDao.transaction(mySrd, bundle);
|
mySystemDao.transaction(mySrd, bundle);
|
||||||
fail();
|
fail();
|
||||||
@ -1215,13 +1212,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
|
||||||
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
||||||
mySystemDao.transaction(mySrd, bundle);
|
mySystemDao.transaction(mySrd, bundle);
|
||||||
|
|
||||||
IBundleProvider history = mySystemDao.history(null, null, null);
|
IBundleProvider history = mySystemDao.history(null, null, null);
|
||||||
Bundle list = toBundle(history);
|
Bundle list = toBundle(history);
|
||||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(list));
|
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(list));
|
||||||
|
|
||||||
assertEquals(6, list.getEntry().size());
|
assertEquals(6, list.getEntry().size());
|
||||||
|
|
||||||
Patient p = find(list, Patient.class, 0);
|
Patient p = find(list, Patient.class, 0);
|
||||||
assertTrue(p.getIdElement().isIdPartValidLong());
|
assertTrue(p.getIdElement().isIdPartValidLong());
|
||||||
assertTrue(p.getGeneralPractitionerFirstRep().getReferenceElement().isIdPartValidLong());
|
assertTrue(p.getGeneralPractitionerFirstRep().getReferenceElement().isIdPartValidLong());
|
||||||
@ -1268,7 +1265,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/transaction-bundle.xml"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/transaction-bundle.xml"), StandardCharsets.UTF_8);
|
||||||
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
||||||
Bundle response = mySystemDao.transaction(mySrd, bundle);
|
Bundle response = mySystemDao.transaction(mySrd, bundle);
|
||||||
|
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
|
||||||
assertEquals("201 Created", response.getEntry().get(0).getResponse().getStatus());
|
assertEquals("201 Created", response.getEntry().get(0).getResponse().getStatus());
|
||||||
assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
|
assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
|
||||||
@ -1276,10 +1273,10 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
/*
|
/*
|
||||||
* Now a second time
|
* Now a second time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
||||||
response = mySystemDao.transaction(mySrd, bundle);
|
response = mySystemDao.transaction(mySrd, bundle);
|
||||||
|
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
|
||||||
assertEquals("200 OK", response.getEntry().get(0).getResponse().getStatus());
|
assertEquals("200 OK", response.getEntry().get(0).getResponse().getStatus());
|
||||||
assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
|
assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
|
||||||
@ -1312,7 +1309,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testTransactionOrdering() {
|
public void testTransactionOrdering() {
|
||||||
String methodName = "testTransactionOrdering";
|
String methodName = "testTransactionOrdering";
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
/*
|
/*
|
||||||
* Transaction Order, per the spec:
|
* Transaction Order, per the spec:
|
||||||
@ -1745,11 +1742,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
"\"status\":\"201 Created\"," +
|
"\"status\":\"201 Created\"," +
|
||||||
"\"location\":\"Questionnaire/54127-6/_history/1\","));
|
"\"location\":\"Questionnaire/54127-6/_history/1\","));
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Upload again to update
|
* Upload again to update
|
||||||
*/
|
*/
|
||||||
|
|
||||||
resp = mySystemDao.transaction(mySrd, bundle);
|
resp = mySystemDao.transaction(mySrd, bundle);
|
||||||
|
|
||||||
encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp);
|
encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp);
|
||||||
@ -1771,13 +1768,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Patient patient = new Patient();
|
Patient patient = new Patient();
|
||||||
patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1");
|
patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1");
|
||||||
myPatientDao.create(patient, mySrd);
|
myPatientDao.create(patient, mySrd);
|
||||||
|
|
||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
|
||||||
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
||||||
|
|
||||||
Bundle response = mySystemDao.transaction(mySrd, bundle);
|
Bundle response = mySystemDao.transaction(mySrd, bundle);
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -1794,14 +1791,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
|
|
||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
|
||||||
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mySystemDao.transaction(mySrd, bundle);
|
mySystemDao.transaction(mySrd, bundle);
|
||||||
fail();
|
fail();
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertEquals("Invalid match URL \"Patient?identifier=http://www.ghh.org/identifiers|condreftestpatid1\" - Multiple resources match this search", e.getMessage());
|
assertEquals("Invalid match URL \"Patient?identifier=http://www.ghh.org/identifiers|condreftestpatid1\" - Multiple resources match this search", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -1810,14 +1807,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
|
|
||||||
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
|
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
|
||||||
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mySystemDao.transaction(mySrd, bundle);
|
mySystemDao.transaction(mySrd, bundle);
|
||||||
fail();
|
fail();
|
||||||
} catch (ResourceNotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
assertEquals("Invalid match URL \"Patient?identifier=http://www.ghh.org/identifiers|condreftestpatid1\" - No resources match this search", e.getMessage());
|
assertEquals("Invalid match URL \"Patient?identifier=http://www.ghh.org/identifiers|condreftestpatid1\" - No resources match this search", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -1841,7 +1838,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.addName().setFamily("family");
|
p.addName().setFamily("family");
|
||||||
final IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
final IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Bundle inputBundle = new Bundle();
|
Bundle inputBundle = new Bundle();
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
@ -1856,7 +1853,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
.setMethod(HTTPVerb.POST)
|
.setMethod(HTTPVerb.POST)
|
||||||
.setUrl("Patient");
|
.setUrl("Patient");
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
Appointment app1 = new Appointment();
|
Appointment app1 = new Appointment();
|
||||||
app1.addParticipant().getActor().setReference(id.getValue());
|
app1.addParticipant().getActor().setReference(id.getValue());
|
||||||
@ -1882,11 +1879,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
|
|
||||||
Bundle outputBundle = mySystemDao.transaction(mySrd, inputBundle);
|
Bundle outputBundle = mySystemDao.transaction(mySrd, inputBundle);
|
||||||
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(outputBundle));
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(outputBundle));
|
||||||
|
|
||||||
assertEquals(3, outputBundle.getEntry().size());
|
assertEquals(3, outputBundle.getEntry().size());
|
||||||
IdDt id0 = new IdDt(outputBundle.getEntry().get(0).getResponse().getLocation());
|
IdDt id0 = new IdDt(outputBundle.getEntry().get(0).getResponse().getLocation());
|
||||||
IdDt id2 = new IdDt(outputBundle.getEntry().get(2).getResponse().getLocation());
|
IdDt id2 = new IdDt(outputBundle.getEntry().get(2).getResponse().getLocation());
|
||||||
|
|
||||||
app2 = myAppointmentDao.read(id2, mySrd);
|
app2 = myAppointmentDao.read(id2, mySrd);
|
||||||
assertEquals("NO REF", app2.getParticipant().get(0).getActor().getDisplay());
|
assertEquals("NO REF", app2.getParticipant().get(0).getActor().getDisplay());
|
||||||
assertEquals(null, app2.getParticipant().get(0).getActor().getReference());
|
assertEquals(null, app2.getParticipant().get(0).getActor().getReference());
|
||||||
@ -1947,6 +1944,24 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
assertNotEquals(medOrderId1, medOrderId2);
|
assertNotEquals(medOrderId1, medOrderId2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransactionWIthInvalidPlaceholder() throws Exception {
|
||||||
|
Bundle res = new Bundle();
|
||||||
|
res.setType(BundleType.TRANSACTION);
|
||||||
|
|
||||||
|
Observation o1 = new Observation();
|
||||||
|
o1.setId("cid:observation1");
|
||||||
|
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
||||||
|
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
||||||
|
|
||||||
|
try {
|
||||||
|
mySystemDao.transaction(mySrd, res);
|
||||||
|
fail();
|
||||||
|
} catch (InvalidRequestException e) {
|
||||||
|
assertEquals("Invalid placeholder ID found: cid:observation1 - Must be of the form 'urn:uuid:[uuid]' or 'urn:oid:[oid]'", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionWithRelativeOidIds() throws Exception {
|
public void testTransactionWithRelativeOidIds() throws Exception {
|
||||||
Bundle res = new Bundle();
|
Bundle res = new Bundle();
|
||||||
@ -1958,13 +1973,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
|
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
|
||||||
|
|
||||||
Observation o1 = new Observation();
|
Observation o1 = new Observation();
|
||||||
o1.setId("cid:observation1");
|
|
||||||
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
||||||
o1.setSubject(new Reference("urn:oid:0.1.2.3"));
|
o1.setSubject(new Reference("urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
||||||
|
|
||||||
Observation o2 = new Observation();
|
Observation o2 = new Observation();
|
||||||
o2.setId("cid:observation2");
|
|
||||||
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
||||||
o2.setSubject(new Reference("urn:oid:0.1.2.3"));
|
o2.setSubject(new Reference("urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
||||||
@ -2103,13 +2116,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
|||||||
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
|
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
|
||||||
|
|
||||||
Observation o1 = new Observation();
|
Observation o1 = new Observation();
|
||||||
o1.setId("cid:observation1");
|
|
||||||
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
|
||||||
o1.setSubject(new Reference("Patient/urn:oid:0.1.2.3"));
|
o1.setSubject(new Reference("Patient/urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
||||||
|
|
||||||
Observation o2 = new Observation();
|
Observation o2 = new Observation();
|
||||||
o2.setId("cid:observation2");
|
|
||||||
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
|
||||||
o2.setSubject(new Reference("Patient/urn:oid:0.1.2.3"));
|
o2.setSubject(new Reference("Patient/urn:oid:0.1.2.3"));
|
||||||
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user