Test fixes

This commit is contained in:
James Agnew 2019-10-28 10:58:14 -04:00
parent d321a8276a
commit 2b8426114f
3 changed files with 12 additions and 8 deletions

View File

@ -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());
}
}

View File

@ -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");

View File

@ -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");