Tidy test

This commit is contained in:
Tadgh 2021-05-13 10:47:26 -04:00
parent 3428d71023
commit 15ea4fb555
2 changed files with 12 additions and 11 deletions

View File

@ -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.

View File

@ -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