use of org.xwiki.query.script.QueryManagerScriptService in project xwiki-platform by xwiki.
the class HelpTest method verifySubHeadingVelocityVariableCorrectlyEvaluatedWhenUsedInSection.
/**
* The bug we're trying to prevent happening again was that there was that "$subHeading" was rendered when going to
* the Links section (for example).
* Note: It was working fine when displaying all sections though.
* @see <a href="https://jira.xwiki.org/browse/XWIKI-13650">XWIKI-13650</a>
*/
@Test
public void verifySubHeadingVelocityVariableCorrectlyEvaluatedWhenUsedInSection() throws Exception {
// URL that we're simulating:
// http://localhost:8080/xwiki/bin/view/XWiki/XWikiSyntax?syntax=2.1§ion=Links&xpage=print
setOutputSyntax(Syntax.XHTML_1_0);
request.put("section", "Links");
request.put("xpage", "print");
// Register the XWikiSyntaxLinks page with an XWikiSyntaxClass xobject in it so that it can be found later on
// by XWiki.XWikiSyntax
loadPage(new DocumentReference("xwiki", "XWiki", "XWikiSyntaxLinks"));
// Register query script service since it's not registered by default and it's used in XWiki.XWikiSyntax to
// find all syntax pages.
QueryManagerScriptService qss = mock(QueryManagerScriptService.class);
mocker.registerComponent(ScriptService.class, "query", qss);
ScriptQuery sq = mock(ScriptQuery.class);
when(qss.xwql(contains("from doc.object(XWiki.XWikiSyntaxClass)"))).thenReturn(sq);
when(sq.addFilter((String) any())).thenReturn(sq);
when(sq.execute()).thenReturn(Arrays.asList("XWiki.XWikiSyntaxLinks"));
String result = renderPage(new DocumentReference("xwiki", "XWiki", "XWikiSyntax"));
assertTrue("$subHeading should have been evaluated and replaced by '==='", result.contains("<h3 id=\"HXWikiSyntax2.1LinkSpecification\""));
assertTrue("$subHeading should have been evaluated and replaced by '==='", !result.contains("$subHeading"));
}
use of org.xwiki.query.script.QueryManagerScriptService in project xwiki-platform by xwiki.
the class WebRssTest method setUp.
@Before
public void setUp() throws Exception {
setOutputSyntax(Syntax.PLAIN_1_0);
request.put("outputSyntax", "plain");
request.put("xpage", "plain");
QueryManagerScriptService qmss = mock(QueryManagerScriptService.class);
oldcore.getMocker().registerComponent(ScriptService.class, "query", qmss);
query = mock(ScriptQuery.class);
when(qmss.xwql("where 1=1 order by doc.date desc")).thenReturn(query);
}
Aggregations