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 c61a3ca367f..eca510cbe77 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 @@ -1,5 +1,7 @@ package ca.uhn.fhir.jpa.subscription; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.ChannelInterceptor; @@ -14,11 +16,12 @@ public class CountingInterceptor implements ChannelInterceptor { public int getSentCount(String theContainingKeyword) { return (int)mySent.stream().filter(t -> t.contains(theContainingKeyword)).count(); } - +private static final Logger ourLog = LoggerFactory.getLogger(CountingInterceptor.class); @Override - public void afterSendCompletion(Message message, MessageChannel channel, boolean sent, Exception ex) { - if (sent) { - mySent.add(message.toString()); + public void afterSendCompletion(Message theMessage, MessageChannel theChannel, boolean theSent, Exception theException) { + ourLog.info("Counting another instance: {}", theMessage); + if (theSent) { + mySent.add(theMessage.toString()); } } 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 0e68fcf5513..efbd2ae474b 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 = (int) myCountingInterceptor.getSentCount("Observation"); + int modCount = (int) myCountingInterceptor.getSentCount("Subscription"); ourClient.update().resource(subscription1).execute(); - waitForSize(modCount + 1, () -> myCountingInterceptor.getSentCount("Observation"), () -> myCountingInterceptor.toString()); + waitForSize(modCount + 2, () -> myCountingInterceptor.getSentCount("Subscription"), () -> 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 275b1becf6b..6160165c167 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,10 @@ 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("Observation"); + int modCount = myCountingInterceptor.getSentCount("Subscription"); + ourLog.info("** About to send another..."); ourClient.update().resource(subscription1).execute(); - waitForSize(modCount + 1, () -> myCountingInterceptor.getSentCount("Observation"), () -> myCountingInterceptor.toString()); + waitForSize(modCount + 2, () -> myCountingInterceptor.getSentCount("Subscription"), () -> myCountingInterceptor.toString()); ourLog.info("** About to send observation"); Observation observation2 = sendObservation(code, "SNOMED-CT");