hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java
/**
	 * See #1053
	 * <p>
	 * Note that I don't know that _lastUpdate actually should apply to reverse includes. The
	 * spec doesn't say one way or ther other, but it seems like sensible behaviour to me.
	 * <p>
	 * Definitely the $everything operation depends on this behaviour, so if we change it
	 * we need to account for the everything operation...
	 */
See #1053

Note that I don't know that _lastUpdate actually should apply to reverse includes. The
spec doesn't say one way or ther other, but it seems like sensible behaviour to me.

Definitely the $everything operation depends on this behaviour, so if we change it
we need to account for the everything operation
See #1053 Note that I don ' t know that _lastUpdate actually should apply to reverse includes . The spec doesn ' t say one way or ther other but it seems like sensible behaviour to me . Definitely the $everything operation depends on this behaviour so if we change it we need to account for the everything operation
@Test
	public void testLastUpdateShouldApplyToReverseIncludes() {
		SearchParameterMap map;
		List<String> ids;
		Organization org = new Organization();
		org.setActive(false);
		org.setId("O1");
		myOrganizationDao.update(org);
		Date beforeAll = new Date();
		ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick();
		Patient p = new Patient();
		p.setId("P1");
		p.setActive(true);
		p.setManagingOrganization(new Reference("Organization/O1"));
		myPatientDao.update(p);
		ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick();
		Date beforeOrg = new Date();
		ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick();
		org = new Organization();
		org.setActive(true);
		org.setId("O1");
		myOrganizationDao.update(org);
		ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick();
		Date afterAll = new Date();
		map = new SearchParameterMap();
		map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(beforeAll));
		map.addRevInclude(Patient.INCLUDE_ORGANIZATION);
		ids = toUnqualifiedVersionlessIdValues(myOrganizationDao.search(map));
		assertThat(ids, contains("Organization/O1", "Patient/P1"));
		map = new SearchParameterMap();
		map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(beforeOrg));
		map.addInclude(Patient.INCLUDE_ORGANIZATION);
		ids = toUnqualifiedVersionlessIdValues(myOrganizationDao.search(map));
		assertThat(ids, contains("Organization/O1"));
		map = new SearchParameterMap();
		map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(afterAll));
		map.addInclude(Patient.INCLUDE_ORGANIZATION);
		ids = toUnqualifiedVersionlessIdValues(myOrganizationDao.search(map));
		assertThat(ids, empty());
	}
@ Test public void testLastUpdateShouldApplyToReverseIncludes ( ) { SearchParameterMap map ; List < String > ids ; Organization org = new Organization ( ) ; org . setActive ( false ) ; org . setId ( "O1" ) ; myOrganizationDao . update ( org ) ; Date beforeAll = new Date ( ) ; ca . uhn . fhir . jpa . util . TestUtil . sleepOneClick ( ) ; Patient p = new Patient ( ) ; p . setId ( "P1" ) ; p . setActive ( true ) ; p . setManagingOrganization ( new Reference ( "Organization/O1" ) ) ; myPatientDao . update ( p ) ; ca . uhn . fhir . jpa . util . TestUtil . sleepOneClick ( ) ; Date beforeOrg = new Date ( ) ; ca . uhn . fhir . jpa . util . TestUtil . sleepOneClick ( ) ; org = new Organization ( ) ; org . setActive ( true ) ; org . setId ( "O1" ) ; myOrganizationDao . update ( org ) ; ca . uhn . fhir . jpa . util . TestUtil . sleepOneClick ( ) ; Date afterAll = new Date ( ) ; map = new SearchParameterMap ( ) ; map . setLastUpdated ( new DateRangeParam ( ) . setLowerBoundInclusive ( beforeAll ) ) ; map . addRevInclude ( Patient . INCLUDE_ORGANIZATION ) ; ids = toUnqualifiedVersionlessIdValues ( myOrganizationDao . search ( map ) ) ; assertThat ( ids , contains ( "Organization/O1" , "Patient/P1" ) ) ; map = new SearchParameterMap ( ) ; map . setLastUpdated ( new DateRangeParam ( ) . setLowerBoundInclusive ( beforeOrg ) ) ; map . addInclude ( Patient . INCLUDE_ORGANIZATION ) ; ids = toUnqualifiedVersionlessIdValues ( myOrganizationDao . search ( map ) ) ; assertThat ( ids , contains ( "Organization/O1" ) ) ; map = new SearchParameterMap ( ) ; map . setLastUpdated ( new DateRangeParam ( ) . setLowerBoundInclusive ( afterAll ) ) ; map . addInclude ( Patient . INCLUDE_ORGANIZATION ) ; ids = toUnqualifiedVersionlessIdValues ( myOrganizationDao . search ( map ) ) ; assertThat ( ids , empty ( ) ) ; }
See #1053
 <p>
 Note that I don't know that _lastUpdate actually should apply to reverse includes.
See #1053 <p > Note that I don ' t know that _lastUpdate actually should apply to reverse includes .
// This gets updated in a sec.. // Everything should come back // Search before everything // Search after everything