Get JPA working with new uuid: logic

This commit is contained in:
James 2017-01-24 08:43:04 -05:00
parent 127b76884a
commit 5c752cdace
5 changed files with 82 additions and 72 deletions

View File

@ -164,7 +164,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
entity = toEntity(nextResource);
entity.setUpdated(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());
} else if (nextResouceOperationIn == BundleEntryTransactionMethodEnum.POST) {
if (nextId.isEmpty() == false) {
@ -282,7 +282,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
}
private static boolean isPlaceholder(IdDt theId) {
if ("cid:".equals(theId.getBaseUrl())) {
if (theId.getIdPart() != null && theId.getIdPart().startsWith("cid:")) {
return true;
}
return false;

View File

@ -40,7 +40,6 @@ import java.util.Set;
import javax.persistence.TypedQuery;
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.IIdType;
import org.springframework.beans.factory.annotation.Autowired;
@ -634,8 +633,10 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle, MetaDt> {
}
private static boolean isPlaceholder(IdDt theId) {
if ("urn:oid:".equals(theId.getBaseUrl()) || "urn:uuid:".equals(theId.getBaseUrl())) {
return true;
if (theId.getValue() != null) {
if (theId.getValue().startsWith("urn:oid:") || theId.getValue().startsWith("urn:uuid:")) {
return true;
}
}
return false;
}

View File

@ -627,8 +627,10 @@ public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao<Bundle, Meta> {
}
private static boolean isPlaceholder(IdType theId) {
if ("urn:oid:".equals(theId.getBaseUrl()) || "urn:uuid:".equals(theId.getBaseUrl())) {
return true;
if (theId.getValue() != null) {
if (theId.getValue().startsWith("urn:oid:") || theId.getValue().startsWith("urn:uuid:")) {
return true;
}
}
return false;
}

View File

@ -1615,13 +1615,11 @@ public class FhirSystemDaoDstu2Test extends BaseJpaDstu2SystemTest {
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Patient");
Observation o1 = new Observation();
o1.setId("cid:observation1");
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
o1.setSubject(new ResourceReferenceDt("urn:oid:0.1.2.3"));
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
Observation o2 = new Observation();
o2.setId("cid:observation2");
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
o2.setSubject(new ResourceReferenceDt("urn:oid:0.1.2.3"));
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");
Observation o1 = new Observation();
o1.setId("cid:observation1");
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
o1.setSubject(new ResourceReferenceDt("Patient/urn:oid:0.1.2.3"));
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
Observation o2 = new Observation();
o2.setId("cid:observation2");
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
o2.setSubject(new ResourceReferenceDt("Patient/urn:oid:0.1.2.3"));
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");

View File

@ -93,7 +93,6 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
return null;
}
/**
* See #410
*/
@ -104,7 +103,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Bundle output = mySystemDao.transaction(mySrd, bundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(output));
IdType id = new IdType(output.getEntry().get(1).getResponse().getLocation());
MedicationRequest mo = myMedicationRequestDao.read(id);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo));
@ -113,7 +112,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Test
public void testTransactionOruBundle() throws IOException {
myDaoConfig.setAllowMultipleDelete(true);
String input = IOUtils.toString(getClass().getResourceAsStream("/oruBundle.json"), StandardCharsets.UTF_8);
Bundle inputBundle;
@ -135,7 +134,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Observation obs1 = new Observation();
obs1.setStatus(ObservationStatus.FINAL);
IIdType obs1id = myObservationDao.create(obs1).getId().toUnqualifiedVersionless();
Observation obs2 = new Observation();
obs2.setStatus(ObservationStatus.FINAL);
IIdType obs2id = myObservationDao.create(obs2).getId().toUnqualifiedVersionless();
@ -144,7 +143,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
rpt.addIdentifier().setSystem("foo").setValue("IDENTIFIER");
rpt.addResult(new Reference(obs2id));
IIdType rptId = myDiagnosticReportDao.create(rpt).getId().toUnqualifiedVersionless();
myObservationDao.read(obs1id);
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().setResource(rpt).getRequest().setMethod(HTTPVerb.PUT).setUrl("DiagnosticReport?identifier=foo|IDENTIFIER");
mySystemDao.transaction(mySrd, b);
myObservationDao.read(obs1id);
try {
myObservationDao.read(obs2id);
@ -163,11 +162,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
} catch (ResourceGoneException e) {
// good
}
rpt = myDiagnosticReportDao.read(rptId);
assertThat(rpt.getResult(), empty());
}
@Test
public void testReindexing() {
Patient p = new Patient();
@ -240,7 +239,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
assertEquals(Long.valueOf(2), entity.getIndexStatus());
}
@Test
public void testSystemMetaOperation() {
@ -254,7 +253,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue(methodName);
patient.addName().setFamily("Tester").addGiven("Joe");
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().getProfile().add(new IdType("http://profile/1"));
@ -265,7 +264,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue(methodName);
patient.addName().setFamily("Tester").addGiven("Joe");
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().getProfile().add(new IdType("http://profile/2"));
@ -362,16 +361,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
assertThat(respEntry.getStatus(), startsWith("404"));
}
@Test
public void testTransactionCreateInlineMatchUrlWithNoMatches() {
String methodName = "testTransactionCreateInlineMatchUrlWithNoMatches";
Bundle request = new Bundle();
myDaoConfig.setAllowInlineMatchUrlReferences(true);
Observation o = new Observation();
o.getCode().setText("Some Observation");
o.getSubject().setReference("Patient?identifier=urn%3Asystem%7C" + methodName);
@ -385,14 +382,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
}
}
@Test
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch";
Bundle request = new Bundle();
myDaoConfig.setAllowInlineMatchUrlReferences(true);
Patient p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.setId("Patient/" + methodName);
@ -418,14 +414,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
assertEquals("1", o.getIdElement().getVersionIdPart());
}
@Test
public void testTransactionCreateInlineMatchUrlWithOneMatch2() {
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch2";
Bundle request = new Bundle();
myDaoConfig.setAllowInlineMatchUrlReferences(true);
Patient p = new Patient();
p.addName().addGiven("Heute");
p.addIdentifier().setSystem("urn:system").setValue(methodName);
@ -493,7 +489,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Bundle request = new Bundle();
myDaoConfig.setAllowInlineMatchUrlReferences(true);
Patient p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
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());
}
}
@Test
public void testTransactionCreateMatchUrlWithOneMatch() {
String methodName = "testTransactionCreateMatchUrlWithOneMatch";
@ -556,7 +552,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
assertEquals("1", o.getIdElement().getVersionIdPart());
}
@Test
public void testTransactionCreateMatchUrlWithTwoMatch() {
String methodName = "testTransactionCreateMatchUrlWithTwoMatch";
@ -651,16 +647,16 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
o1.getPartOf().setReference(o2.getId());
o2.getPartOf().setReference(o1.getId());
Bundle resp = mySystemDao.transaction(mySrd, request);
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
assertEquals(2, resp.getEntry().size());
IdType id1 = new IdType(resp.getEntry().get(0).getResponse().getLocation());
IdType id2 = new IdType(resp.getEntry().get(1).getResponse().getLocation());
ourLog.info("ID1: {}", id1);
SearchParameterMap map = new SearchParameterMap();
map.add(Organization.SP_PARTOF, new ReferenceParam(id1.toUnqualifiedVersionless().getValue()));
IBundleProvider res = myOrganizationDao.search(map);
@ -690,16 +686,16 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
o1.getPartOf().setReference(o1.getId());
o2.getPartOf().setReference(o2.getId());
resp = mySystemDao.transaction(mySrd, request);
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
assertEquals(2, resp.getEntry().size());
id1 = new IdType(resp.getEntry().get(0).getResponse().getLocation());
id2 = new IdType(resp.getEntry().get(1).getResponse().getLocation());
ourLog.info("ID1: {}", id1);
map = new SearchParameterMap();
map.add(Organization.SP_PARTOF, new ReferenceParam(id1.toUnqualifiedVersionless().getValue()));
res = myOrganizationDao.search(map);
@ -749,7 +745,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
assertEquals(Patient.class, details.getResource().getClass());
}
@Test
public void testTransactionCreateWithDuplicateMatchUrl01() {
String methodName = "testTransactionCreateWithDuplicateMatchUrl01";
@ -768,7 +764,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
mySystemDao.transaction(mySrd, request);
fail();
} 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);
fail();
} 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);
mySystemDao.transaction(mySrd, request);
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);
mySystemDao.transaction(mySrd, request);
myObservationDao.read(new IdType("Observation/a" + methodName), mySrd);
myPatientDao.read(new IdType("Patient/" + methodName), mySrd);
}
@ -1145,7 +1143,6 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
}
}
@Test
public void testTransactionDeleteMatchUrlWithZeroMatch() {
String methodName = "testTransactionDeleteMatchUrlWithZeroMatch";
@ -1157,7 +1154,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Bundle resp = mySystemDao.transaction(mySrd, request);
assertEquals(1, resp.getEntry().size());
assertEquals("204 No Content", resp.getEntry().get(0).getResponse().getStatus());
// fail();
// } catch (ResourceNotFoundException e) {
// assertThat(e.getMessage(), containsString("resource matching URL \"Patient?"));
@ -1194,14 +1191,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
public void testTransactionDoesNotAllowDanglingTemporaryIds() throws Exception {
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
BundleEntryComponent entry = bundle.addEntry();
Patient p = new Patient();
p.getManagingOrganization().setReference("urn:uuid:30ce60cf-f7cb-4196-961f-cadafa8b7ff5");
entry.setResource(p);
entry.getRequest().setMethod(HTTPVerb.POST);
entry.getRequest().setUrl("Patient");
try {
mySystemDao.transaction(mySrd, bundle);
fail();
@ -1215,13 +1212,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
mySystemDao.transaction(mySrd, bundle);
IBundleProvider history = mySystemDao.history(null, null, null);
Bundle list = toBundle(history);
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(list));
assertEquals(6, list.getEntry().size());
Patient p = find(list, Patient.class, 0);
assertTrue(p.getIdElement().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);
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
Bundle response = mySystemDao.transaction(mySrd, bundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
assertEquals("201 Created", response.getEntry().get(0).getResponse().getStatus());
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
*/
bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
response = mySystemDao.transaction(mySrd, bundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
assertEquals("200 OK", response.getEntry().get(0).getResponse().getStatus());
assertThat(response.getEntry().get(0).getResponse().getLocation(), matchesPattern("Practitioner/[0-9]+/_history/1"));
@ -1312,7 +1309,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Test
public void testTransactionOrdering() {
String methodName = "testTransactionOrdering";
//@formatter:off
/*
* Transaction Order, per the spec:
@ -1745,11 +1742,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
"\"status\":\"201 Created\"," +
"\"location\":\"Questionnaire/54127-6/_history/1\","));
//@formatter:on
/*
* Upload again to update
*/
resp = mySystemDao.transaction(mySrd, bundle);
encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp);
@ -1771,13 +1768,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Patient patient = new Patient();
patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1");
myPatientDao.create(patient, mySrd);
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
Bundle response = mySystemDao.transaction(mySrd, bundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response));
}
@Test
@ -1794,14 +1791,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
try {
mySystemDao.transaction(mySrd, bundle);
fail();
} catch (PreconditionFailedException e) {
assertEquals("Invalid match URL \"Patient?identifier=http://www.ghh.org/identifiers|condreftestpatid1\" - Multiple resources match this search", e.getMessage());
}
}
@Test
@ -1810,14 +1807,14 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8);
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, input);
try {
mySystemDao.transaction(mySrd, bundle);
fail();
} catch (ResourceNotFoundException e) {
assertEquals("Invalid match URL \"Patient?identifier=http://www.ghh.org/identifiers|condreftestpatid1\" - No resources match this search", e.getMessage());
}
}
@Test
@ -1841,7 +1838,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Patient p = new Patient();
p.addName().setFamily("family");
final IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless();
Bundle inputBundle = new Bundle();
//@formatter:off
@ -1856,7 +1853,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
.setMethod(HTTPVerb.POST)
.setUrl("Patient");
//@formatter:on
//@formatter:off
Appointment app1 = new Appointment();
app1.addParticipant().getActor().setReference(id.getValue());
@ -1882,11 +1879,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
Bundle outputBundle = mySystemDao.transaction(mySrd, inputBundle);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(outputBundle));
assertEquals(3, outputBundle.getEntry().size());
IdDt id0 = new IdDt(outputBundle.getEntry().get(0).getResponse().getLocation());
IdDt id2 = new IdDt(outputBundle.getEntry().get(2).getResponse().getLocation());
app2 = myAppointmentDao.read(id2, mySrd);
assertEquals("NO REF", app2.getParticipant().get(0).getActor().getDisplay());
assertEquals(null, app2.getParticipant().get(0).getActor().getReference());
@ -1947,6 +1944,24 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
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
public void testTransactionWithRelativeOidIds() throws Exception {
Bundle res = new Bundle();
@ -1958,13 +1973,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
Observation o1 = new Observation();
o1.setId("cid:observation1");
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
o1.setSubject(new Reference("urn:oid:0.1.2.3"));
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
Observation o2 = new Observation();
o2.setId("cid:observation2");
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
o2.setSubject(new Reference("urn:oid:0.1.2.3"));
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");
Observation o1 = new Observation();
o1.setId("cid:observation1");
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
o1.setSubject(new Reference("Patient/urn:oid:0.1.2.3"));
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
Observation o2 = new Observation();
o2.setId("cid:observation2");
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
o2.setSubject(new Reference("Patient/urn:oid:0.1.2.3"));
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");