Add another failing test
This commit is contained in:
parent
07937e4431
commit
19d181989c
|
@ -1206,6 +1206,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
|
|||
if (thePerformIndexing || ((ResourceTable) theEntity).getVersion() == 1) {
|
||||
|
||||
newParams = new ResourceIndexedSearchParams();
|
||||
//FIX ME GGG: This is where the placeholder references end up getting created, deeeeeep down the stakc.
|
||||
mySearchParamWithInlineReferencesExtractor.populateFromResource(newParams, theTransactionDetails, entity, theResource, existingParams, theRequest, thePerformIndexing);
|
||||
|
||||
changed = populateResourceIntoEntity(theTransactionDetails, theRequest, theResource, entity, true);
|
||||
|
|
|
@ -94,7 +94,6 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
|
|||
throw new InvalidRequestException("Resource " + resName + "/" + idPart + " not found, specified in path: " + theSourcePath);
|
||||
|
||||
}
|
||||
|
||||
resolvedResource = createdTableOpt.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
|
||||
import ca.uhn.fhir.jpa.provider.r4.ResourceProviderR4Test;
|
||||
|
@ -34,7 +35,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.matchesPattern;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
@ -803,7 +806,30 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test {
|
|||
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, new InputStreamReader(FhirResourceDaoR4VersionedReferenceTest.class.getResourceAsStream("/npe-causing-bundle.json")));
|
||||
|
||||
Bundle transaction = mySystemDao.transaction(new SystemRequestDetails(), bundle);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoVersionPathsWithAutoCreatePlaceholders() {
|
||||
myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true);
|
||||
|
||||
Observation obs = new Observation();
|
||||
obs.setId("Observation/CDE");
|
||||
obs.setSubject(new Reference("Patient/ABC"));
|
||||
DaoMethodOutcome update = myObservationDao.create(obs);
|
||||
Observation resource = (Observation)update.getResource();
|
||||
String versionedPatientReference = resource.getSubject().getReference();
|
||||
assertThat(versionedPatientReference, is(equalTo("Patient/ABC")));
|
||||
|
||||
myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject");
|
||||
|
||||
obs = new Observation();
|
||||
obs.setId("Observation/DEF");
|
||||
obs.setSubject(new Reference("Patient/RED"));
|
||||
update = myObservationDao.create(obs);
|
||||
resource = (Observation)update.getResource();
|
||||
versionedPatientReference = resource.getSubject().getReference();
|
||||
|
||||
assertThat(versionedPatientReference, is(equalTo("Patient/RED/_history/1")));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@
|
|||
},
|
||||
"use": "claim",
|
||||
"patient": {
|
||||
"reference": "Patient/123"
|
||||
"reference": "Patient/ABC"
|
||||
},
|
||||
"billablePeriod": {
|
||||
"start": "2015-12-14T00:00:00-05:00"
|
||||
},
|
||||
"created": "2021-08-16T13:54:10-04:00",
|
||||
"insurer": {
|
||||
"reference": "Organization/1"
|
||||
"reference": "Organization/A"
|
||||
},
|
||||
"provider": {
|
||||
"reference": "Organization/b9d22776-1ee9-3843-bc48-b4bf67861483"
|
||||
|
@ -44,7 +44,7 @@
|
|||
"careTeam": [ {
|
||||
"sequence": 1,
|
||||
"provider": {
|
||||
"reference": "Practitioner/1"
|
||||
"reference": "Practitioner/H"
|
||||
},
|
||||
"role": {
|
||||
"coding": [ {
|
||||
|
@ -55,7 +55,7 @@
|
|||
}, {
|
||||
"sequence": 2,
|
||||
"provider": {
|
||||
"reference": "Practitioner/2"
|
||||
"reference": "Practitioner/I"
|
||||
},
|
||||
"role": {
|
||||
"coding": [ {
|
||||
|
@ -66,7 +66,7 @@
|
|||
}, {
|
||||
"sequence": 3,
|
||||
"provider": {
|
||||
"reference": "Practitioner/3"
|
||||
"reference": "Practitioner/J"
|
||||
},
|
||||
"role": {
|
||||
"coding": [ {
|
||||
|
@ -129,7 +129,7 @@
|
|||
"insurance": [ {
|
||||
"focal": true,
|
||||
"coverage": {
|
||||
"reference": "Coverage/10"
|
||||
"reference": "Coverage/G"
|
||||
}
|
||||
} ],
|
||||
"total": [ {
|
||||
|
@ -185,14 +185,14 @@
|
|||
},
|
||||
"use": "claim",
|
||||
"patient": {
|
||||
"reference": "Patient/123"
|
||||
"reference": "Patient/ABC"
|
||||
},
|
||||
"billablePeriod": {
|
||||
"start": "2015-12-18T00:00:00-05:00"
|
||||
},
|
||||
"created": "2021-08-16T13:54:10-04:00",
|
||||
"insurer": {
|
||||
"reference": "Organization/1"
|
||||
"reference": "Organization/A"
|
||||
},
|
||||
"provider": {
|
||||
"reference": "Organization/d10823cf-ee15-3a0e-a12e-1509cd18cda4"
|
||||
|
@ -201,7 +201,7 @@
|
|||
"careTeam": [ {
|
||||
"sequence": 1,
|
||||
"provider": {
|
||||
"reference": "Practitioner/4"
|
||||
"reference": "Practitioner/D"
|
||||
},
|
||||
"role": {
|
||||
"coding": [ {
|
||||
|
@ -212,7 +212,7 @@
|
|||
}, {
|
||||
"sequence": 2,
|
||||
"provider": {
|
||||
"reference": "Practitioner/5"
|
||||
"reference": "Practitioner/E"
|
||||
},
|
||||
"role": {
|
||||
"coding": [ {
|
||||
|
@ -223,7 +223,7 @@
|
|||
}, {
|
||||
"sequence": 3,
|
||||
"provider": {
|
||||
"reference": "Practitioner/6"
|
||||
"reference": "Practitioner/F"
|
||||
},
|
||||
"role": {
|
||||
"coding": [ {
|
||||
|
@ -370,7 +370,7 @@
|
|||
"insurance": [ {
|
||||
"focal": true,
|
||||
"coverage": {
|
||||
"reference": "Coverage/10"
|
||||
"reference": "Coverage/G"
|
||||
}
|
||||
} ],
|
||||
"total": [ {
|
||||
|
|
Loading…
Reference in New Issue