Merge branch 'ks-20200131-near-search-http' of https://github.com/jamesagnew/hapi-fhir into ks-20200131-near-search-http
This commit is contained in:
commit
191a756840
|
@ -386,7 +386,9 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
|
||||||
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
ScheduledJobDefinition jobDetail = new ScheduledJobDefinition();
|
||||||
jobDetail.setId(getClass().getName());
|
jobDetail.setId(getClass().getName());
|
||||||
jobDetail.setJobClass(Job.class);
|
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 {
|
public static class Job implements HapiJob {
|
||||||
|
|
|
@ -46,6 +46,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -56,10 +57,6 @@ import static org.junit.Assert.fail;
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@TestPropertySource(properties = {
|
|
||||||
UnregisterScheduledProcessor.SCHEDULING_DISABLED + "=false"
|
|
||||||
})
|
|
||||||
@DirtiesContext
|
|
||||||
public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SubscriptionTriggeringDstu3Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SubscriptionTriggeringDstu3Test.class);
|
||||||
|
@ -194,6 +191,9 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
waitForQueueToDrain();
|
waitForQueueToDrain();
|
||||||
|
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
|
||||||
waitForSize(0, ourCreatedObservations);
|
waitForSize(0, ourCreatedObservations);
|
||||||
waitForSize(2, ourUpdatedObservations);
|
waitForSize(2, ourUpdatedObservations);
|
||||||
|
|
||||||
|
@ -248,6 +248,13 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
waitForSize(33, ourUpdatedObservations);
|
||||||
|
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
waitForSize(51, ourUpdatedObservations);
|
waitForSize(51, ourUpdatedObservations);
|
||||||
waitForSize(0, ourCreatedObservations);
|
waitForSize(0, ourCreatedObservations);
|
||||||
waitForSize(0, ourCreatedPatients);
|
waitForSize(0, ourCreatedPatients);
|
||||||
|
@ -284,8 +291,15 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
waitForSize(0, ourCreatedPatients);
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
waitForSize(3, ourUpdatedPatients);
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
|
||||||
|
assertEquals(0, ourCreatedPatients.size());
|
||||||
|
assertEquals(ourUpdatedPatients.stream().map(t->t.getId()).collect(Collectors.joining(", ")), 3, ourUpdatedPatients.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,6 +330,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
|
||||||
waitForSize(0, ourCreatedPatients);
|
waitForSize(0, ourCreatedPatients);
|
||||||
waitForSize(3, ourUpdatedPatients);
|
waitForSize(3, ourUpdatedPatients);
|
||||||
|
|
||||||
|
@ -367,6 +383,9 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
|
||||||
waitForSize(10, ourUpdatedObservations);
|
waitForSize(10, ourUpdatedObservations);
|
||||||
waitForSize(0, ourCreatedObservations);
|
waitForSize(0, ourCreatedObservations);
|
||||||
waitForSize(0, ourCreatedPatients);
|
waitForSize(0, ourCreatedPatients);
|
||||||
|
@ -421,6 +440,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
|
||||||
waitForSize(20, ourUpdatedObservations);
|
waitForSize(20, ourUpdatedObservations);
|
||||||
waitForSize(0, ourCreatedObservations);
|
waitForSize(0, ourCreatedObservations);
|
||||||
waitForSize(0, ourCreatedPatients);
|
waitForSize(0, ourCreatedPatients);
|
||||||
|
@ -458,6 +479,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
|
||||||
|
|
||||||
waitForQueueToDrain();
|
waitForQueueToDrain();
|
||||||
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
|
|
||||||
waitForSize(0, ourCreatedObservations);
|
waitForSize(0, ourCreatedObservations);
|
||||||
waitForSize(1, ourUpdatedObservations);
|
waitForSize(1, ourUpdatedObservations);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue