use of org.apache.wiki.WikiContext in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testCollectingLinks2.
@Test
public void testCollectingLinks2() throws Exception {
LinkCollector coll = new LinkCollector();
String src = "[" + PAGE_NAME + "/Test.txt]";
WikiContext context = new WikiContext(testEngine, new WikiPage(testEngine, PAGE_NAME));
MarkupParser p = new JSPWikiMarkupParser(context, new BufferedReader(new StringReader(src)));
p.addLocalLinkHook(coll);
p.addExternalLinkHook(coll);
p.addAttachmentLinkHook(coll);
p.parse();
Collection<String> links = coll.getLinks();
Assert.assertEquals("no links found", 1, links.size());
Assert.assertEquals("wrong link", PAGE_NAME + "/Test.txt", links.iterator().next());
}
use of org.apache.wiki.WikiContext in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testCollectingLinks.
/**
* Test collection of links.
*/
@Test
public void testCollectingLinks() throws Exception {
LinkCollector coll = new LinkCollector();
String src = "[Test]";
WikiContext context = new WikiContext(testEngine, new WikiPage(testEngine, PAGE_NAME));
MarkupParser p = new JSPWikiMarkupParser(context, new BufferedReader(new StringReader(src)));
p.addLocalLinkHook(coll);
p.addExternalLinkHook(coll);
p.addAttachmentLinkHook(coll);
p.parse();
Collection<String> links = coll.getLinks();
Assert.assertEquals("no links found", 1, links.size());
Assert.assertEquals("wrong link", "Test", links.iterator().next());
}
use of org.apache.wiki.WikiContext in project jspwiki by apache.
the class DefaultPluginManagerTest method setUp.
@Before
public void setUp() throws Exception {
engine = new TestEngine(props);
context = new WikiContext(engine, new WikiPage(engine, "Testpage"));
manager = new DefaultPluginManager(engine, props);
}
use of org.apache.wiki.WikiContext in project jspwiki by apache.
the class UndefinedPagesPluginTest method testSimpleUndefined.
/**
* Tests that only correct undefined links are found.
* We also check against plural forms here, which should not
* be listed as non-existent.
*/
@Test
public void testSimpleUndefined() throws Exception {
WikiContext context2 = new WikiContext(testEngine, new WikiPage(testEngine, "Foobar"));
String res = manager.execute(context2, "{INSERT org.apache.wiki.plugin.UndefinedPagesPlugin");
String exp = "[Foobar 2]\\\\";
Assert.assertEquals(wikitize(exp), res);
}
use of org.apache.wiki.WikiContext in project jspwiki by apache.
the class FilterBeanTest method testDoGet.
@Test
public void testDoGet() throws WikiException, NotCompliantMBeanException {
testEngine = new TestEngine(props);
WikiContext context = new WikiContext(testEngine, new WikiPage(testEngine, "TestPage01"));
FilterBean pb = new FilterBean(testEngine);
String expectedHtml = "<div>" + "<h4>Filters</h4>" + "<table border=\"1\">" + "<tr><th>Name</th><th>Author</th><th>Notes</th></tr>" + "<tr><td>org.apache.wiki.filters.SpamFilter</td><td>Janne Jalkanen</td><td></td></tr>" + "</table>" + "</div>";
Assert.assertEquals(expectedHtml, pb.doGet(context));
}
Aggregations