From 8c0b6655656cfa6f093065bce9849059eed69463 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sat, 10 Oct 2015 10:06:41 -0400 Subject: [PATCH] Fix subscription issue --- .../ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 2 +- .../dao/FhirResourceDaoSubscriptionDstu2.java | 9 ++++-- .../FhirResourceDaoDstu2SubscriptionTest.java | 29 ++++++++++--------- hapi-fhir-jpaserver-example/.gitignore | 1 + 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index 0fa5f897246..30ea8766463 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -1233,7 +1233,7 @@ public abstract class BaseHapiFhirDao implements IDao { boolean paramsUriPopulated = theEntity.isParamsUriPopulated(); boolean hasLinks = theEntity.isHasLinks(); - Collection paramsString = new ArrayList(theEntity.getParamsString()); + Collection paramsString = new ArrayList(theEntity.getParamsString()); // TODO: use the isPopulated method to decide whether to call this Collection paramsToken = new ArrayList(theEntity.getParamsToken()); Collection paramsNumber = new ArrayList(theEntity.getParamsNumber()); Collection paramsQuantity = new ArrayList(theEntity.getParamsQuantity()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java index 7f6719cd3c7..b47d93cb204 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSubscriptionDstu2.java @@ -116,6 +116,7 @@ public class FhirResourceDaoSubscriptionDstu2 extends FhirResourceDaoDstu2() { @Override public Integer doInTransaction(TransactionStatus theStatus) { + SubscriptionTable nextSubscriptionTable = mySubscriptionTableDao.findOne(nextSubscriptionTablePid); return pollForNewUndeliveredResources(nextSubscriptionTable); } }); @@ -156,7 +157,7 @@ public class FhirResourceDaoSubscriptionDstu2 extends FhirResourceDaoDstu2 results; - List resultIds; - - mySubscriptionDao.pollForNewUndeliveredResources(); - assertEquals(2, mySubscriptionFlaggedResourceDataDao.count()); + assertEquals(2, mySubscriptionDao.pollForNewUndeliveredResources()); + assertEquals(3, mySubscriptionFlaggedResourceDataDao.count()); Thread.sleep(100); mySubscriptionDao.pollForNewUndeliveredResources(); - assertEquals(2, mySubscriptionFlaggedResourceDataDao.count()); + assertEquals(3, mySubscriptionFlaggedResourceDataDao.count()); Thread.sleep(100); mySubscriptionDao.pollForNewUndeliveredResources(); - assertEquals(2, mySubscriptionFlaggedResourceDataDao.count()); + assertEquals(3, mySubscriptionFlaggedResourceDataDao.count()); Thread.sleep(100); @@ -450,12 +451,12 @@ public class FhirResourceDaoDstu2SubscriptionTest extends BaseJpaDstu2Test { myObservationDao.create(obs).getId().toUnqualifiedVersionless(); mySubscriptionDao.pollForNewUndeliveredResources(); - assertEquals(3, mySubscriptionFlaggedResourceDataDao.count()); + assertEquals(4, mySubscriptionFlaggedResourceDataDao.count()); Thread.sleep(100); mySubscriptionDao.pollForNewUndeliveredResources(); - assertEquals(3, mySubscriptionFlaggedResourceDataDao.count()); + assertEquals(4, mySubscriptionFlaggedResourceDataDao.count()); } diff --git a/hapi-fhir-jpaserver-example/.gitignore b/hapi-fhir-jpaserver-example/.gitignore index 271ee2518a7..f59bdf9b9af 100644 --- a/hapi-fhir-jpaserver-example/.gitignore +++ b/hapi-fhir-jpaserver-example/.gitignore @@ -1,6 +1,7 @@ /target /jpaserver_derby_files *.log +ca.uhn.fhir.jpa.entity.ResourceTable/ # Created by https://www.gitignore.io