fixing more tests for Windows

This commit is contained in:
Ken Stevens 2019-01-21 22:28:48 -05:00
parent c92cbdd3e2
commit 6b22977d7c
5 changed files with 8 additions and 4 deletions

View File

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

View File

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

View File

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

View File

@ -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();

View File

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