org.xwiki.test
Class ComponentManagerRule
java.lang.Object
org.xwiki.component.embed.EmbeddableComponentManager
org.xwiki.test.ComponentManagerRule
- All Implemented Interfaces:
- org.junit.rules.MethodRule, org.xwiki.component.manager.ComponentManager, org.xwiki.component.phase.Disposable
- Direct Known Subclasses:
- MockitoComponentManagerRule
public class ComponentManagerRule
- extends EmbeddableComponentManager
- implements org.junit.rules.MethodRule
Initialize a Component Manager and uses the AllComponents and
ComponentList annotations to decide what components to discover and register.
Also offers helper APIs to register components and in-memory configuration sources.
- Since:
- 4.3.1
- Version:
- $Id: aa48065fb483f5df449653451a94a611d5663ea1 $
| Methods inherited from class org.xwiki.component.embed.EmbeddableComponentManager |
createLogger, dispose, getComponentDescriptor, getComponentDescriptorList, getComponentDescriptorList, getComponentEventManager, getComponentInstance, getInstance, getInstance, getInstanceList, getInstanceMap, getParent, hasComponent, hasComponent, initialize, registerComponent, registerComponent, release, setComponentEventManager, setParent, unregisterComponent, unregisterComponent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ComponentManagerRule
public ComponentManagerRule()
registerMemoryConfigurationSource
public org.xwiki.configuration.internal.MemoryConfigurationSource registerMemoryConfigurationSource()
throws Exception
- Register in-memory data source for the default and "xwikiproperties" configuration sources.
- Returns:
- the in-memory configuration source used for both default and "xwikiproperties" component hints
- Throws:
Exception - in case the registration fails
registerComponent
public void registerComponent(Type roleType,
String roleHint,
Object instance)
throws Exception
- Registers a component.
- Parameters:
roleType - the type of the component role to registerroleHint - the role hint of the component to registerinstance - the instance to register
- Throws:
Exception - in case of an error during registration
registerComponent
public void registerComponent(Type roleType,
Object instance)
throws Exception
- Registers a component (with a default role hint).
- Parameters:
roleType - the type of the component role to registerinstance - the instance to register
- Throws:
Exception - in case of an error during registration
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target)
- Specified by:
apply in interface org.junit.rules.MethodRule
Copyright © 2004-2013 XWiki. All Rights Reserved.