Fix intermittent

This commit is contained in:
James Agnew 2019-10-28 10:45:39 -04:00
parent 75ad205bd5
commit d321a8276a
3 changed files with 6 additions and 6 deletions

View File

@ -11,8 +11,8 @@ public class CountingInterceptor implements ChannelInterceptor {
private List<String> mySent = new ArrayList<>(); private List<String> mySent = new ArrayList<>();
public int getSentCount() { public int getSentCount(String theContainingKeyword) {
return mySent.size(); return (int)mySent.stream().filter(t -> t.contains(theContainingKeyword)).count();
} }
@Override @Override

View File

@ -305,9 +305,9 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true"));
ourLog.info("** About to update subscription"); ourLog.info("** About to update subscription");
int modCount = myCountingInterceptor.getSentCount(); int modCount = (int) myCountingInterceptor.getSentCount("Observation");
ourClient.update().resource(subscription1).execute(); ourClient.update().resource(subscription1).execute();
waitForSize(modCount + 1, () -> myCountingInterceptor.getSentCount(), () -> myCountingInterceptor.toString()); waitForSize(modCount + 1, () -> myCountingInterceptor.getSentCount("Observation"), () -> myCountingInterceptor.toString());
ourLog.info("** About to send observation"); ourLog.info("** About to send observation");
Observation observation2 = sendObservation(code, "SNOMED-CT"); Observation observation2 = sendObservation(code, "SNOMED-CT");

View File

@ -303,9 +303,9 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true"));
ourLog.info("** About to update subscription"); ourLog.info("** About to update subscription");
int modCount = myCountingInterceptor.getSentCount(); int modCount = myCountingInterceptor.getSentCount("Observation");
ourClient.update().resource(subscription1).execute(); ourClient.update().resource(subscription1).execute();
waitForSize(modCount + 1, () -> myCountingInterceptor.getSentCount(), () -> myCountingInterceptor.toString()); waitForSize(modCount + 1, () -> myCountingInterceptor.getSentCount("Observation"), () -> myCountingInterceptor.toString());
ourLog.info("** About to send observation"); ourLog.info("** About to send observation");
Observation observation2 = sendObservation(code, "SNOMED-CT"); Observation observation2 = sendObservation(code, "SNOMED-CT");