From 15ea4fb55527e97a01e1b669ad65d5665a48fd4e Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 13 May 2021 10:47:26 -0400 Subject: [PATCH] Tidy test --- .../fhir/docs/server_jpa/configuration.md | 2 +- .../dao/expunge/DeleteExpungeServiceTest.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md index 26f2b4d77ce..0800e823f6d 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md @@ -129,4 +129,4 @@ X-Retry-On-Version-Conflict: retry; max-retries=100 # Controlling Delete with Expunge size -During delete with expunge operations there is an internal synchronous search which locates all the resources to be deleted. By default the maximum size of this search is 10000. This can be configured via the [Internal Synchronous Search Size](/hapi-fhir/apidocs/hapi-fhir-jpaserver-api/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setInternalSynchronousSearchSize(int)) +During the delete with expunge operation there is an internal synchronous search which locates all the resources to be deleted. The default maximum size of this search is 10000. This can be configured via the [Internal Synchronous Search Size](/hapi-fhir/apidocs/hapi-fhir-jpaserver-api/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setInternalSynchronousSearchSize(int)) property. diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeServiceTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeServiceTest.java index e06676f8038..bccfb85a692 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeServiceTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeServiceTest.java @@ -67,28 +67,29 @@ class DeleteExpungeServiceTest extends BaseJpaR4Test { } @Test public void testDeleteExpungeRespectsSynchronousSize() { - //When + //Given myDaoConfig.setInternalSynchronousSearchSize(1); - Patient patient = new Patient(); myPatientDao.create(patient); - Patient otherPatient = new Patient(); myPatientDao.create(otherPatient); - //Then + //When DeleteMethodOutcome deleteMethodOutcome = myPatientDao.deleteByUrl("Patient?" + JpaConstants.PARAM_DELETE_EXPUNGE + "=true", mySrd); + IBundleProvider remaining = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true)); + + //Then assertThat(deleteMethodOutcome.getExpungedResourcesCount(), is(equalTo(1L))); + assertThat(remaining.size(), is(equalTo(1))); - IBundleProvider search = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true)); - assertThat(search.size(), is(equalTo(1))); - + //When deleteMethodOutcome = myPatientDao.deleteByUrl("Patient?" + JpaConstants.PARAM_DELETE_EXPUNGE + "=true", mySrd); - assertThat(deleteMethodOutcome.getExpungedResourcesCount(), is(equalTo(1L))); + remaining = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true)); - search = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true)); - assertThat(search.size(), is(equalTo(0))); + //Then + assertThat(deleteMethodOutcome.getExpungedResourcesCount(), is(equalTo(1L))); + assertThat(remaining.size(), is(equalTo(0))); } @Test