@Test public void testDowngradeOnWiki() throws Throwable { install(this.localXarExtensiontId2, "wiki", this.contextUser); verifyHasAdminRight(3); install(this.localXarExtensiontId1, "wiki", this.contextUser); verifyHasAdminRight(4); XWikiDocument samepage = this.oldcore.getSpyXWiki() .getDocument(new DocumentReference("wiki", "samespace", "samepage"), getXWikiContext()); Assert.assertEquals("Wrong versions", "1.1", samepage.getVersion()); XWikiDocument modifiedpage = this.oldcore.getSpyXWiki().getDocument(new DocumentReference("wiki", "space", "page"), getXWikiContext()); Assert.assertFalse("Document wiki.space.page has not been saved in the database", modifiedpage.isNew()); Assert.assertEquals("Wrong content", "content", modifiedpage.getContent()); Assert.assertEquals("Wrong author", this.contextUser, modifiedpage.getAuthorReference()); Assert.assertEquals("Wrong versions", "2.1", modifiedpage.getVersion()); Assert.assertEquals("Wrong version", Locale.ROOT, modifiedpage.getLocale()); BaseClass baseClass = modifiedpage.getXClass(); Assert.assertNotNull(baseClass.getField("property")); Assert.assertEquals("property", baseClass.getField("property").getName()); Assert.assertSame(NumberClass.class, baseClass.getField("property").getClass()); Assert.assertNull(modifiedpage.getAttachment("attachment.txt")); XWikiDocument newPage = this.oldcore.getSpyXWiki().getDocument(new DocumentReference("wiki", "space2", "page2"), getXWikiContext()); assertTrue("Document wiki.space2.page2 has not been removed from the database", newPage.isNew()); XWikiDocument removedPage = this.oldcore.getSpyXWiki().getDocument(new DocumentReference("wiki", "space1", "page1"), getXWikiContext()); Assert.assertFalse("Document wiki.space1.page1 has not been saved in the database", removedPage.isNew()); }
@Override public void install(LocalExtension localExtension, String namespace, Request request) throws InstallException { if (!request.isRemote()) { String wiki; try { wiki = XarHandlerUtils.getWikiFromNamespace(namespace); } catch (UnsupportedNamespaceException e) { throw new InstallException("Failed to extract wiki id from namespace", e); } installInternal(localExtension, wiki, request); } }
XarExtensionHandler extends AbstractExtensionHandler { @Override public void install(LocalExtension localExtension, String namespace, Request request) throws InstallException { if (!request.isRemote()) { String wiki; try { wiki = XarHandlerUtils.getWikiFromNamespace(namespace); } catch (UnsupportedNamespaceException e) { throw new InstallException("Failed to extract wiki id from namespace", e); } installInternal(localExtension, wiki, request); } } }
XarExtensionHandler extends AbstractExtensionHandler { @Override public void install(LocalExtension localExtension, String namespace, Request request) throws InstallException { if (!request.isRemote()) { String wiki; try { wiki = XarHandlerUtils.getWikiFromNamespace(namespace); } catch (UnsupportedNamespaceException e) { throw new InstallException("Failed to extract wiki id from namespace", e); } installInternal(localExtension, wiki, request); } }  }
XarExtensionHandler extends AbstractExtensionHandler { @Override public void install(LocalExtension localExtension, String namespace, Request request) throws InstallException { if (!request.isRemote()) { String wiki; try { wiki = XarHandlerUtils.getWikiFromNamespace(namespace); } catch (UnsupportedNamespaceException e) { throw new InstallException("Failed to extract wiki id from namespace", e); } installInternal(localExtension, wiki, request); } }  @Override void install(LocalExtension localExtension, String namespace, Request request); @Override void upgrade(Collection<InstalledExtension> previousLocalExtensions, LocalExtension newLocalExtension,
        String namespace, Request request); @Override void uninstall(InstalledExtension installedExtension, String namespace, Request request); }
XarExtensionHandler extends AbstractExtensionHandler { @Override public void install(LocalExtension localExtension, String namespace, Request request) throws InstallException { if (!request.isRemote()) { String wiki; try { wiki = XarHandlerUtils.getWikiFromNamespace(namespace); } catch (UnsupportedNamespaceException e) { throw new InstallException("Failed to extract wiki id from namespace", e); } installInternal(localExtension, wiki, request); } }  @Override void install(LocalExtension localExtension, String namespace, Request request); @Override void upgrade(Collection<InstalledExtension> previousLocalExtensions, LocalExtension newLocalExtension,
        String namespace, Request request); @Override void uninstall(InstalledExtension installedExtension, String namespace, Request request); static final String TYPE; }