Use correct verb for rest hook notifications

This commit is contained in:
James 2017-08-19 19:14:52 -04:00
parent e3a28e2ff5
commit 46c04488de
9 changed files with 252 additions and 253 deletions

View File

@ -34,7 +34,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.SubscribableChannel;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@ -44,10 +43,36 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class SubscriptionDeliveringRestHookSubscriber extends BaseSubscriptionSubscriber {
private Logger ourLog = LoggerFactory.getLogger(SubscriptionDeliveringRestHookSubscriber.class);
public SubscriptionDeliveringRestHookSubscriber(IFhirResourceDao theSubscriptionDao, ConcurrentHashMap<String, IBaseResource> theIdToSubscription, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor) {
public SubscriptionDeliveringRestHookSubscriber(IFhirResourceDao<?> theSubscriptionDao, ConcurrentHashMap<String, IBaseResource> theIdToSubscription, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor) {
super(theSubscriptionDao, theIdToSubscription, theChannelType, theSubscriptionInterceptor);
}
protected void deliverPayload(ResourceDeliveryMessage theMsg, IBaseResource theSubscription, EncodingEnum thePayloadType, IGenericClient theClient) {
IBaseResource payloadResource = theMsg.getPayoad();
IClientExecutable<?, ?> operation;
switch (theMsg.getOperationType()) {
case CREATE:
operation = theClient.update().resource(payloadResource);
break;
case UPDATE:
operation = theClient.update().resource(payloadResource);
break;
case DELETE:
operation = theClient.delete().resourceById(theMsg.getPayloadId());
break;
default:
ourLog.warn("Ignoring delivery message of type: {}", theMsg.getOperationType());
return;
}
operation.encoded(thePayloadType);
ourLog.info("Delivering {} rest-hook payload {} for {}", theMsg.getOperationType(), payloadResource.getIdElement().toUnqualified().getValue(), theSubscription.getIdElement().toUnqualifiedVersionless().getValue());
operation.execute();
}
@Override
public void handleMessage(Message<?> theMessage) throws MessagingException {
if (!(theMessage.getPayload() instanceof ResourceDeliveryMessage)) {
@ -89,37 +114,8 @@ public class SubscriptionDeliveringRestHookSubscriber extends BaseSubscriptionSu
}
}
msg = massage(msg);
IBaseResource payloadResource = msg.getPayoad();
IClientExecutable<?, ?> operation;
switch (msg.getOperationType()) {
case CREATE:
operation = client.create().resource(payloadResource);
break;
case UPDATE:
operation = client.update().resource(payloadResource);
break;
case DELETE:
operation = client.delete().resourceById(msg.getPayloadId());
break;
default:
ourLog.warn("Ignoring delivery message of type: {}", msg.getOperationType());
return;
}
operation.encoded(payloadType);
ourLog.info("Delivering {} rest-hook payload {} for {}", msg.getOperationType(), payloadResource.getIdElement().toUnqualified().getValue(), subscription.getIdElement().toUnqualifiedVersionless().getValue());
operation.execute();
deliverPayload(msg, subscription, payloadType, client);
}
/**
* Subclasses may override
*/
protected ResourceDeliveryMessage massage(ResourceDeliveryMessage theMsg) {
return theMsg;
}
}

View File

@ -148,8 +148,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -163,8 +163,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForQueueToDrain();
// Should see one subscription notification
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
// Delet one subscription
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
@ -173,8 +173,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
@ -186,8 +186,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -200,8 +200,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -223,9 +223,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -237,8 +236,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see one subscription notification
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
@ -246,8 +245,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
@ -259,8 +258,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -273,8 +272,8 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());

View File

@ -34,15 +34,15 @@ import static org.junit.Assert.fail;
*/
public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
private static List<Observation> ourCreatedObservations = Lists.newArrayList();
private static int ourListenerPort;
private static RestfulServer ourListenerRestServer;
private static Server ourListenerServer;
private static String ourListenerServerBase;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestDstu2Test.class);
private static List<Observation> ourUpdatedObservations = Lists.newArrayList();
private List<IIdType> mySubscriptionIds = new ArrayList<>();
private static List<String> ourContentTypes = new ArrayList<>();
private List<IIdType> mySubscriptionIds = new ArrayList<>();
@After
public void afterUnregisterRestHookListener() {
@ -74,23 +74,6 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
ourContentTypes.clear();
}
// TODO: Reenable this
@Test
@Ignore
public void testRestHookSubscriptionInvalidCriteria() throws Exception {
String payload = "application/xml";
String criteria1 = "Observation?codeeeee=SNOMED-CT";
try {
createSubscription(criteria1, payload, ourListenerServerBase);
fail();
} catch (InvalidRequestException e) {
assertEquals("HTTP 400 Bad Request: Invalid criteria: Failed to parse match URL[Observation?codeeeee=SNOMED-CT] - Resource type Observation does not have a parameter with name: codeeeee", e.getMessage());
}
}
private Subscription createSubscription(String theCriteria, String thePayload, String theEndpoint) throws InterruptedException {
Subscription subscription = new Subscription();
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
@ -129,7 +112,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
return observation;
}
@Test
public void testRestHookSubscriptionApplicationFhirJson() throws Exception {
String payload = "application/fhir+json";
@ -145,15 +128,11 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
}
private void waitForQueueToDrain() throws InterruptedException {
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}
@Test
public void testRestHookSubscriptionApplicationJson() throws Exception {
String payload = "application/json";
@ -169,8 +148,8 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
// Modify subscription 2 to also match
@ -185,8 +164,8 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see one subscription notification
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
@ -195,8 +174,8 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -208,8 +187,8 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -222,8 +201,85 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
Assert.assertFalse(observation2.getId().isEmpty());
}
@Test
public void testRestHookSubscriptionApplicationXml() throws Exception {
String payload = "application/xml";
String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
String criteria2 = "Observation?code=SNOMED-CT|" + code + "111&_format=xml";
Subscription subscription1 = createSubscription(criteria1, payload, ourListenerServerBase);
Subscription subscription2 = createSubscription(criteria2, payload, ourListenerServerBase);
Observation observation1 = sendObservation(code, "SNOMED-CT");
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
// Modify subscription 2 to also match
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
// Send another observation
Observation observation2 = sendObservation(code, "SNOMED-CT");
// Should see two subscription notifications
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
// Send another
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -245,86 +301,29 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
}
// TODO: Reenable this
@Test
public void testRestHookSubscriptionApplicationXml() throws Exception {
@Ignore
public void testRestHookSubscriptionInvalidCriteria() throws Exception {
String payload = "application/xml";
String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
String criteria2 = "Observation?code=SNOMED-CT|" + code + "111&_format=xml";
String criteria1 = "Observation?codeeeee=SNOMED-CT";
Subscription subscription1 = createSubscription(criteria1, payload, ourListenerServerBase);
Subscription subscription2 = createSubscription(criteria2, payload, ourListenerServerBase);
try {
createSubscription(criteria1, payload, ourListenerServerBase);
fail();
} catch (InvalidRequestException e) {
assertEquals("HTTP 400 Bad Request: Invalid criteria: Failed to parse match URL[Observation?codeeeee=SNOMED-CT] - Resource type Observation does not have a parameter with name: codeeeee", e.getMessage());
}
}
Observation observation1 = sendObservation(code, "SNOMED-CT");
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
// Modify subscription 2 to also match
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
// Send another observation
Observation observation2 = sendObservation(code, "SNOMED-CT");
// Should see two subscription notifications
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
// Send another
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
Assert.assertFalse(observation2.getId().isEmpty());
private void waitForQueueToDrain() throws InterruptedException {
RestHookTestDstu2Test.waitForQueueToDrain(ourRestHookSubscriptionInterceptor);
}
@BeforeClass

View File

@ -132,8 +132,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -146,8 +146,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see two subscription notifications
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription/"+ subscription2.getId())).execute();
@ -155,8 +155,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
@ -168,8 +168,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -182,8 +182,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -205,8 +205,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -219,8 +219,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see two subscription notifications
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription/"+ subscription2.getId())).execute();
@ -228,8 +228,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
@ -241,8 +241,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -255,8 +255,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());

