issue-2901 cleaning up test contexts
This commit is contained in:
parent
cbfcc02a92
commit
ff7433edd7
|
@ -233,6 +233,7 @@ public abstract class BaseStorageDao {
|
|||
// resource not found
|
||||
// and no autocreateplaceholders set...
|
||||
// we throw
|
||||
System.out.println("FINDME");
|
||||
throw new ResourceNotFoundException(referenceElement);
|
||||
}
|
||||
String newTargetReference = referenceElement.withVersion(version.toString()).getValue();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ca.uhn.fhir.jpa.dao.r4;
|
||||
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
|
@ -52,12 +53,11 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy());
|
||||
myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new DaoConfig().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets());
|
||||
myDaoConfig.setBundleTypesAllowedForStorage(new DaoConfig().getBundleTypesAllowedForStorage());
|
||||
|
||||
myModelConfig.setAutoVersionReferenceAtPaths(new ModelConfig().getAutoVersionReferenceAtPaths());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateWithBadReferenceFails() {
|
||||
|
||||
Observation o = new Observation();
|
||||
o.setStatus(ObservationStatus.FINAL);
|
||||
o.getSubject().setReference("Patient/FOO");
|
||||
|
@ -101,27 +101,28 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
params.add(Task.SP_PART_OF, new ReferenceParam("Task/AAA"));
|
||||
List<String> found = toUnqualifiedVersionlessIdValues(myTaskDao.search(params));
|
||||
assertThat(found, contains(id.getValue()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateWithBadReferenceFails() {
|
||||
Observation o1 = new Observation();
|
||||
o1.setStatus(ObservationStatus.FINAL);
|
||||
IIdType id = myObservationDao.create(o1, mySrd).getId();
|
||||
|
||||
Observation o = new Observation();
|
||||
o.setStatus(ObservationStatus.FINAL);
|
||||
IIdType id = myObservationDao.create(o, mySrd).getId();
|
||||
|
||||
o = new Observation();
|
||||
o.setId(id);
|
||||
o.setStatus(ObservationStatus.FINAL);
|
||||
o.getSubject().setReference("Patient/FOO");
|
||||
try {
|
||||
|
||||
Assertions.assertThrows(InvalidRequestException.class, () -> {
|
||||
myObservationDao.update(o, mySrd);
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertThat(e.getMessage(), startsWith("Resource Patient/FOO not found, specified in path: Observation.subject"));
|
||||
}
|
||||
});
|
||||
// try {
|
||||
//
|
||||
// fail();
|
||||
// } catch (InvalidRequestException e) {
|
||||
// assertThat(e.getMessage(), startsWith("Resource Patient/FOO not found, specified in path: Observation.subject"));
|
||||
// }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -454,8 +455,6 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
ourLog.info("\nObservation read after Patient update:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(createdObs));
|
||||
assertEquals(createdObs.getSubject().getReference(), conditionalUpdatePatId.toUnqualifiedVersionless().getValueAsString());
|
||||
assertEquals(placeholderPatId.toUnqualifiedVersionless().getValueAsString(), conditionalUpdatePatId.toUnqualifiedVersionless().getValueAsString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -566,7 +565,6 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
Observation createdObs = myObservationDao.read(id);
|
||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(createdObs));
|
||||
assertEquals("Patient/ABC", createdObs.getSubject().getReference());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -590,7 +588,6 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
@Test
|
||||
public void testAutocreatePlaceholderWithTargetExistingAlreadyTest() {
|
||||
myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true);
|
||||
|
||||
myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject");
|
||||
|
||||
String patientId = "Patient/RED";
|
||||
|
|
Loading…
Reference in New Issue