commit
f6868cce5c
|
@ -80,7 +80,8 @@ public class RestHookSubscriptionDstu2Interceptor extends BaseRestHookSubscripti
|
||||||
*/
|
*/
|
||||||
private void checkSubscriptions(IIdType idType, String resourceType, RestOperationTypeEnum theOperation) {
|
private void checkSubscriptions(IIdType idType, String resourceType, RestOperationTypeEnum theOperation) {
|
||||||
//avoid a ConcurrentModificationException by copying to an array
|
//avoid a ConcurrentModificationException by copying to an array
|
||||||
for (Object object : myRestHookSubscriptions.toArray()) {
|
Object[] subscriptions = myRestHookSubscriptions.toArray();
|
||||||
|
for (Object object : subscriptions) {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,9 +314,10 @@ public class RestHookSubscriptionR4Interceptor extends BaseRestHookSubscriptionI
|
||||||
Subscription subscription = (Subscription) theResource;
|
Subscription subscription = (Subscription) theResource;
|
||||||
if (subscription.getChannel() != null
|
if (subscription.getChannel() != null
|
||||||
&& subscription.getChannel().getType() == Subscription.SubscriptionChannelType.RESTHOOK
|
&& subscription.getChannel().getType() == Subscription.SubscriptionChannelType.RESTHOOK
|
||||||
&& subscription.getStatus() == Subscription.SubscriptionStatus.ACTIVE) {
|
&& subscription.getStatus() == Subscription.SubscriptionStatus.REQUESTED) {
|
||||||
removeLocalSubscription(subscription.getIdElement().getIdPart());
|
removeLocalSubscription(subscription.getIdElement().getIdPart());
|
||||||
myRestHookSubscriptions.add(subscription);
|
myRestHookSubscriptions.add(subscription);
|
||||||
|
subscription.setStatus(Subscription.SubscriptionStatus.ACTIVE);
|
||||||
ourLog.info("Subscription was added, id: {} - Have {}", subscription.getIdElement().getIdPart(), myRestHookSubscriptions.size());
|
ourLog.info("Subscription was added, id: {} - Have {}", subscription.getIdElement().getIdPart(), myRestHookSubscriptions.size());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -116,7 +116,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
|
ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
|
||||||
ourClient.registerInterceptor(new LoggingInterceptor(true));
|
ourClient.registerInterceptor(new LoggingInterceptor());
|
||||||
|
|
||||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||||
|
|
|
@ -151,7 +151,7 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
|
||||||
myFhirCtx.getRestfulClientFactory().setSocketTimeout(5000000);
|
myFhirCtx.getRestfulClientFactory().setSocketTimeout(5000000);
|
||||||
ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
|
ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
|
||||||
if (shouldLogClient()) {
|
if (shouldLogClient()) {
|
||||||
ourClient.registerInterceptor(new LoggingInterceptor(true));
|
ourClient.registerInterceptor(new LoggingInterceptor());
|
||||||
}
|
}
|
||||||
|
|
||||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
|
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.server.Server;
|
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
|
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
|
||||||
|
@ -38,6 +21,19 @@ import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.util.PortUtil;
|
import ca.uhn.fhir.util.PortUtil;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
import org.junit.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
|
@ -51,12 +47,19 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
|
||||||
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
|
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
|
||||||
|
private List<IIdType> mySubscriptionIds = new ArrayList<IIdType>();
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void afterUnregisterRestHookListener() {
|
public void afterUnregisterRestHookListener() {
|
||||||
|
for (IIdType next : mySubscriptionIds){
|
||||||
|
ourClient.delete().resourceById(next).execute();
|
||||||
|
}
|
||||||
|
mySubscriptionIds.clear();
|
||||||
|
|
||||||
myDaoConfig.setAllowMultipleDelete(true);
|
myDaoConfig.setAllowMultipleDelete(true);
|
||||||
ourLog.info("Deleting all subscriptions");
|
ourLog.info("Deleting all subscriptions");
|
||||||
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
|
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
|
||||||
|
ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
|
||||||
ourLog.info("Done deleting all subscriptions");
|
ourLog.info("Done deleting all subscriptions");
|
||||||
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
private Subscription createSubscription(String criteria, String payload, String endpoint) {
|
private Subscription createSubscription(String criteria, String payload, String endpoint) {
|
||||||
Subscription subscription = new Subscription();
|
Subscription subscription = new Subscription();
|
||||||
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
||||||
subscription.setStatus(SubscriptionStatusEnum.ACTIVE);
|
subscription.setStatus(SubscriptionStatusEnum.REQUESTED);
|
||||||
subscription.setCriteria(criteria);
|
subscription.setCriteria(criteria);
|
||||||
|
|
||||||
Channel channel = new Channel();
|
Channel channel = new Channel();
|
||||||
|
@ -88,6 +91,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
||||||
subscription.setId(methodOutcome.getId().getIdPart());
|
subscription.setId(methodOutcome.getId().getIdPart());
|
||||||
|
mySubscriptionIds.add(methodOutcome.getId());
|
||||||
|
|
||||||
return subscription;
|
return subscription;
|
||||||
}
|
}
|
||||||
|
@ -136,9 +140,9 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see two subscription notifications
|
// Should see one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(3, ourCreatedObservations.size());
|
assertEquals(2, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
|
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
|
||||||
|
@ -147,7 +151,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -160,7 +164,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
// Should see no subscription notification
|
// Should see no subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -174,7 +178,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(1, ourUpdatedObservations.size());
|
assertEquals(1, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
||||||
|
@ -222,9 +226,9 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see two subscription notifications
|
// Should see one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(3, ourCreatedObservations.size());
|
assertEquals(ourCreatedObservations.toString(), 2, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
|
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
|
||||||
|
@ -233,7 +237,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -246,7 +250,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
// Should see no subscription notification
|
// Should see no subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -260,7 +264,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(1, ourUpdatedObservations.size());
|
assertEquals(1, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
||||||
|
|
|
@ -1,54 +1,60 @@
|
||||||
|
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import static org.junit.Assert.fail;
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
|
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
||||||
import java.util.ArrayList;
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
import java.util.List;
|
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||||
|
import ca.uhn.fhir.rest.annotation.Update;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||||
|
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||||
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
import ca.uhn.fhir.util.PortUtil;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.*;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import static org.junit.Assert.assertEquals;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
import static org.junit.Assert.fail;
|
||||||
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
|
||||||
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
*/
|
*/
|
||||||
public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
private static List<String> ourContentTypes = new ArrayList<String>();
|
|
||||||
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
|
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu3Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
|
||||||
|
|
||||||
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
|
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
|
||||||
|
private List<IIdType> mySubscriptionIds = new ArrayList<>();
|
||||||
|
private static List<String> ourContentTypes = new ArrayList<>();
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void afterUnregisterRestHookListener() {
|
public void afterUnregisterRestHookListener() {
|
||||||
|
for (IIdType next : mySubscriptionIds){
|
||||||
|
ourClient.delete().resourceById(next).execute();
|
||||||
|
}
|
||||||
|
mySubscriptionIds.clear();
|
||||||
|
|
||||||
myDaoConfig.setAllowMultipleDelete(true);
|
myDaoConfig.setAllowMultipleDelete(true);
|
||||||
ourLog.info("Deleting all subscriptions");
|
ourLog.info("Deleting all subscriptions");
|
||||||
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
|
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
|
||||||
|
ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
|
||||||
ourLog.info("Done deleting all subscriptions");
|
ourLog.info("Done deleting all subscriptions");
|
||||||
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
||||||
|
|
||||||
|
@ -85,7 +91,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
private Subscription createSubscription(String theCriteria, String thePayload, String theEndpoint) {
|
private Subscription createSubscription(String theCriteria, String thePayload, String theEndpoint) {
|
||||||
Subscription subscription = new Subscription();
|
Subscription subscription = new Subscription();
|
||||||
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
||||||
subscription.setStatus(Subscription.SubscriptionStatus.ACTIVE);
|
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED);
|
||||||
subscription.setCriteria(theCriteria);
|
subscription.setCriteria(theCriteria);
|
||||||
|
|
||||||
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
|
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
|
||||||
|
@ -96,6 +102,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
||||||
subscription.setId(methodOutcome.getId().getIdPart());
|
subscription.setId(methodOutcome.getId().getIdPart());
|
||||||
|
mySubscriptionIds.add(methodOutcome.getId());
|
||||||
|
|
||||||
return subscription;
|
return subscription;
|
||||||
}
|
}
|
||||||
|
@ -163,21 +170,20 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
subscriptionTemp.setCriteria(criteria1);
|
subscriptionTemp.setCriteria(criteria1);
|
||||||
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
||||||
|
|
||||||
|
|
||||||
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see two subscription notifications
|
// Should see one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(3, ourCreatedObservations.size());
|
assertEquals(2, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
|
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
|
||||||
|
|
||||||
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -190,7 +196,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
// Should see no subscription notification
|
// Should see no subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -204,7 +210,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(1, ourUpdatedObservations.size());
|
assertEquals(1, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
||||||
|
@ -232,7 +238,6 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
|
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRestHookSubscriptionApplicationXml() throws Exception {
|
public void testRestHookSubscriptionApplicationXml() throws Exception {
|
||||||
String payload = "application/xml";
|
String payload = "application/xml";
|
||||||
|
@ -258,21 +263,20 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
subscriptionTemp.setCriteria(criteria1);
|
subscriptionTemp.setCriteria(criteria1);
|
||||||
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
||||||
|
|
||||||
|
|
||||||
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see two subscription notifications
|
// Should see one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(3, ourCreatedObservations.size());
|
assertEquals(ourCreatedObservations.toString(), 2, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
|
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
|
||||||
|
|
||||||
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -285,7 +289,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
// Should see no subscription notification
|
// Should see no subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -299,7 +303,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(1, ourUpdatedObservations.size());
|
assertEquals(1, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
||||||
|
@ -309,7 +313,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerPort = RandomServerPortProvider.findFreePort();
|
ourListenerPort = PortUtil.findFreePort();
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forDstu3());
|
ourListenerRestServer = new RestfulServer(FhirContext.forDstu3());
|
||||||
ourListenerServerBase = "http://localhost:" + ourListenerPort + "/fhir/context";
|
ourListenerServerBase = "http://localhost:" + ourListenerPort + "/fhir/context";
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,60 @@
|
||||||
|
|
||||||
package ca.uhn.fhir.jpa.subscription.r4;
|
package ca.uhn.fhir.jpa.subscription.r4;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
|
||||||
import org.eclipse.jetty.server.Server;
|
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
|
||||||
import org.hl7.fhir.r4.model.*;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
import org.junit.*;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
||||||
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
|
import ca.uhn.fhir.jpa.subscription.RestHookTestDstu2Test;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||||
|
import ca.uhn.fhir.rest.annotation.Update;
|
||||||
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
import ca.uhn.fhir.util.PortUtil;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
import org.hl7.fhir.r4.model.*;
|
||||||
|
import org.junit.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the rest-hook subscriptions
|
* Test the rest-hook subscriptions
|
||||||
*/
|
*/
|
||||||
public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
private static List<String> ourContentTypes = new ArrayList<String>();
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
|
||||||
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
|
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
|
||||||
private static int ourListenerPort;
|
private static int ourListenerPort;
|
||||||
private static RestfulServer ourListenerRestServer;
|
private static RestfulServer ourListenerRestServer;
|
||||||
private static Server ourListenerServer;
|
private static Server ourListenerServer;
|
||||||
private static String ourListenerServerBase;
|
private static String ourListenerServerBase;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestR4Test.class);
|
|
||||||
|
|
||||||
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
|
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
|
||||||
|
private static List<String> ourContentTypes = new ArrayList<>();
|
||||||
|
private List<IIdType> mySubscriptionIds = new ArrayList<>();
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void afterUnregisterRestHookListener() {
|
public void afterUnregisterRestHookListener() {
|
||||||
|
for (IIdType next : mySubscriptionIds) {
|
||||||
|
ourClient.delete().resourceById(next).execute();
|
||||||
|
}
|
||||||
|
mySubscriptionIds.clear();
|
||||||
|
|
||||||
myDaoConfig.setAllowMultipleDelete(true);
|
myDaoConfig.setAllowMultipleDelete(true);
|
||||||
ourLog.info("Deleting all subscriptions");
|
ourLog.info("Deleting all subscriptions");
|
||||||
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
|
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
|
||||||
|
ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
|
||||||
ourLog.info("Done deleting all subscriptions");
|
ourLog.info("Done deleting all subscriptions");
|
||||||
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
|
||||||
|
|
||||||
|
@ -81,11 +87,10 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Subscription createSubscription(String theCriteria, String thePayload, String theEndpoint) {
|
private Subscription createSubscription(String theCriteria, String thePayload, String theEndpoint) {
|
||||||
Subscription subscription = new Subscription();
|
Subscription subscription = new Subscription();
|
||||||
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
||||||
subscription.setStatus(Subscription.SubscriptionStatus.ACTIVE);
|
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED);
|
||||||
subscription.setCriteria(theCriteria);
|
subscription.setCriteria(theCriteria);
|
||||||
|
|
||||||
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
|
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
|
||||||
|
@ -96,6 +101,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
||||||
subscription.setId(methodOutcome.getId().getIdPart());
|
subscription.setId(methodOutcome.getId().getIdPart());
|
||||||
|
mySubscriptionIds.add(methodOutcome.getId());
|
||||||
|
|
||||||
return subscription;
|
return subscription;
|
||||||
}
|
}
|
||||||
|
@ -163,21 +169,20 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
subscriptionTemp.setCriteria(criteria1);
|
subscriptionTemp.setCriteria(criteria1);
|
||||||
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
||||||
|
|
||||||
|
|
||||||
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see two subscription notifications
|
// Should see one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(3, ourCreatedObservations.size());
|
assertEquals(2, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
|
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
|
||||||
|
|
||||||
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -190,7 +195,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
// Should see no subscription notification
|
// Should see no subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -204,7 +209,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(1, ourUpdatedObservations.size());
|
assertEquals(1, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
||||||
|
@ -232,7 +237,6 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
|
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRestHookSubscriptionApplicationXml() throws Exception {
|
public void testRestHookSubscriptionApplicationXml() throws Exception {
|
||||||
String payload = "application/xml";
|
String payload = "application/xml";
|
||||||
|
@ -258,21 +262,20 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
subscriptionTemp.setCriteria(criteria1);
|
subscriptionTemp.setCriteria(criteria1);
|
||||||
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
|
||||||
|
|
||||||
|
|
||||||
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
Observation observation2 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see two subscription notifications
|
// Should see one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(3, ourCreatedObservations.size());
|
assertEquals(ourCreatedObservations.toString(), 2, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
|
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
|
||||||
|
|
||||||
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -285,7 +288,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
// Should see no subscription notification
|
// Should see no subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(0, ourUpdatedObservations.size());
|
assertEquals(0, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
|
||||||
|
@ -299,7 +302,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
// Should see only one subscription notification
|
// Should see only one subscription notification
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
assertEquals(4, ourCreatedObservations.size());
|
assertEquals(3, ourCreatedObservations.size());
|
||||||
assertEquals(1, ourUpdatedObservations.size());
|
assertEquals(1, ourUpdatedObservations.size());
|
||||||
|
|
||||||
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
|
||||||
|
@ -309,7 +312,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void startListenerServer() throws Exception {
|
public static void startListenerServer() throws Exception {
|
||||||
ourListenerPort = RandomServerPortProvider.findFreePort();
|
ourListenerPort = PortUtil.findFreePort();
|
||||||
ourListenerRestServer = new RestfulServer(FhirContext.forR4());
|
ourListenerRestServer = new RestfulServer(FhirContext.forR4());
|
||||||
ourListenerServerBase = "http://localhost:" + ourListenerPort + "/fhir/context";
|
ourListenerServerBase = "http://localhost:" + ourListenerPort + "/fhir/context";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue