use of org.xwiki.component.annotation.ComponentAnnotationLoader in project xwiki-platform by xwiki.
the class AbstractHttpTest method initializeSystem.
public static void initializeSystem() throws Exception {
ComponentManager componentManager = new EmbeddableComponentManager();
// Only load the minimal number of components required for the test framework, for both performance reasons
// and for avoiding having to declare dependencies such as HttpServletRequest.
ComponentAnnotationLoader loader = new ComponentAnnotationLoader();
List<ComponentDeclaration> componentDeclarations = new ArrayList<>();
componentDeclarations.add(new ComponentDeclaration(DefaultStringEntityReferenceResolver.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultStringEntityReferenceSerializer.class.getName()));
componentDeclarations.add(new ComponentDeclaration(RelativeStringEntityReferenceResolver.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultEntityReferenceProvider.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultModelConfiguration.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultSymbolScheme.class.getName()));
loader.initialize(componentManager, AbstractTest.class.getClassLoader(), componentDeclarations);
TestUtils.initializeComponent(componentManager);
}
use of org.xwiki.component.annotation.ComponentAnnotationLoader in project xwiki-platform by xwiki.
the class InstalledExtensionIndexTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
ComponentAnnotationLoader loader = new ComponentAnnotationLoader();
List<ComponentDeclaration> componentDeclarations = new ArrayList<>();
componentDeclarations.add(new ComponentDeclaration(ModelFactory.class.getName()));
componentDeclarations.add(new ComponentDeclaration(JAXBConverter.class.getName()));
loader.initialize(AbstractTest.componentManager, AbstractTest.class.getClassLoader(), componentDeclarations);
// Make sure extension utils is initialized and set.
if (getExtensionTestUtils() == null) {
AllTests.initExtensionTestUtils(context);
}
}
use of org.xwiki.component.annotation.ComponentAnnotationLoader in project xwiki-platform by xwiki.
the class XWikiMigrationManagerTest method registerComponent.
private void registerComponent(Class<?> klass) throws Exception {
ComponentAnnotationLoader loader = new ComponentAnnotationLoader();
List<ComponentDescriptor> descriptors = loader.getComponentsDescriptors(klass);
for (ComponentDescriptor<?> descriptor : descriptors) {
getComponentManager().registerComponent(descriptor);
}
}
use of org.xwiki.component.annotation.ComponentAnnotationLoader in project xwiki-platform by xwiki.
the class AbstractTest method initializeSystem.
/**
* Used so that AllTests can set the persistent test context.
*/
public static void initializeSystem(PersistentTestContext context) throws Exception {
AbstractTest.context = context;
BaseElement.setContext(context);
TestUtils.setContext(context);
AbstractTest.componentManager = new EmbeddableComponentManager();
// Only load the minimal number of components required for the test framework, for both performance reasons
// and for avoiding having to declare dependencies such as HttpServletRequest.
ComponentAnnotationLoader loader = new ComponentAnnotationLoader();
List<ComponentDeclaration> componentDeclarations = new ArrayList<>();
componentDeclarations.add(new ComponentDeclaration(DefaultStringEntityReferenceResolver.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultStringEntityReferenceSerializer.class.getName()));
componentDeclarations.add(new ComponentDeclaration(RelativeStringEntityReferenceResolver.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultEntityReferenceProvider.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultModelConfiguration.class.getName()));
componentDeclarations.add(new ComponentDeclaration(DefaultSymbolScheme.class.getName()));
loader.initialize(AbstractTest.componentManager, AbstractTest.class.getClassLoader(), componentDeclarations);
TestUtils.initializeComponent(AbstractTest.componentManager);
}
Aggregations