01: package fitnesse.wikitext;
02:
03: import java.util.Set;
04:
05: import fitnesse.components.CachingTagManager;
06: import fitnesse.components.TagManager;
07: import fitnesse.wiki.PageData;
08:
09: public class CachingTagManagerTest extends TagManagerTest {
10:
11: protected TagManager createTagManager() {
12: return new CachingTagManager();
13: }
14:
15: public void testChangeTags() throws Exception {
16: Set pageSet = tagManager.pagesForTags(root,
17: new String[] { "Cat" }, false, false);
18:
19: verifyPages(pageSet, NotStiqTests, Tagged, NotPresent);
20: verifyPages(pageSet, StiqTests, NotTagged, NotPresent);
21:
22: // Tagged and family
23: assertPageLink(pageSet, childTwo, Present);
24:
25: // NOT Tagged and family
26: assertPageLink(pageSet, childThree, NotPresent);
27: assertPageLink(pageSet, childFour, NotPresent);
28: assertPageLink(pageSet, grandChildOne, NotPresent);
29:
30: PageData data = childTwo.getData();
31: data.setContent("!tag Red dog orange\n some text");
32: childTwo.commit(data);
33:
34: //Commit above does not give us a way to listen for the event, so anything that modifies a page
35: //must explicitly call recordTagsForPage.
36: tagManager.recordTagsForPage(childTwo);
37:
38: Set pageSet2 = tagManager.pagesForTags(root,
39: new String[] { "Cat" }, false, false);
40:
41: verifyPages(pageSet2, NotStiqTests, Tagged, NotPresent);
42: verifyPages(pageSet2, StiqTests, NotTagged, NotPresent);
43:
44: // NOT Tagged and family
45: assertPageLink(pageSet2, childTwo, NotPresent);
46: assertPageLink(pageSet2, childThree, NotPresent);
47: assertPageLink(pageSet2, childFour, NotPresent);
48: assertPageLink(pageSet2, grandChildOne, NotPresent);
49:
50: }
51: }
|