View File

@ -121,8 +121,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see 1 subscription notification
Thread.sleep(500);
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -135,8 +135,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see two subscription notifications
Thread.sleep(500);
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
@ -144,8 +144,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see only one subscription notification
Thread.sleep(500);
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -157,8 +157,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see no subscription notification
Thread.sleep(500);
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -171,8 +171,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see only one subscription notification
Thread.sleep(500);
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -194,8 +194,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -208,8 +208,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see two subscription notifications
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
@ -217,8 +217,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -230,8 +230,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -244,8 +244,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());

View File

@ -130,8 +130,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
}
@ -150,8 +150,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
@ -165,8 +165,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForQueueToDrain();
// Should see two subscription notifications
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
@ -175,8 +175,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForQueueToDrain();
// Should see only one subscription notification
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -188,8 +188,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -202,8 +202,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -225,8 +225,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
@ -239,8 +239,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForQueueToDrain();
// Should see two subscription notifications
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
@ -248,8 +248,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -261,8 +261,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -275,8 +275,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -298,8 +298,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
}
@ -338,8 +338,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
assertThat(ourHeaders, hasItem("X-Foo: FOO"));
assertThat(ourHeaders, hasItem("X-Bar: BAR"));
@ -357,8 +357,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
// Disable
subscription.setStatus(Subscription.SubscriptionStatus.OFF);
@ -370,8 +370,8 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
}

View File

@ -126,8 +126,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see 1 subscription notification
Thread.sleep(500);
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -140,8 +140,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see two subscription notifications
Thread.sleep(500);
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
@ -149,8 +149,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see only one subscription notification
Thread.sleep(500);
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -162,8 +162,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see no subscription notification
Thread.sleep(500);
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -176,8 +176,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see only one subscription notification
Thread.sleep(500);
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());
@ -199,8 +199,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see 1 subscription notification
waitForQueueToDrain();
waitForSize(1, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
@ -213,8 +213,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see two subscription notifications
waitForQueueToDrain();
waitForSize(3, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
@ -222,8 +222,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
@ -235,8 +235,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(0, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
@ -249,8 +249,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
// Should see only one subscription notification
waitForQueueToDrain();
waitForSize(4, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
waitForSize(0, ourCreatedObservations);
waitForSize(5, ourUpdatedObservations);
Assert.assertFalse(subscription1.getId().equals(subscription2.getId()));
Assert.assertFalse(observation1.getId().isEmpty());

View File

@ -34,11 +34,11 @@
<col class="col-xs-7" />
</colgroup>
<tbody>
<tr th:if="#{!strings.isEmpty(conf.implementation.description.value)}">
<tr th:if="${!strings.isEmpty(conf.implementation.description.value)}">
<td>Server</td>
<td th:utext="'' + ${conf.implementation.description}">HAPI Restful Server</td>
</tr>
<tr th:if="#{!strings.isEmpty(conf.software.name.value)} or #{!strings.isEmpty(conf.software.version.value)}">
<tr th:if="${!strings.isEmpty(conf.software.name.value)} or ${!strings.isEmpty(conf.software.version.value)}">
<td>Software</td>
<td>
<th:block th:utext="'' + ${conf.software.name}"/> - <th:block th:utext="'' + ${conf.software.version}"/>

View File

@ -323,6 +323,11 @@
DSTU2 validator has been enhanced to do a better job handling
ValueSets with expansions pointing to other ValueSets
</action>
<action type="fix">
REST HOOK subscriptions now use HTTP PUT if there is a payload type
specified, regardless of whether the source event was a create or an
update
</action>
</release>
<release version="2.5" date="2017-06-08">
<action type="fix">