From 6b22977d7c464259f392f267d03ae6c94e37c62c Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Mon, 21 Jan 2019 22:28:48 -0500 Subject: [PATCH] fixing more tests for Windows --- .../jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java | 3 ++- .../fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java | 1 + .../ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java | 1 + .../uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java | 4 ++-- .../ca/uhn/fhir/jpa/subscription/module/LatchedService.java | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java index 7bfd40cfb5c..9662d068099 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java @@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.searchparam.SearchParamConstants; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.dao.data.ISearchParamPresentDao; import ca.uhn.fhir.jpa.model.entity.*; +import ca.uhn.fhir.jpa.util.TestUtil; import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.dstu2.composite.*; @@ -19,7 +20,6 @@ import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.util.TestUtil; import org.apache.commons.lang3.StringUtils; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -858,6 +858,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test { SearchParameterMap params; Date startDate = new Date(start); + TestUtil.sleepOneClick(); Date endDate = new Date(end); DateTimeDt startDateTime = new DateTimeDt(startDate, TemporalPrecisionEnum.MILLI); DateTimeDt endDateTime = new DateTimeDt(endDate, TemporalPrecisionEnum.MILLI); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java index 7810878bc0e..8300f487fd7 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java @@ -1469,6 +1469,7 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test { SearchParameterMap map; Date startDate = new Date(start); + TestUtil.sleepOneClick(); Date endDate = new Date(end); DateTimeType startDateTime = new DateTimeType(startDate, TemporalPrecisionEnum.MILLI); DateTimeType endDateTime = new DateTimeType(endDate, TemporalPrecisionEnum.MILLI); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java index 06e3dc75327..b1f7d1b2c4c 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java @@ -338,6 +338,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test { assertEquals("Patient", details.getResourceType()); assertEquals(Patient.class, details.getResource().getClass()); + TestUtil.sleepOneClick(); Date now2 = new Date(); Patient retrieved2 = myPatientDao.read(outcome.getId().toVersionless(), mySrd); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java index 40c0b4012e9..16ed5ca99cb 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java @@ -165,8 +165,8 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { assertEquals(1, results1.getEntry().size()); assertEquals(1, mySearchEntityDao.count()); assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); - assertThat(results1.getMeta().getLastUpdated(), greaterThan(beforeFirst)); - assertThat(results1.getMeta().getLastUpdated(), lessThan(new Date())); + assertThat(TestUtil.getTimestamp(results1).getValue(), greaterThan(beforeFirst)); + assertThat(TestUtil.getTimestamp(results1).getValue(), lessThan(new Date())); assertThat(results1.getId(), not(blankOrNullString())); Patient pt2 = new Patient(); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/LatchedService.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/LatchedService.java index 6e638bdfd36..0bb32a97fe5 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/LatchedService.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/LatchedService.java @@ -17,6 +17,7 @@ import static org.junit.Assert.assertTrue; public class LatchedService implements IAnonymousLambdaHook { private static final Logger ourLog = LoggerFactory.getLogger(LatchedService.class); + private static final int DEFAULT_TIMEOUT_SECONDS = 20; private final String name; private CountDownLatch myCountdownLatch; @@ -48,7 +49,7 @@ public class LatchedService implements IAnonymousLambdaHook { } public void awaitExpected() throws InterruptedException { - awaitExpectedWithTimeout(10); + awaitExpectedWithTimeout(DEFAULT_TIMEOUT_SECONDS); } public void awaitExpectedWithTimeout(int timeoutSecond) throws InterruptedException {