Search in sources :

Example 1 with ComponentManagerManager

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

the class ContextComponentManagerTest method testCreateDocumentComponentManager.

@Test
public void testCreateDocumentComponentManager() throws Exception {
    ComponentManagerManager manager = getComponentManager().getInstance(ComponentManagerManager.class);
    NamespacedComponentManager componentManager = (NamespacedComponentManager) manager.getComponentManager("document:wiki1:space1.space2.document1", true);
    assertNotNull(componentManager);
    assertEquals("document:wiki1:space1.space2.document1", componentManager.getNamespace());
    assertEquals("space:wiki1:space1.space2", ((NamespacedComponentManager) componentManager.getParent()).getNamespace());
    assertEquals("space:wiki1:space1", ((NamespacedComponentManager) componentManager.getParent().getParent()).getNamespace());
    assertEquals("wiki:wiki1", ((NamespacedComponentManager) componentManager.getParent().getParent().getParent()).getNamespace());
}
Also used : ComponentManagerManager(org.xwiki.component.internal.multi.ComponentManagerManager) NamespacedComponentManager(org.xwiki.component.manager.NamespacedComponentManager) Test(org.junit.Test)

Example 2 with ComponentManagerManager

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

the class ComponentScriptServiceTest method getComponentManagerForNamespaceWhenNoProgrammingRights.

@Test
public void getComponentManagerForNamespaceWhenNoProgrammingRights() throws Exception {
    when(this.dab.hasProgrammingRights()).thenReturn(false);
    assertNull(this.mocker.getComponentUnderTest().getComponentManager("wiki:xwiki"));
    ComponentManagerManager componentManagerManager = this.mocker.getInstance(ComponentManagerManager.class);
    verify(componentManagerManager, never()).getComponentManager(any(), anyBoolean());
}
Also used : ComponentManagerManager(org.xwiki.component.internal.multi.ComponentManagerManager) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ComponentManagerManager (org.xwiki.component.internal.multi.ComponentManagerManager)2 NamespacedComponentManager (org.xwiki.component.manager.NamespacedComponentManager)1