Fixing broken unit tests
This commit is contained in:
parent
d92be90789
commit
b37c4b5ae7
|
@ -141,7 +141,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
assertEquals(1, messages[msgIdx].getHeader("Content-Type").length);
|
assertEquals(1, messages[msgIdx].getHeader("Content-Type").length);
|
||||||
assertEquals("text/plain; charset=us-ascii", messages[msgIdx].getHeader("Content-Type")[0]);
|
assertEquals("text/plain; charset=us-ascii", messages[msgIdx].getHeader("Content-Type")[0]);
|
||||||
String foundBody = GreenMailUtil.getBody(messages[msgIdx]);
|
String foundBody = GreenMailUtil.getBody(messages[msgIdx]);
|
||||||
assertEquals("A subscription update has been received", foundBody);
|
assertEquals("", foundBody);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,13 +175,15 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
@Test
|
@Test
|
||||||
public void testRestHookSubscription() throws Exception {
|
public void testRestHookSubscription() throws Exception {
|
||||||
String code = "1000000050";
|
String code = "1000000050";
|
||||||
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
|
String criteria1 = "Observation?code=SNOMED-CT|" + code;
|
||||||
String criteria2 = "Observation?code=SNOMED-CT|" + code + "111&_format=xml";
|
String criteria2 = "Observation?code=SNOMED-CT|" + code + "111";
|
||||||
|
|
||||||
createSubscription(criteria1, null, ourNotificationListenerServer,
|
createSubscription(criteria1, null, ourNotificationListenerServer,
|
||||||
Collections.singletonList(new StringType("Authorization: abc-def")));
|
Collections.singletonList(new StringType("Authorization: abc-def")));
|
||||||
createSubscription(criteria2, null, ourNotificationListenerServer);
|
createSubscription(criteria2, null, ourNotificationListenerServer);
|
||||||
|
|
||||||
|
ourLog.debug("Sending first observation");
|
||||||
|
|
||||||
sendObservation(code, "SNOMED-CT");
|
sendObservation(code, "SNOMED-CT");
|
||||||
|
|
||||||
// Should see 1 subscription notification with authorization header
|
// Should see 1 subscription notification with authorization header
|
||||||
|
|
|
@ -57,10 +57,8 @@ public class SubscriptionDeliveringRestHookSubscriber extends BaseSubscriptionDe
|
||||||
|
|
||||||
protected void deliverPayload(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription, EncodingEnum thePayloadType, IGenericClient theClient) {
|
protected void deliverPayload(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription, EncodingEnum thePayloadType, IGenericClient theClient) {
|
||||||
IBaseResource payloadResource = getAndMassagePayload(theMsg, theSubscription);
|
IBaseResource payloadResource = getAndMassagePayload(theMsg, theSubscription);
|
||||||
if (payloadResource == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Regardless of whether we have a payload, the rest-hook should be sent.
|
||||||
doDelivery(theMsg, theSubscription, thePayloadType, theClient, payloadResource);
|
doDelivery(theMsg, theSubscription, thePayloadType, theClient, payloadResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,8 +115,13 @@ public class SubscriptionDeliveringRestHookSubscriber extends BaseSubscriptionDe
|
||||||
|
|
||||||
if (payloadResource == null || theSubscription.getRestHookDetails().isDeliverLatestVersion()) {
|
if (payloadResource == null || theSubscription.getRestHookDetails().isDeliverLatestVersion()) {
|
||||||
IIdType payloadId = theMsg.getPayloadId(myFhirContext);
|
IIdType payloadId = theMsg.getPayloadId(myFhirContext);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
payloadResource = myResourceRetriever.getResource(payloadId.toVersionless());
|
if (payloadId != null) {
|
||||||
|
payloadResource = myResourceRetriever.getResource(payloadId.toVersionless());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} catch (ResourceGoneException e) {
|
} catch (ResourceGoneException e) {
|
||||||
ourLog.warn("Resource {} is deleted, not going to deliver for subscription {}", payloadId.toVersionless(), theSubscription.getIdElement(myFhirContext));
|
ourLog.warn("Resource {} is deleted, not going to deliver for subscription {}", payloadId.toVersionless(), theSubscription.getIdElement(myFhirContext));
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue