01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.components;
04:
05: import junit.swingui.TestRunner;
06: import fitnesse.testutil.AbstractRegex;
07:
08: public class RecentChangesTest extends AbstractRegex {
09: // private WikiPage rootPage;
10: //
11: // private WikiPage newPage;
12: //
13: // private WikiPage page1;
14: //
15: // private WikiPage page2;
16:
17: public static void main(String[] args) {
18: TestRunner.main(new String[] { "RecentChangesTest" });
19: }
20:
21: // public void setUp() throws Exception {
22: // rootPage = InMemoryPage.makeRoot("RooT");
23: // newPage = rootPage.addChildPage("SomeNewPage");
24: // page1 = rootPage.addChildPage("PageOne");
25: // page2 = rootPage.addChildPage("PageTwo");
26: // }
27: //
28: // public void tearDown() throws Exception {
29: // }
30:
31: public void testBogus() {
32:
33: }
34: // public void testFirstRecentChange() throws Exception {
35: // assertEquals(false, rootPage.hasChildPage("RecentChanges"));
36: // RecentChanges.updateRecentChanges(newPage.getData());
37: // assertEquals(true, rootPage.hasChildPage("RecentChanges"));
38: // WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
39: // List lines = RecentChanges.getRecentChangesLines(recentChanges.getData());
40: // assertEquals(1, lines.size());
41: // assertHasRegexp("SomeNewPage", (String) lines.get(0));
42: // }
43: //
44: // public void testTwoChanges() throws Exception {
45: // RecentChanges.updateRecentChanges(page1.getData());
46: // RecentChanges.updateRecentChanges(page2.getData());
47: // WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
48: // List lines = RecentChanges.getRecentChangesLines(recentChanges.getData());
49: // assertEquals(2, lines.size());
50: // assertHasRegexp("PageTwo", (String) lines.get(0));
51: // assertHasRegexp("PageOne", (String) lines.get(1));
52: // }
53: //
54: // public void testNoDuplicates() throws Exception {
55: // RecentChanges.updateRecentChanges(page1.getData());
56: // RecentChanges.updateRecentChanges(page1.getData());
57: // WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
58: // List lines = RecentChanges.getRecentChangesLines(recentChanges.getData());
59: // assertEquals(1, lines.size());
60: // assertHasRegexp("PageOne", (String) lines.get(0));
61: // }
62: //
63: // public void testMaxSize() throws Exception {
64: // for (int i = 0; i < 101; i++) {
65: // StringBuffer b = new StringBuffer("LotsOfAs");
66: // for (int j = 0; j < i; j++)
67: // b.append("a");
68: // WikiPage page = rootPage.addChildPage(b.toString());
69: // RecentChanges.updateRecentChanges(page.getData());
70: // }
71: //
72: // WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
73: // List lines = RecentChanges.getRecentChangesLines(recentChanges.getData());
74: // assertEquals(100, lines.size());
75: // }
76: //
77: // public void testUsernameColumnWithoutUser() throws Exception {
78: // RecentChanges.updateRecentChanges(page1.getData());
79: // WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
80: // List lines = RecentChanges.getRecentChangesLines(recentChanges.getData());
81: // String line = lines.get(0).toString();
82: // assertSubString("|PageOne||", line);
83: // }
84: //
85: // public void testUsernameColumnWithUser() throws Exception {
86: // PageData data = page1.getData();
87: // data.setAttribute(WikiPage.LAST_MODIFYING_USER, "Aladdin");
88: // page1.commit(data);
89: //
90: // RecentChanges.updateRecentChanges(page1.getData());
91: // WikiPage recentChanges = rootPage.getChildPage("RecentChanges");
92: // List lines = RecentChanges.getRecentChangesLines(recentChanges.getData());
93: // String line = lines.get(0).toString();
94: // assertSubString("|PageOne|Aladdin|", line);
95: // }
96: }
|