Details
-
Task
-
Resolution: Unresolved
-
Major
-
12.1.1.Final
-
None
-
Undefined
Description
BaseNonBlockingStoreTest wants to focus on the store it tests, so it doesn't create a DefaultCacheManager instance, and it creates a mock via PersistenceMockUtil.mockCache() instead.
This works well enough in the core, but it doesn't work well in other modules as GlobalComponentRegistry (which is not mocked) finds ModuleLifecycle implementations on the classpath and calls their initialization methods. If any of those initialization methods try to register components with dependencies normally registered by the DefaultCacheManager constructor, the error is very hard to decipher:
org.infinispan.commons.CacheConfigurationException: Unable to construct dependency org.infinispan.security.impl.Authorizer in scope GLOBAL for org.infinispan.scripting.ScriptingManager (a org.infinispan.scripting.impl.ScriptingManagerImpl) << org.infinispan.factories.GlobalComponentRegistry$ModuleInitializer (a org.infinispan.factories.GlobalComponentRegistry$ModuleInitializer) at org.infinispan.factories.impl.BasicComponentRegistryImpl.throwDependencyNotFound(BasicComponentRegistryImpl.java:360) at org.infinispan.factories.impl.WireContext.get(WireContext.java:22) at org.infinispan.scripting.impl.ScriptingPackageImpl$2.wire(ScriptingPackageImpl.java:45) at org.infinispan.scripting.impl.ScriptingPackageImpl$2.wire(ScriptingPackageImpl.java:41) at org.infinispan.factories.impl.BasicComponentRegistryImpl.invokeInjection(BasicComponentRegistryImpl.java:338) at org.infinispan.factories.impl.BasicComponentRegistryImpl.doWireWrapper(BasicComponentRegistryImpl.java:235) at org.infinispan.factories.impl.BasicComponentRegistryImpl.wireWrapper(BasicComponentRegistryImpl.java:216) at org.infinispan.factories.impl.BasicComponentRegistryImpl.registerComponent(BasicComponentRegistryImpl.java:375) at org.infinispan.factories.AbstractComponentRegistry.registerComponentInternal(AbstractComponentRegistry.java:131) at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:123) at org.infinispan.factories.AbstractComponentRegistry.registerComponent(AbstractComponentRegistry.java:115) at org.infinispan.scripting.impl.LifecycleCallbacks.cacheManagerStarting(LifecycleCallbacks.java:41) at org.infinispan.factories.GlobalComponentRegistry.modulesManagerStarting(GlobalComponentRegistry.java:275) at org.infinispan.factories.GlobalComponentRegistry.access$000(GlobalComponentRegistry.java:64) at org.infinispan.factories.GlobalComponentRegistry$ModuleInitializer.start(GlobalComponentRegistry.java:365) at org.infinispan.factories.CorePackageImpl$11.start(CorePackageImpl.java:173) at org.infinispan.factories.CorePackageImpl$11.start(CorePackageImpl.java:171) at org.infinispan.factories.impl.BasicComponentRegistryImpl.invokeStart(BasicComponentRegistryImpl.java:604) at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:595) at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564) at org.infinispan.factories.impl.BasicComponentRegistryImpl.access$700(BasicComponentRegistryImpl.java:30) at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:787) at org.infinispan.factories.impl.BasicComponentRegistryImpl.startDependencies(BasicComponentRegistryImpl.java:622) at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:586) at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564) at org.infinispan.factories.impl.BasicComponentRegistryImpl.access$700(BasicComponentRegistryImpl.java:30) at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:787) at org.infinispan.factories.impl.BasicComponentRegistryImpl.startDependencies(BasicComponentRegistryImpl.java:622) at org.infinispan.factories.impl.BasicComponentRegistryImpl.doStartWrapper(BasicComponentRegistryImpl.java:586) at org.infinispan.factories.impl.BasicComponentRegistryImpl.startWrapper(BasicComponentRegistryImpl.java:564) at org.infinispan.factories.impl.BasicComponentRegistryImpl.access$700(BasicComponentRegistryImpl.java:30) at org.infinispan.factories.impl.BasicComponentRegistryImpl$ComponentWrapper.running(BasicComponentRegistryImpl.java:787) at org.infinispan.factories.impl.BasicComponentRegistryImpl.findFactory(BasicComponentRegistryImpl.java:260) at org.infinispan.factories.impl.BasicComponentRegistryImpl.getComponent0(BasicComponentRegistryImpl.java:131) at org.infinispan.factories.impl.BasicComponentRegistryImpl.getComponent(BasicComponentRegistryImpl.java:64) at org.infinispan.factories.AbstractComponentRegistry.getComponent(AbstractComponentRegistry.java:191) at org.infinispan.factories.AbstractComponentRegistry.getComponent(AbstractComponentRegistry.java:177) at org.infinispan.persistence.remote.RemoteStore.start(RemoteStore.java:119) at org.infinispan.persistence.support.EnsureNonBlockingStore.lambda$start$0(EnsureNonBlockingStore.java:21) at org.infinispan.commons.test.BlockHoundHelper.ensureNonBlocking(BlockHoundHelper.java:47) at org.infinispan.persistence.support.EnsureNonBlockingStore.start(EnsureNonBlockingStore.java:21) at org.infinispan.persistence.support.WaitNonBlockingStore.startAndWait(WaitNonBlockingStore.java:63) at org.infinispan.persistence.BaseNonBlockingStoreTest.startStore(BaseNonBlockingStoreTest.java:134) at org.infinispan.persistence.BaseNonBlockingStoreTest.setUp(BaseNonBlockingStoreTest.java:124)
Creating a non-clustered DefaultCacheManager is cheap, persistence tests should use the real thing instead of a mock.