From d321a8276a1b7fc1f8f594172b0aaf8cc40aed89 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Mon, 28 Oct 2019 10:45:39 -0400 Subject: [PATCH] Fix intermittent --- .../ca/uhn/fhir/jpa/subscription/CountingInterceptor.java | 4 ++-- .../fhir/jpa/subscription/resthook/RestHookTestR4Test.java | 4 ++-- .../fhir/jpa/subscription/resthook/RestHookTestR5Test.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/CountingInterceptor.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/CountingInterceptor.java index 250c1b99efd..c61a3ca367f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/CountingInterceptor.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/CountingInterceptor.java @@ -11,8 +11,8 @@ public class CountingInterceptor implements ChannelInterceptor { private List mySent = new ArrayList<>(); - public int getSentCount() { - return mySent.size(); + public int getSentCount(String theContainingKeyword) { + return (int)mySent.stream().filter(t -> t.contains(theContainingKeyword)).count(); } @Override diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java index ba5091e86bf..0e68fcf5513 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java @@ -305,9 +305,9 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); ourLog.info("** About to update subscription"); - int modCount = myCountingInterceptor.getSentCount(); + int modCount = (int) myCountingInterceptor.getSentCount("Observation"); 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"); Observation observation2 = sendObservation(code, "SNOMED-CT"); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java index f17b3edc547..275b1becf6b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java @@ -303,9 +303,9 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test { .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); ourLog.info("** About to update subscription"); - int modCount = myCountingInterceptor.getSentCount(); + int modCount = myCountingInterceptor.getSentCount("Observation"); 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"); Observation observation2 = sendObservation(code, "SNOMED-CT");