@Test public void createWiki() throws Exception { WikiDescriptor descriptor = new WikiDescriptor("newiki", "alias", "userA"); when(wikiManager.create("newwiki", "alias", "userA", true)).thenReturn(descriptor); WikiDescriptor result = mocker.getComponentUnderTest().createWiki("newwiki", "alias", "userA", true); assertEquals(descriptor, result); }
public WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist) { WikiDescriptor descriptor = null; XWikiContext context = xcontextProvider.get(); try { checkProgrammingRights(); WikiReference mainWikiReference = new WikiReference(getMainWikiId()); authorizationManager.checkAccess(Right.CREATE_WIKI, context.getUserReference(), mainWikiReference); if (!failOnExist) { authorizationManager.checkAccess(Right.PROGRAM, context.getUserReference(), mainWikiReference); } descriptor = wikiManager.create(wikiId, wikiAlias, ownerId, failOnExist); } catch (Exception e) { error(e); } return descriptor; }
WikiManagerScriptService implements ScriptService { public WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist) { WikiDescriptor descriptor = null; XWikiContext context = xcontextProvider.get(); try { checkProgrammingRights(); WikiReference mainWikiReference = new WikiReference(getMainWikiId()); authorizationManager.checkAccess(Right.CREATE_WIKI, context.getUserReference(), mainWikiReference); if (!failOnExist) { authorizationManager.checkAccess(Right.PROGRAM, context.getUserReference(), mainWikiReference); } descriptor = wikiManager.create(wikiId, wikiAlias, ownerId, failOnExist); } catch (Exception e) { error(e); } return descriptor; } }
WikiManagerScriptService implements ScriptService { public WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist) { WikiDescriptor descriptor = null; XWikiContext context = xcontextProvider.get(); try { checkProgrammingRights(); WikiReference mainWikiReference = new WikiReference(getMainWikiId()); authorizationManager.checkAccess(Right.CREATE_WIKI, context.getUserReference(), mainWikiReference); if (!failOnExist) { authorizationManager.checkAccess(Right.PROGRAM, context.getUserReference(), mainWikiReference); } descriptor = wikiManager.create(wikiId, wikiAlias, ownerId, failOnExist); } catch (Exception e) { error(e); } return descriptor; }  }
WikiManagerScriptService implements ScriptService { public WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist) { WikiDescriptor descriptor = null; XWikiContext context = xcontextProvider.get(); try { checkProgrammingRights(); WikiReference mainWikiReference = new WikiReference(getMainWikiId()); authorizationManager.checkAccess(Right.CREATE_WIKI, context.getUserReference(), mainWikiReference); if (!failOnExist) { authorizationManager.checkAccess(Right.PROGRAM, context.getUserReference(), mainWikiReference); } descriptor = wikiManager.create(wikiId, wikiAlias, ownerId, failOnExist); } catch (Exception e) { error(e); } return descriptor; }  ScriptService get(String serviceName); Exception getLastError(); WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist); boolean deleteWiki(String wikiId); boolean canDeleteWiki(String userId, String wikiId); WikiDescriptor getByAlias(String wikiAlias); WikiDescriptor getById(String wikiId); Collection<WikiDescriptor> getAll(); Collection<String> getAllIds(); Boolean exists(String wikiId); Boolean idAvailable(String wikiId); WikiDescriptor getMainWikiDescriptor(); String getMainWikiId(); String getCurrentWikiId(); @Unstable WikiReference getCurrentWikiReference(); WikiDescriptor getCurrentWikiDescriptor(); boolean saveDescriptor(WikiDescriptor descriptor); boolean isPathMode(); String getAliasSuffix(); @Deprecated Exception getLastException(); }
WikiManagerScriptService implements ScriptService { public WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist) { WikiDescriptor descriptor = null; XWikiContext context = xcontextProvider.get(); try { checkProgrammingRights(); WikiReference mainWikiReference = new WikiReference(getMainWikiId()); authorizationManager.checkAccess(Right.CREATE_WIKI, context.getUserReference(), mainWikiReference); if (!failOnExist) { authorizationManager.checkAccess(Right.PROGRAM, context.getUserReference(), mainWikiReference); } descriptor = wikiManager.create(wikiId, wikiAlias, ownerId, failOnExist); } catch (Exception e) { error(e); } return descriptor; }  ScriptService get(String serviceName); Exception getLastError(); WikiDescriptor createWiki(String wikiId, String wikiAlias, String ownerId, boolean failOnExist); boolean deleteWiki(String wikiId); boolean canDeleteWiki(String userId, String wikiId); WikiDescriptor getByAlias(String wikiAlias); WikiDescriptor getById(String wikiId); Collection<WikiDescriptor> getAll(); Collection<String> getAllIds(); Boolean exists(String wikiId); Boolean idAvailable(String wikiId); WikiDescriptor getMainWikiDescriptor(); String getMainWikiId(); String getCurrentWikiId(); @Unstable WikiReference getCurrentWikiReference(); WikiDescriptor getCurrentWikiDescriptor(); boolean saveDescriptor(WikiDescriptor descriptor); boolean isPathMode(); String getAliasSuffix(); @Deprecated Exception getLastException(); static final String ROLEHINT; @Deprecated
    static final String CONTEXT_LASTEXCEPTION; }