From b5adef43ac2584884ca4df1880e39a59d6ff6a40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2020 18:13:51 +0000 Subject: [PATCH 1/3] Bump checkstyle from 8.18 to 8.29 Bumps [checkstyle](https://github.com/checkstyle/checkstyle) from 8.18 to 8.29. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-8.18...checkstyle-8.29) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 890013750e2..a58c10e91e4 100644 --- a/pom.xml +++ b/pom.xml @@ -1907,7 +1907,7 @@ com.puppycrawl.tools checkstyle - 8.18 + 8.29 From 9d59de14a9c0269dd77797bf6043f77e55474c19 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sun, 2 Feb 2020 20:07:55 -0500 Subject: [PATCH 2/3] 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); From 218f344945c907eb8d404df1a7ac3e6f8a4e16cd Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sun, 2 Feb 2020 20:34:53 -0500 Subject: [PATCH 3/3] Test fix working --- .../jpa/subscription/SubscriptionTriggeringSvcImpl.java | 4 +++- .../resthook/SubscriptionTriggeringDstu3Test.java | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionTriggeringSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionTriggeringSvcImpl.java index 32630819ce4..7cbf4ec0650 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionTriggeringSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionTriggeringSvcImpl.java @@ -386,7 +386,9 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc ScheduledJobDefinition jobDetail = new ScheduledJobDefinition(); jobDetail.setId(getClass().getName()); jobDetail.setJobClass(Job.class); - mySchedulerService.scheduleLocalJob(60 * DateUtils.MILLIS_PER_SECOND, jobDetail); + // Currently jobs ae kept in a local ArrayList so this should be a local job, and + // it can fire frequently without adding load + mySchedulerService.scheduleLocalJob(5 * DateUtils.MILLIS_PER_SECOND, jobDetail); } public static class Job implements HapiJob { 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 819ec9097ce..2395a9a9db3 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 @@ -46,6 +46,7 @@ import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; @@ -250,6 +251,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te mySubscriptionTriggeringSvc.runDeliveryPass(); waitForSize(33, ourUpdatedObservations); + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); mySubscriptionTriggeringSvc.runDeliveryPass(); mySubscriptionTriggeringSvc.runDeliveryPass(); waitForSize(51, ourUpdatedObservations); @@ -292,9 +295,11 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te mySubscriptionTriggeringSvc.runDeliveryPass(); mySubscriptionTriggeringSvc.runDeliveryPass(); mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); + mySubscriptionTriggeringSvc.runDeliveryPass(); assertEquals(0, ourCreatedPatients.size()); - assertEquals(ourUpdatedPatients.toString(), 3, ourUpdatedPatients.size()); + assertEquals(ourUpdatedPatients.stream().map(t->t.getId()).collect(Collectors.joining(", ")), 3, ourUpdatedPatients.size()); }