Fixing occasionally failing test
This commit is contained in:
parent
f7f69f6148
commit
6b366a58f7
|
@ -49,6 +49,11 @@ public abstract class BaseJpaTest {
|
||||||
protected ArrayList<IServerInterceptor> myServerInterceptorList;
|
protected ArrayList<IServerInterceptor> myServerInterceptorList;
|
||||||
protected IRequestOperationCallback myRequestOperationCallback = mock(IRequestOperationCallback.class);
|
protected IRequestOperationCallback myRequestOperationCallback = mock(IRequestOperationCallback.class);
|
||||||
|
|
||||||
|
@After
|
||||||
|
public final void afterPerformCleanup() {
|
||||||
|
BaseHapiFhirResourceDao.setDisableIncrementOnUpdateForUnitTest(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void beforeCreateSrd() {
|
public void beforeCreateSrd() {
|
||||||
mySrd = mock(ServletRequestDetails.class, Mockito.RETURNS_DEEP_STUBS);
|
mySrd = mock(ServletRequestDetails.class, Mockito.RETURNS_DEEP_STUBS);
|
||||||
|
@ -58,11 +63,6 @@ public abstract class BaseJpaTest {
|
||||||
when(mySrd.getUserData()).thenReturn(new HashMap<>());
|
when(mySrd.getUserData()).thenReturn(new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
|
||||||
public final void afterPerformCleanup() {
|
|
||||||
BaseHapiFhirResourceDao.setDisableIncrementOnUpdateForUnitTest(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract FhirContext getContext();
|
protected abstract FhirContext getContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +159,20 @@ public abstract class BaseJpaTest {
|
||||||
|
|
||||||
protected List<IIdType> toUnqualifiedVersionlessIds(IBundleProvider theFound) {
|
protected List<IIdType> toUnqualifiedVersionlessIds(IBundleProvider theFound) {
|
||||||
List<IIdType> retVal = new ArrayList<IIdType>();
|
List<IIdType> retVal = new ArrayList<IIdType>();
|
||||||
int size = theFound.size();
|
Integer size = theFound.size();
|
||||||
|
StopWatch sw = new StopWatch();
|
||||||
|
while (size == null) {
|
||||||
|
int timeout = 20000;
|
||||||
|
if (sw.getMillis() > timeout) {
|
||||||
|
fail("Waited over "+timeout+"ms for search");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException theE) {
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ourLog.info("Found {} results", size);
|
ourLog.info("Found {} results", size);
|
||||||
List<IBaseResource> resources = theFound.getResources(0, size);
|
List<IBaseResource> resources = theFound.getResources(0, size);
|
||||||
for (IBaseResource next : resources) {
|
for (IBaseResource next : resources) {
|
||||||
|
|
Loading…
Reference in New Issue