From 9336af4b0f06d0855b58c92392ee106c99d2156d Mon Sep 17 00:00:00 2001 From: StevenXLi Date: Mon, 13 Jun 2022 14:04:49 -0400 Subject: [PATCH] 3684 subscription for delivering delete events formatted wrong (#3685) * Fixed issue with delivering delete events Subscriptions * Extracted deliverer class name to a constant, now shared across tests and interceptor class * Added change log and doc changes * moved the constant to a more appropriate place Co-authored-by: Steven Li --- hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java | 2 +- ...iption-for-delivering-delete-events-formatted-wrong.yaml | 6 ++++++ .../uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java | 2 +- .../match/registry/SubscriptionCanonicalizer.java | 2 +- .../match/registry/SubscriptionCanonicalizerTest.java | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3684-subscription-for-delivering-delete-events-formatted-wrong.yaml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java index 1add165c850..b63efa141b5 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/i18n/Msg.java @@ -25,7 +25,7 @@ public final class Msg { /** * IMPORTANT: Please update the following comment after you add a new code - * Last code value: 2084 + * Last code value: 2086 */ private Msg() {} diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3684-subscription-for-delivering-delete-events-formatted-wrong.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3684-subscription-for-delivering-delete-events-formatted-wrong.yaml new file mode 100644 index 00000000000..0072293d31a --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3684-subscription-for-delivering-delete-events-formatted-wrong.yaml @@ -0,0 +1,6 @@ +--- +type: fix +issue: 3684 +jira: SMILE-4398 +title: "Moved the `http://hapifhir.io/fhir/StructureDefinition/subscription-send-delete-messages` from the Subscription +to the Subscription's Channel element." diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java index f4febcf4d2a..fa459992dad 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java @@ -117,7 +117,7 @@ public abstract class BaseSubscriptionsR4Test extends BaseResourceProviderR4Test protected Subscription createSubscription(String theCriteria, String thePayload, Extension theExtension) { Subscription subscription = newSubscription(theCriteria, thePayload); if (theExtension != null) { - subscription.getExtension().add(theExtension); + subscription.getChannel().addExtension(theExtension); } MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizer.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizer.java index a4272389b52..9ba454786ac 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizer.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizer.java @@ -275,7 +275,7 @@ public class SubscriptionCanonicalizer { } } - Extension extension = subscription.getExtensionByUrl(EX_SEND_DELETE_MESSAGES); + Extension extension = subscription.getChannel().getExtensionByUrl(EX_SEND_DELETE_MESSAGES); if (extension != null && extension.hasValue() && extension.getValue() instanceof BooleanType) { retVal.setSendDeleteMessages(((BooleanType) extension.getValue()).booleanValue()); } diff --git a/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizerTest.java b/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizerTest.java index 91867393809..b6d42439693 100644 --- a/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizerTest.java +++ b/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionCanonicalizerTest.java @@ -33,7 +33,7 @@ class SubscriptionCanonicalizerTest { Extension sendDeleteMessagesExtension = new Extension() .setUrl(EX_SEND_DELETE_MESSAGES) .setValue(new BooleanType(true)); - subscription.getExtension().add(sendDeleteMessagesExtension); + subscription.getChannel().addExtension(sendDeleteMessagesExtension); CanonicalSubscription canonicalSubscription = testedSC.canonicalize(subscription);