Search in sources :

Example 1 with ContextComponentManagerProvider

use of org.xwiki.component.internal.ContextComponentManagerProvider in project xwiki-platform by xwiki.

the class ComponentScriptServiceTest method configure.

@Before
public void configure() throws Exception {
    this.dab = this.mocker.getInstance(DocumentAccessBridge.class);
    this.contextComponentManager = this.mocker.registerMockComponent(ComponentManager.class, "context");
    Provider<ComponentManager> contextComponentManagerProvider = this.mocker.registerMockComponent(new DefaultParameterizedType(null, Provider.class, ComponentManager.class), "context");
    when(contextComponentManagerProvider.get()).thenReturn(this.contextComponentManager);
    this.contextrootComponentManager = this.mocker.registerMockComponent(ComponentManager.class, "context/root");
    Provider<ComponentManager> contextrootComponentManagerProvider = this.mocker.registerMockComponent(new DefaultParameterizedType(null, Provider.class, ComponentManager.class), "context/root");
    when(contextrootComponentManagerProvider.get()).thenReturn(this.contextrootComponentManager);
    this.rootComponentManager = this.mocker.registerMockComponent(ComponentManager.class, "root");
    this.componentManagerManager = this.mocker.getInstance(ComponentManagerManager.class);
    when(this.componentManagerManager.getComponentManager(null, false)).thenReturn(this.rootComponentManager);
    this.execution = this.mocker.getInstance(Execution.class);
}
Also used : ComponentManagerManager(org.xwiki.component.internal.multi.ComponentManagerManager) Execution(org.xwiki.context.Execution) DocumentAccessBridge(org.xwiki.bridge.DocumentAccessBridge) ComponentManager(org.xwiki.component.manager.ComponentManager) DefaultParameterizedType(org.xwiki.component.util.DefaultParameterizedType) Provider(javax.inject.Provider) ContextComponentManagerProvider(org.xwiki.component.internal.ContextComponentManagerProvider) Before(org.junit.Before)

Aggregations

Provider (javax.inject.Provider)1 Before (org.junit.Before)1 DocumentAccessBridge (org.xwiki.bridge.DocumentAccessBridge)1 ContextComponentManagerProvider (org.xwiki.component.internal.ContextComponentManagerProvider)1 ComponentManagerManager (org.xwiki.component.internal.multi.ComponentManagerManager)1 ComponentManager (org.xwiki.component.manager.ComponentManager)1 DefaultParameterizedType (org.xwiki.component.util.DefaultParameterizedType)1 Execution (org.xwiki.context.Execution)1