From ccda668d0ce03edcee1b81f7dd4a4d5b2ff72583 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Thu, 23 Apr 2020 05:28:56 -0400 Subject: [PATCH] Restore subscription loading at startup --- .../resthook/RestHookTestR4Test.java | 28 +++++++++++ .../config/SubscriptionProcessorConfig.java | 9 +--- .../registry/DaoSubscriptionProvider.java | 48 ------------------- .../match/registry/ISubscriptionProvider.java | 31 ------------ .../match/registry/SubscriptionLoader.java | 36 ++++++++------ .../match/registry/SubscriptionRegistry.java | 13 +---- .../module/BaseSubscriptionTest.java | 4 -- .../module/cache/SubscriptionLoaderTest.java | 42 ---------------- .../MockFhirClientSubscriptionProvider.java | 26 ---------- .../config/TestSubscriptionDstu3Config.java | 7 --- ...kingQueueSubscribableChannelDstu3Test.java | 6 +-- 11 files changed, 53 insertions(+), 197 deletions(-) delete mode 100644 hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/DaoSubscriptionProvider.java delete mode 100644 hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/ISubscriptionProvider.java delete mode 100644 hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/MockFhirClientSubscriptionProvider.java diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java index ea6d27e249d..2f5e5fc32c2 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java @@ -236,6 +236,34 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { waitForSize(100, ourUpdatedObservations); } + + @Test + public void testSubscriptionRegistryLoadsSubscriptionsFromDatabase() throws Exception { + String payload = "application/fhir+json"; + + String code = "1000000050"; + String criteria1 = "Observation?"; + + createSubscription(criteria1, payload); + waitForActivatedSubscriptionCount(1); + + // Manually unregister all subscriptions + mySubscriptionRegistry.unregisterAllSubscriptions(); + waitForActivatedSubscriptionCount(0); + + // Force a reload + mySubscriptionLoader.doSyncSubscriptionsForUnitTest(); + + // Send a matching observation + Observation observation = new Observation(); + observation.getIdentifierFirstRep().setSystem("foo").setValue("ID"); + observation.getCode().addCoding().setCode(code).setSystem("SNOMED-CT"); + observation.setStatus(Observation.ObservationStatus.FINAL); + myObservationDao.create(observation); + + waitForSize(1, ourUpdatedObservations); + } + @Test public void testActiveSubscriptionShouldntReActivate() throws Exception { String criteria = "Observation?code=111111111&_format=xml"; diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java index 2ba9c5d5637..f04c2fc600a 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java @@ -23,7 +23,6 @@ package ca.uhn.fhir.jpa.subscription.match.config; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryChannelNamer; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory; -import ca.uhn.fhir.jpa.subscription.model.config.SubscriptionModelConfig; import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender; import ca.uhn.fhir.jpa.subscription.match.deliver.email.SubscriptionDeliveringEmailSubscriber; import ca.uhn.fhir.jpa.subscription.match.deliver.resthook.SubscriptionDeliveringRestHookSubscriber; @@ -35,10 +34,9 @@ import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.MatchingQueueSubscr import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionActivatingSubscriber; import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionMatchingSubscriber; import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionRegisteringSubscriber; -import ca.uhn.fhir.jpa.subscription.match.registry.DaoSubscriptionProvider; -import ca.uhn.fhir.jpa.subscription.match.registry.ISubscriptionProvider; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; +import ca.uhn.fhir.jpa.subscription.model.config.SubscriptionModelConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Primary; @@ -81,11 +79,6 @@ public class SubscriptionProcessorConfig { return new SubscriptionDeliveryChannelNamer(); } - @Bean - public ISubscriptionProvider subscriptionProvider() { - return new DaoSubscriptionProvider(); - } - @Bean public SubscriptionLoader subscriptionLoader() { return new SubscriptionLoader(); diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/DaoSubscriptionProvider.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/DaoSubscriptionProvider.java deleted file mode 100644 index 6a0fb5b98c8..00000000000 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/DaoSubscriptionProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -package ca.uhn.fhir.jpa.subscription.match.registry; - -/*- - * #%L - * HAPI FHIR Subscription Server - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import ca.uhn.fhir.jpa.api.dao.DaoRegistry; -import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; -import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionActivatingSubscriber; -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.springframework.beans.factory.annotation.Autowired; - -public class DaoSubscriptionProvider implements ISubscriptionProvider { - - @Autowired - DaoRegistry myDaoRegistry; - @Autowired - private SubscriptionActivatingSubscriber mySubscriptionActivatingInterceptor; - - @Override - public IBundleProvider search(SearchParameterMap theMap) { - IFhirResourceDao subscriptionDao = myDaoRegistry.getSubscriptionDao(); - return subscriptionDao.search(theMap); - } - - @Override - public boolean loadSubscription(IBaseResource theResource) { - return mySubscriptionActivatingInterceptor.activateOrRegisterSubscriptionIfRequired(theResource); - } -} diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/ISubscriptionProvider.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/ISubscriptionProvider.java deleted file mode 100644 index 2e3be81b188..00000000000 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/ISubscriptionProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -package ca.uhn.fhir.jpa.subscription.match.registry; - -/*- - * #%L - * HAPI FHIR Subscription Server - * %% - * Copyright (C) 2014 - 2020 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import org.hl7.fhir.instance.model.api.IBaseResource; - -public interface ISubscriptionProvider { - IBundleProvider search(SearchParameterMap theMap); - - boolean loadSubscription(IBaseResource theResource); -} diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionLoader.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionLoader.java index a7129ff5513..ace9207a0a9 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionLoader.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionLoader.java @@ -21,11 +21,14 @@ package ca.uhn.fhir.jpa.subscription.match.registry; */ import ca.uhn.fhir.jpa.api.IDaoRegistry; +import ca.uhn.fhir.jpa.api.dao.DaoRegistry; +import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.model.sched.HapiJob; import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.retry.Retrier; +import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionActivatingSubscriber; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.TokenOrListParam; import ca.uhn.fhir.rest.param.TokenParam; @@ -50,14 +53,14 @@ public class SubscriptionLoader { private static final int MAX_RETRIES = 60; // 60 * 5 seconds = 5 minutes private final Object mySyncSubscriptionsLock = new Object(); @Autowired - private ISubscriptionProvider mySubscriptionProvider; - @Autowired private SubscriptionRegistry mySubscriptionRegistry; @Autowired(required = false) - private IDaoRegistry myDaoRegistry; + private DaoRegistry myDaoRegistry; private Semaphore mySyncSubscriptionsSemaphore = new Semaphore(1); @Autowired private ISchedulerService mySchedulerService; + @Autowired + private SubscriptionActivatingSubscriber mySubscriptionActivatingInterceptor; /** * Constructor @@ -120,15 +123,12 @@ public class SubscriptionLoader { ourLog.debug("Starting sync subscriptions"); SearchParameterMap map = new SearchParameterMap(); map.add(Subscription.SP_STATUS, new TokenOrListParam() - // TODO KHS Ideally we should only be pulling ACTIVE subscriptions here, but this class is overloaded so that - // the @Scheduled task also activates requested subscriptions if their type was enabled after they were requested - // There should be a separate @Scheduled task that looks for requested subscriptions that need to be activated - // independent of the registry loading process. .addOr(new TokenParam(null, Subscription.SubscriptionStatus.REQUESTED.toCode())) .addOr(new TokenParam(null, Subscription.SubscriptionStatus.ACTIVE.toCode()))); map.setLoadSynchronousUpTo(SubscriptionConstants.MAX_SUBSCRIPTION_RESULTS); - IBundleProvider subscriptionBundleList = mySubscriptionProvider.search(map); + IFhirResourceDao subscriptionDao = myDaoRegistry.getSubscriptionDao(); + IBundleProvider subscriptionBundleList = subscriptionDao.search(map); Integer subscriptionCount = subscriptionBundleList.size(); assert subscriptionCount != null; @@ -139,20 +139,28 @@ public class SubscriptionLoader { List resourceList = subscriptionBundleList.getResources(0, subscriptionCount); Set allIds = new HashSet<>(); - int changesCount = 0; + int activatedCount = 0; + int registeredCount = 0; + for (IBaseResource resource : resourceList) { String nextId = resource.getIdElement().getIdPart(); allIds.add(nextId); - boolean changed = mySubscriptionProvider.loadSubscription(resource); - if (changed) { - changesCount++; + + boolean activated = mySubscriptionActivatingInterceptor.activateOrRegisterSubscriptionIfRequired(resource); + if (activated) { + activatedCount++; + } + + boolean registered = mySubscriptionRegistry.registerSubscriptionUnlessAlreadyRegistered(resource); + if (registered) { + registeredCount++; } } mySubscriptionRegistry.unregisterAllSubscriptionsNotInCollection(allIds); - ourLog.debug("Finished sync subscriptions - found {}", resourceList.size()); + ourLog.debug("Finished sync subscriptions - activated {} and registered {}", resourceList.size(), registeredCount); - return changesCount; + return activatedCount; } } diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java index fbe09f6452e..fd55e180981 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java @@ -80,8 +80,7 @@ public class SubscriptionRegistry { return activeSubscription.map(ActiveSubscription::getSubscription); } - @SuppressWarnings("UnusedReturnValue") - private CanonicalSubscription registerSubscription(IIdType theId, IBaseResource theSubscription) { + private void registerSubscription(IIdType theId, IBaseResource theSubscription) { Validate.notNull(theId); String subscriptionId = theId.getIdPart(); Validate.notBlank(subscriptionId); @@ -101,7 +100,6 @@ public class SubscriptionRegistry { .add(CanonicalSubscription.class, canonicalized); myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED, params); - return canonicalized; } public void unregisterSubscriptionIfRegistered(String theSubscriptionId) { @@ -174,15 +172,6 @@ public class SubscriptionRegistry { return theExistingSubscription.getChannelType().equals(theNewSubscription.getChannelType()); } - public boolean unregisterSubscriptionIfRegistered(IBaseResource theSubscription, String theStatusString) { - if (hasSubscription(theSubscription.getIdElement()).isPresent()) { - ourLog.info("Removing {} subscription {}", theStatusString, theSubscription.getIdElement().toUnqualified().getValue()); - unregisterSubscriptionIfRegistered(theSubscription.getIdElement().getIdPart()); - return true; - } - return false; - } - public int size() { return myActiveSubscriptionCache.size(); } diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java index 8d4d8f94883..c7b0369d2c6 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java @@ -9,13 +9,11 @@ import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannelFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig; import ca.uhn.fhir.jpa.subscription.module.config.MockFhirClientSearchParamProvider; -import ca.uhn.fhir.jpa.subscription.module.config.MockFhirClientSubscriptionProvider; import ca.uhn.fhir.jpa.subscription.module.config.TestSubscriptionConfig; import ca.uhn.fhir.rest.api.server.IBundleProvider; import org.junit.After; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; @@ -32,8 +30,6 @@ public abstract class BaseSubscriptionTest { @Autowired protected IInterceptorService myInterceptorRegistry; - @Autowired - MockFhirClientSubscriptionProvider myMockFhirClientSubscriptionProvider; @Autowired ISearchParamRegistry mySearchParamRegistry; diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/cache/SubscriptionLoaderTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/cache/SubscriptionLoaderTest.java index 31af0d21601..845dadbc40e 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/cache/SubscriptionLoaderTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/cache/SubscriptionLoaderTest.java @@ -1,55 +1,13 @@ package ca.uhn.fhir.jpa.subscription.module.cache; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader; -import ca.uhn.fhir.jpa.subscription.module.config.MockFhirClientSubscriptionProvider; import ca.uhn.fhir.jpa.subscription.module.standalone.BaseBlockingQueueSubscribableChannelDstu3Test; -import org.hl7.fhir.dstu3.model.Subscription; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertEquals; - public class SubscriptionLoaderTest extends BaseBlockingQueueSubscribableChannelDstu3Test { - private static final int MOCK_FHIR_CLIENT_FAILURES = 3; - @Autowired - private MockFhirClientSubscriptionProvider myMockFhirClientSubscriptionProvider; - - @Before - public void setFailCount() { - myMockFhirClientSubscriptionProvider.setFailCount(MOCK_FHIR_CLIENT_FAILURES); - } - - @After - public void restoreFailCount() { - myMockFhirClientSubscriptionProvider.setFailCount(0); - } - - @Test - @Ignore - public void testSubscriptionLoaderFhirClientDown() throws Exception { - String payload = "application/fhir+json"; - - String criteria1 = "Observation?code=SNOMED-CT|" + myCode + "&_format=xml"; - String criteria2 = "Observation?code=SNOMED-CT|" + myCode + "111&_format=xml"; - - List subs = new ArrayList<>(); - subs.add(makeActiveSubscription(criteria1, payload, ourListenerServerBase)); - subs.add(makeActiveSubscription(criteria2, payload, ourListenerServerBase)); - - mySubscriptionActivatedPost.setExpectedCount(2); - initSubscriptionLoader(subs, "uuid"); - mySubscriptionActivatedPost.awaitExpected(); - assertEquals(0, myMockFhirClientSubscriptionProvider.getFailCount()); - } - @Test public void testMultipleThreadsDontBlock() throws InterruptedException { diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/MockFhirClientSubscriptionProvider.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/MockFhirClientSubscriptionProvider.java deleted file mode 100644 index ec104c9baff..00000000000 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/MockFhirClientSubscriptionProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -package ca.uhn.fhir.jpa.subscription.module.config; - -import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; -import ca.uhn.fhir.jpa.subscription.match.registry.ISubscriptionProvider; -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import org.hl7.fhir.instance.model.api.IBaseResource; - -public class MockFhirClientSubscriptionProvider implements ISubscriptionProvider { - private final MockProvider myMockProvider = new MockProvider(); - - public MockFhirClientSubscriptionProvider() { - super(); - } - - public void setBundleProvider(IBundleProvider theBundleProvider) { myMockProvider.setBundleProvider(theBundleProvider); } - public void setFailCount(int theFailCount) { myMockProvider.setFailCount(theFailCount); } - public int getFailCount() { return myMockProvider.getFailCount(); } - - @Override - public IBundleProvider search(SearchParameterMap theParams) { return myMockProvider.search(theParams); } - - @Override - public boolean loadSubscription(IBaseResource theResource) { - throw new UnsupportedOperationException(); - } -} diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionDstu3Config.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionDstu3Config.java index e082c16f466..2bb91bdd147 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionDstu3Config.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionDstu3Config.java @@ -5,7 +5,6 @@ import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider; -import ca.uhn.fhir.jpa.subscription.match.registry.ISubscriptionProvider; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -33,12 +32,6 @@ public class TestSubscriptionDstu3Config { return new MockFhirClientSearchParamProvider(); } - @Bean - @Primary - public ISubscriptionProvider subscriptionProvider() { - return new MockFhirClientSubscriptionProvider(); - } - @Bean public ISchedulerService schedulerService() { return mock(ISchedulerService.class); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java index 0f2e9330144..c1f6a7de1a8 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java @@ -14,7 +14,6 @@ import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; import ca.uhn.fhir.jpa.subscription.module.BaseSubscriptionDstu3Test; -import ca.uhn.fhir.jpa.subscription.module.config.MockFhirClientSubscriptionProvider; import ca.uhn.fhir.jpa.subscription.module.subscriber.SubscriptionMatchingSubscriberTest; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.annotation.Create; @@ -24,7 +23,6 @@ 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.SimpleBundleProvider; import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.test.concurrency.IPointcutLatch; import ca.uhn.test.concurrency.PointcutLatch; @@ -81,8 +79,6 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base @Autowired protected SubscriptionRegistry mySubscriptionRegistry; @Autowired - private MockFhirClientSubscriptionProvider myMockFhirClientSubscriptionProvider; - @Autowired private SubscriptionLoader mySubscriptionLoader; @Autowired private ISubscriptionDeliveryChannelNamer mySubscriptionDeliveryChannelNamer; @@ -136,7 +132,7 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base } protected void initSubscriptionLoader(List subscriptions, String uuid) throws InterruptedException { - myMockFhirClientSubscriptionProvider.setBundleProvider(new SimpleBundleProvider(new ArrayList<>(subscriptions), uuid)); +// myMockFhirClientSubscriptionProvider.setBundleProvider(new SimpleBundleProvider(new ArrayList<>(subscriptions), uuid)); mySubscriptionLoader.doSyncSubscriptionsForUnitTest(); }