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,
Method test,
Object... parameterInstances)
Initialize the test component manager by registering components based on the presence of
AllComponents and ComponentList annotations. |
void |
initializeTest(Object testClassInstance,
Object... parameterInstances)
Initialize the test component manager by registering components based on the presence of
AllComponents and ComponentList annotations. |
void |
notifyComponentDescriptorEvent()
Enabled notification of component descriptor registration/unregistration.
|
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.
|
void |
registerComponentIfDontExist(Class<?> testClass)
Register components associated to the provided class if there is not already one.
|
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.
|
createGenericProvider, createLogger, dispose, getComponentDescriptor, getComponentDescriptorList, getComponentDescriptorList, getComponentEventManager, getComponentInstance, getDependencyInstance, getInstance, getInstance, getInstanceList, getInstanceMap, getNamespace, getParent, hasComponent, hasComponent, initialize, registerComponent, registerComponent, release, setComponentEventManager, setParent, unregisterComponent, unregisterComponent
protected 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 registerComponentIfDontExist(Class<?> testClass) throws Exception
testClass
- the class containing the annotationsException
- in case of an error during registrationpublic void initializeTest(Object testClassInstance, Method test, Object... parameterInstances) throws Exception
AllComponents
and ComponentList
annotations.
Also calls methods annotated with BeforeComponent
and AfterComponent
.testClassInstance
- the test instance on which the annotations are presenttest
- the test method being executedparameterInstances
- the instances that will be passed as parameters to methods annotated with
@BeforeComponent
and @AfterComponent
Exception
- if an error happens during initializationpublic void initializeTest(Object testClassInstance, Object... parameterInstances) throws Exception
AllComponents
and ComponentList
annotations.
Also calls methods annotated with BeforeComponent
and AfterComponent
.testClassInstance
- the test instance on which the annotations are presentparameterInstances
- the instances that will be passed as parameters to methods annotated with
@BeforeComponent
and @AfterComponent
Exception
- if an error happens during initializationpublic void notifyComponentDescriptorEvent() throws org.xwiki.component.manager.ComponentLookupException
org.xwiki.component.manager.ComponentLookupException
- when failing to lookup ObservationManager
componentCopyright © 2004–2021 XWiki. All rights reserved.