diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java index f3baaf0a5c4..f0c2dc5ae00 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java @@ -159,16 +159,15 @@ public abstract class BaseJpaTest { return retVal; } - protected List toUnqualifiedVersionlessIds(IBundleProvider theFound) { - PersistedJpaBundleProvider provider = (PersistedJpaBundleProvider) theFound; + protected List toUnqualifiedVersionlessIds(IBundleProvider theProvider) { List retVal = new ArrayList<>(); - Integer size = provider.size(); + Integer size = theProvider.size(); StopWatch sw = new StopWatch(); while (size == null) { int timeout = 20000; if (sw.getMillis() > timeout) { - String message = "Waited over " + timeout + "ms for search " + provider.getUuid(); + String message = "Waited over " + timeout + "ms for search " + theProvider.getUuid(); ourLog.info(message); fail(message); } @@ -177,12 +176,16 @@ public abstract class BaseJpaTest { } catch (InterruptedException theE) { //ignore } - provider.clearCachedDataForUnitTest(); - size = provider.size(); + + if (theProvider instanceof PersistedJpaBundleProvider) { + PersistedJpaBundleProvider provider = (PersistedJpaBundleProvider) theFound; + provider.clearCachedDataForUnitTest(); + } + size = theProvider.size(); } ourLog.info("Found {} results", size); - List resources = provider.getResources(0, size); + List resources = theProvider.getResources(0, size); for (IBaseResource next : resources) { retVal.add(next.getIdElement().toUnqualifiedVersionless()); }