From 9d59de14a9c0269dd77797bf6043f77e55474c19 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sun, 2 Feb 2020 20:07:55 -0500 Subject: [PATCH] Unit test fix --- .../SubscriptionTriggeringDstu3Test.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java index 20b7cc1f52b..819ec9097ce 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java @@ -56,10 +56,6 @@ import static org.junit.Assert.fail; * Test the rest-hook subscriptions */ @SuppressWarnings("Duplicates") -@TestPropertySource(properties = { - UnregisterScheduledProcessor.SCHEDULING_DISABLED + "=false" -}) -@DirtiesContext public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Test { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SubscriptionTriggeringDstu3Test.class); @@ -194,6 +190,9 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); waitForQueueToDrain(); + + mySubscriptionTriggeringSvc.runDeliveryPass(); + waitForSize(0, ourCreatedObservations); waitForSize(2, ourUpdatedObservations); @@ -248,6 +247,11 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te responseValue = response.getParameter().get(0).getValue().primitiveValue(); assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); + mySubscriptionTriggeringSvc.runDeliveryPass(); + waitForSize(33, ourUpdatedObservations); + + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); waitForSize(51, ourUpdatedObservations); waitForSize(0, ourCreatedObservations); waitForSize(0, ourCreatedPatients); @@ -284,8 +288,13 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te String responseValue = response.getParameter().get(0).getValue().primitiveValue(); assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); - waitForSize(0, ourCreatedPatients); - waitForSize(3, ourUpdatedPatients); + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); + + assertEquals(0, ourCreatedPatients.size()); + assertEquals(ourUpdatedPatients.toString(), 3, ourUpdatedPatients.size()); } @@ -316,6 +325,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te String responseValue = response.getParameter().get(0).getValue().primitiveValue(); assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); + mySubscriptionTriggeringSvc.runDeliveryPass(); + waitForSize(0, ourCreatedPatients); waitForSize(3, ourUpdatedPatients); @@ -367,6 +378,9 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te responseValue = response.getParameter().get(0).getValue().primitiveValue(); assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); + waitForSize(10, ourUpdatedObservations); waitForSize(0, ourCreatedObservations); waitForSize(0, ourCreatedPatients); @@ -421,6 +435,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te String responseValue = response.getParameter().get(0).getValue().primitiveValue(); assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); + mySubscriptionTriggeringSvc.runDeliveryPass(); + waitForSize(20, ourUpdatedObservations); waitForSize(0, ourCreatedObservations); waitForSize(0, ourCreatedPatients); @@ -458,6 +474,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID")); waitForQueueToDrain(); + mySubscriptionTriggeringSvc.runDeliveryPass(); + waitForSize(0, ourCreatedObservations); waitForSize(1, ourUpdatedObservations);