public class TestComponentManager extends EmbeddableComponentManager
AllComponents and
ComponentList annotations to decide what components to discover and register.
Also offers helper APIs to register components and in-memory configuration sources.
| Modifier and Type | Field and Description |
|---|---|
protected org.xwiki.test.internal.ComponentRegistrator |
componentRegistrator
Used to register components.
|
| Constructor and Description |
|---|
TestComponentManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
initializeTest(Object testClassInstance)
Initialize the test component manager by registering components based on the presence of
AllComponents and ComponentList annotations. |
void |
registerComponent(Class<?> testClass)
Register components associated to the provided class.
|
void |
registerComponent(Type roleType,
Object instance)
Registers a component (with a default role hint).
|
void |
registerComponent(Type roleType,
String roleHint,
Object instance)
Registers a component.
|
org.xwiki.configuration.internal.MemoryConfigurationSource |
registerMemoryConfigurationSource()
Register in-memory data source for the default and "xwikiproperties" configuration sources.
|
void |
shutdownTest()
Cleans up the test component manager by disposing components registered in it.
|
createLogger, dispose, getComponentDescriptor, getComponentDescriptorList, getComponentDescriptorList, getComponentEventManager, getComponentInstance, getInstance, getInstance, getInstanceList, getInstanceMap, getParent, hasComponent, hasComponent, initialize, registerComponent, registerComponent, release, setComponentEventManager, setParent, unregisterComponent, unregisterComponentprotected org.xwiki.test.internal.ComponentRegistrator componentRegistrator
public org.xwiki.configuration.internal.MemoryConfigurationSource registerMemoryConfigurationSource() throws Exception
Exception - in case the registration failspublic void registerComponent(Type roleType, String roleHint, Object instance) throws Exception
roleType - the type of the component role to registerroleHint - the role hint of the component to registerinstance - the instance to registerException - in case of an error during registrationpublic void registerComponent(Type roleType, Object instance) throws Exception
roleType - the type of the component role to registerinstance - the instance to registerException - in case of an error during registrationpublic void registerComponent(Class<?> testClass) throws Exception
testClass - the class containing the annotationsException - in case of an error during registrationpublic void initializeTest(Object testClassInstance) throws Exception
AllComponents and ComponentList annotations.
Also calls methods annotated with BeforeComponent and AfterComponent.testClassInstance - the test instance on which the annotations are presentException - if an error happens during initializationCopyright © 2004–2014 XWiki. All rights reserved.