@Test public void saveRequestwiki() { this.oldcore.getXWikiContext().setWikiId(WIKI); this.oldcore.getXWikiContext().setOriginalWikiId(this.oldcore.getXWikiContext().getWikiId()); Map<String, Serializable> contextStore = new HashMap<>(); this.store.save(contextStore, this.store.getSupportedEntries()); assertFalse(contextStore.containsKey(XWikiContextContextStore.PROP_REQUEST_WIKI)); this.oldcore.getXWikiContext().setOriginalWikiId(REQUESTWIKI); this.store.save(contextStore, this.store.getSupportedEntries()); assertFalse(contextStore.containsKey(XWikiContextContextStore.PROP_REQUEST_WIKI)); this.oldcore.getXWikiContext().setRequest(mock(XWikiRequest.class)); this.store.save(contextStore, this.store.getSupportedEntries()); assertEquals(REQUESTWIKI, contextStore.get(XWikiContextContextStore.PROP_REQUEST_WIKI)); }
@Override public void save(Map<String, Serializable> contextStore, Collection<String> entries) { XWikiContext xcontext = this.readProvider.get(); if (xcontext != null) { save(contextStore, PROP_WIKI, xcontext.getWikiId(), entries); save(contextStore, PROP_USER, xcontext.getUserReference(), entries); save(contextStore, PROP_SECURE_AUTHOR, xcontext.getAuthorReference(), entries); save(contextStore, PROP_LOCALE, xcontext.getLocale(), entries); save(contextStore, PREFIX_PROP_DOCUMENT, xcontext.getDoc(), entries); save(contextStore, PREFIX_PROP_REQUEST, xcontext.getRequest(), entries, xcontext); } }
XWikiContextContextStore extends AbstractContextStore { @Override public void save(Map<String, Serializable> contextStore, Collection<String> entries) { XWikiContext xcontext = this.readProvider.get(); if (xcontext != null) { save(contextStore, PROP_WIKI, xcontext.getWikiId(), entries); save(contextStore, PROP_USER, xcontext.getUserReference(), entries); save(contextStore, PROP_SECURE_AUTHOR, xcontext.getAuthorReference(), entries); save(contextStore, PROP_LOCALE, xcontext.getLocale(), entries); save(contextStore, PREFIX_PROP_DOCUMENT, xcontext.getDoc(), entries); save(contextStore, PREFIX_PROP_REQUEST, xcontext.getRequest(), entries, xcontext); } } }
XWikiContextContextStore extends AbstractContextStore { @Override public void save(Map<String, Serializable> contextStore, Collection<String> entries) { XWikiContext xcontext = this.readProvider.get(); if (xcontext != null) { save(contextStore, PROP_WIKI, xcontext.getWikiId(), entries); save(contextStore, PROP_USER, xcontext.getUserReference(), entries); save(contextStore, PROP_SECURE_AUTHOR, xcontext.getAuthorReference(), entries); save(contextStore, PROP_LOCALE, xcontext.getLocale(), entries); save(contextStore, PREFIX_PROP_DOCUMENT, xcontext.getDoc(), entries); save(contextStore, PREFIX_PROP_REQUEST, xcontext.getRequest(), entries, xcontext); } } XWikiContextContextStore(); }
XWikiContextContextStore extends AbstractContextStore { @Override public void save(Map<String, Serializable> contextStore, Collection<String> entries) { XWikiContext xcontext = this.readProvider.get(); if (xcontext != null) { save(contextStore, PROP_WIKI, xcontext.getWikiId(), entries); save(contextStore, PROP_USER, xcontext.getUserReference(), entries); save(contextStore, PROP_SECURE_AUTHOR, xcontext.getAuthorReference(), entries); save(contextStore, PROP_LOCALE, xcontext.getLocale(), entries); save(contextStore, PREFIX_PROP_DOCUMENT, xcontext.getDoc(), entries); save(contextStore, PREFIX_PROP_REQUEST, xcontext.getRequest(), entries, xcontext); } } XWikiContextContextStore(); @Override void save(Map<String, Serializable> contextStore, Collection<String> entries); @Override void restore(Map<String, Serializable> contextStore); }
XWikiContextContextStore extends AbstractContextStore { @Override public void save(Map<String, Serializable> contextStore, Collection<String> entries) { XWikiContext xcontext = this.readProvider.get(); if (xcontext != null) { save(contextStore, PROP_WIKI, xcontext.getWikiId(), entries); save(contextStore, PROP_USER, xcontext.getUserReference(), entries); save(contextStore, PROP_SECURE_AUTHOR, xcontext.getAuthorReference(), entries); save(contextStore, PROP_LOCALE, xcontext.getLocale(), entries); save(contextStore, PREFIX_PROP_DOCUMENT, xcontext.getDoc(), entries); save(contextStore, PREFIX_PROP_REQUEST, xcontext.getRequest(), entries, xcontext); } } XWikiContextContextStore(); @Override void save(Map<String, Serializable> contextStore, Collection<String> entries); @Override void restore(Map<String, Serializable> contextStore); static final String PROP_WIKI; static final String PROP_USER; static final String PROP_SECURE_AUTHOR; static final String PROP_SECURE_DOCUMENT; static final String PROP_LOCALE; static final String PREFIX_PROP_REQUEST; static final String SUFFIX_PROP_REQUEST_BASE; static final String SUFFIX_PROP_REQUEST_URL; static final String SUFFIX_PROP_REQUEST_CONTEXTPATH; static final String SUFFIX_PROP_REQUEST_PARAMETERS; static final String SUFFIX_PROP_REQUEST_WIKI; static final String PROP_REQUEST_BASE; static final String PROP_REQUEST_URL; static final String PROP_REQUEST_CONTEXTPATH; static final String PROP_REQUEST_PARAMETERS; static final String PROP_REQUEST_WIKI; static final String PREFIX_PROP_DOCUMENT; static final String SUFFIX_PROP_DOCUMENT_REFERENCE; static final String PROP_DOCUMENT_REFERENCE; }