Skip to content
Snippets Groups Projects
Commit 9157694f authored by Simon Urli's avatar Simon Urli
Browse files

XWIKI-22187: Cannot get revisions with a criteria on a document not stored in DB

  * Provide utilities in TestUtils for new integration test
parent 5a454c55
No related branches found
No related tags found
No related merge requests found
......@@ -1214,6 +1214,46 @@ public String executeWiki(String wikiContent, Syntax wikiSyntax) throws Exceptio
return executeAndGetBodyAsString(reference, null);
}
/**
* @since 16.4.0RC1
* @since 15.10.11
*/
public String executeWikiPlain(String wikiContent, Syntax wikiSyntax) throws Exception
{
Map<String, String> queryParameters = new HashMap<>();
queryParameters.put("outputSyntax", "plain");
return executeWiki(wikiContent, wikiSyntax, queryParameters);
}
/**
* @since 16.4.0RC1
* @since 15.10.11
*/
public String executeWiki(String wikiContent, Syntax wikiSyntax, Map<String, String> queryParameters)
throws Exception
{
LocalDocumentReference reference =
new LocalDocumentReference(List.of("Test", "Execute"), UUID.randomUUID().toString());
// Remember the current credentials
UsernamePasswordCredentials currentCredentials = getDefaultCredentials();
try {
// Make sure the page is saved with superadmin author
setDefaultCredentials(SUPER_ADMIN_CREDENTIALS);
// Save the page with the content to execute
rest().savePage(reference, wikiContent, wikiSyntax.toIdString(), null, null);
} finally {
// Restore initial credentials
setDefaultCredentials(currentCredentials);
}
// Execute the content and return the result
return executeAndGetBodyAsString(reference, queryParameters);
}
/**
* @since 7.2M2
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment