use of org.xwiki.component.internal.multi.DelegateComponentManager in project xwiki-platform by xwiki.
the class DateClassTest method setUp.
@Before
public void setUp() throws Exception {
DelegateComponentManager contextCM = new DelegateComponentManager();
contextCM.setComponentManager(mocker);
mocker.registerComponent(ComponentManager.class, "context", contextCM);
Utils.setComponentManager(mocker);
localizationContext = mocker.registerMockComponent(LocalizationContext.class);
}
use of org.xwiki.component.internal.multi.DelegateComponentManager in project xwiki-platform by xwiki.
the class WikiUIExtensionComponentBuilderTest method configure.
@Before
public void configure() throws Exception {
// Required by BaseObjectReference
DocumentReferenceResolver<String> resolver = this.mocker.registerMockComponent(DocumentReferenceResolver.TYPE_STRING);
when(resolver.resolve("XWiki.UIExtension")).thenReturn(new DocumentReference("xwiki", "XWiki", "UIExtensionClass"));
DelegateComponentManager wikiComponentManager = new DelegateComponentManager();
wikiComponentManager.setComponentManager(this.mocker);
this.mocker.registerComponent(ComponentManager.class, "wiki", wikiComponentManager);
// Components accessed through dynamic lookup.
VelocityManager velocityManager = this.mocker.registerMockComponent(VelocityManager.class);
when(velocityManager.getVelocityEngine()).thenReturn(mock(VelocityEngine.class));
when(velocityManager.getVelocityContext()).thenReturn(mock(VelocityContext.class));
ModelContext modelContext = this.mocker.registerMockComponent(ModelContext.class);
when(modelContext.getCurrentEntityReference()).thenReturn(DOC_REF);
this.mocker.registerMockComponent(RenderingContext.class);
this.mocker.registerMockComponent(Transformation.class, "macro");
this.mocker.registerMockComponent(ContentParser.class);
// The document holding the UI extension object.
this.componentDoc = mock(XWikiDocument.class, "xwiki:XWiki.MyUIExtension");
when(this.componentDoc.getDocumentReference()).thenReturn(DOC_REF);
when(this.componentDoc.getAuthorReference()).thenReturn(AUTHOR_REFERENCE);
when(this.componentDoc.getContentAuthorReference()).thenReturn(AUTHOR_REFERENCE);
when(this.componentDoc.getSyntax()).thenReturn(Syntax.XWIKI_2_1);
this.oldcore.getDocuments().put(DOC_REF, componentDoc);
}
Aggregations