@Test public void copyContext() { XWikiContext copy = this.copier.copy(this.original); assertNotSame(this.originalResponse, copy.getResponse()); assertEquals(this.original.getUserReference(), copy.getUserReference()); assertEquals(this.original.getWikiId(), copy.getWikiId()); assertEquals("http: assertNotSame(this.original.entrySet(), copy.entrySet()); assertEquals(this.original.entrySet(), copy.entrySet()); assertSame(this.original.getWiki(), copy.getWiki()); assertNull(this.original.get(HIBSESSION)); assertNull(copy.get(HIBSESSION)); assertNotNull(copy.getURLFactory()); assertNotSame(this.original.getURLFactory(), copy.getURLFactory()); }
@Override public XWikiContext copy(XWikiContext originalXWikiContext) { originalXWikiContext.getWiki().getStore().cleanUp(originalXWikiContext); XWikiContext clonedXWikiContext = originalXWikiContext.clone(); clonedXWikiContext.setRequest(this.xwikiRequestCloner.copy(originalXWikiContext.getRequest())); XWikiResponse stub = new XWikiServletResponseStub(); clonedXWikiContext.setResponse(stub); if (clonedXWikiContext.getURL() == null) { try { clonedXWikiContext.setURL(new URL("http: } catch (Exception e) { } } XWikiURLFactory xurf = originalXWikiContext.getWiki().getURLFactoryService() .createURLFactory(originalXWikiContext.getMode(), originalXWikiContext); clonedXWikiContext.setURLFactory(xurf); return clonedXWikiContext; }
XWikiContextCopier implements Copier<XWikiContext> { @Override public XWikiContext copy(XWikiContext originalXWikiContext) { originalXWikiContext.getWiki().getStore().cleanUp(originalXWikiContext); XWikiContext clonedXWikiContext = originalXWikiContext.clone(); clonedXWikiContext.setRequest(this.xwikiRequestCloner.copy(originalXWikiContext.getRequest())); XWikiResponse stub = new XWikiServletResponseStub(); clonedXWikiContext.setResponse(stub); if (clonedXWikiContext.getURL() == null) { try { clonedXWikiContext.setURL(new URL("http: } catch (Exception e) { } } XWikiURLFactory xurf = originalXWikiContext.getWiki().getURLFactoryService() .createURLFactory(originalXWikiContext.getMode(), originalXWikiContext); clonedXWikiContext.setURLFactory(xurf); return clonedXWikiContext; } }
XWikiContextCopier implements Copier<XWikiContext> { @Override public XWikiContext copy(XWikiContext originalXWikiContext) { originalXWikiContext.getWiki().getStore().cleanUp(originalXWikiContext); XWikiContext clonedXWikiContext = originalXWikiContext.clone(); clonedXWikiContext.setRequest(this.xwikiRequestCloner.copy(originalXWikiContext.getRequest())); XWikiResponse stub = new XWikiServletResponseStub(); clonedXWikiContext.setResponse(stub); if (clonedXWikiContext.getURL() == null) { try { clonedXWikiContext.setURL(new URL("http: } catch (Exception e) { } } XWikiURLFactory xurf = originalXWikiContext.getWiki().getURLFactoryService() .createURLFactory(originalXWikiContext.getMode(), originalXWikiContext); clonedXWikiContext.setURLFactory(xurf); return clonedXWikiContext; }  }
XWikiContextCopier implements Copier<XWikiContext> { @Override public XWikiContext copy(XWikiContext originalXWikiContext) { originalXWikiContext.getWiki().getStore().cleanUp(originalXWikiContext); XWikiContext clonedXWikiContext = originalXWikiContext.clone(); clonedXWikiContext.setRequest(this.xwikiRequestCloner.copy(originalXWikiContext.getRequest())); XWikiResponse stub = new XWikiServletResponseStub(); clonedXWikiContext.setResponse(stub); if (clonedXWikiContext.getURL() == null) { try { clonedXWikiContext.setURL(new URL("http: } catch (Exception e) { } } XWikiURLFactory xurf = originalXWikiContext.getWiki().getURLFactoryService() .createURLFactory(originalXWikiContext.getMode(), originalXWikiContext); clonedXWikiContext.setURLFactory(xurf); return clonedXWikiContext; }  @Override XWikiContext copy(XWikiContext originalXWikiContext); }
XWikiContextCopier implements Copier<XWikiContext> { @Override public XWikiContext copy(XWikiContext originalXWikiContext) { originalXWikiContext.getWiki().getStore().cleanUp(originalXWikiContext); XWikiContext clonedXWikiContext = originalXWikiContext.clone(); clonedXWikiContext.setRequest(this.xwikiRequestCloner.copy(originalXWikiContext.getRequest())); XWikiResponse stub = new XWikiServletResponseStub(); clonedXWikiContext.setResponse(stub); if (clonedXWikiContext.getURL() == null) { try { clonedXWikiContext.setURL(new URL("http: } catch (Exception e) { } } XWikiURLFactory xurf = originalXWikiContext.getWiki().getURLFactoryService() .createURLFactory(originalXWikiContext.getMode(), originalXWikiContext); clonedXWikiContext.setURLFactory(xurf); return clonedXWikiContext; }  @Override XWikiContext copy(XWikiContext originalXWikiContext);  }