Work on getting tests passing

This commit is contained in:
James Agnew 2017-08-14 20:00:59 -04:00
parent 5e0a7672b7
commit 6bbfec381f
5 changed files with 12 additions and 23 deletions

View File

@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.subscription;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
import ca.uhn.fhir.jpa.subscription.dstu2.RestHookSubscriptionDstu2Interceptor;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.resource.Observation;
@ -279,14 +280,19 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
Assert.assertFalse(observation2.getId().isEmpty());
}
private void waitForQueueToDrain() throws InterruptedException {
public static void waitForQueueToDrain(BaseSubscriptionInterceptor theRestHookSubscriptionInterceptor) throws InterruptedException {
Thread.sleep(500);
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
while (ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size() > 0) {
Thread.sleep(250);
Thread.sleep(500);
}
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
}
private void waitForQueueToDrain() throws InterruptedException {
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}
@BeforeClass
public static void startListenerServer() throws Exception {
ourListenerPort = PortUtil.findFreePort();

View File

@ -151,11 +151,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
}
private void waitForQueueToDrain() throws InterruptedException {
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
while (ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size() > 0) {
Thread.sleep(250);
}
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}
@Test

View File

@ -75,12 +75,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
}
private void waitForQueueToDrain() throws InterruptedException {
Thread.sleep(1000);
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
while (ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size() > 0) {
Thread.sleep(250);
}
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}

View File

@ -84,11 +84,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
}
private void waitForQueueToDrain() throws InterruptedException {
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
while (ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size() > 0) {
Thread.sleep(250);
}
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}
private Observation sendObservation(String code, String system) throws InterruptedException {

View File

@ -316,11 +316,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
}
private void waitForQueueToDrain() throws InterruptedException {
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
while (ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size() > 0) {
Thread.sleep(250);
}
ourLog.info("QUEUE HAS {} ITEMS", ourRestHookSubscriptionInterceptor.getExecutorQueueForUnitTests().size());
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}
@BeforeClass