Source Code Cross Referenced for PageReferenceRenamerTest.java in  » Testing » StoryTestIQ » fitnesse » components » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » StoryTestIQ » fitnesse.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
002:        // Released under the terms of the GNU General Public License version 2 or later.
003:        package fitnesse.components;
004:
005:        import fitnesse.testutil.AbstractRegex;
006:        import fitnesse.wiki.*;
007:
008:        public class PageReferenceRenamerTest extends AbstractRegex {
009:            WikiPage root;
010:
011:            WikiPage subWiki;
012:
013:            WikiPage subWiki_pageOne;
014:
015:            WikiPage subWiki_pageTwo;
016:
017:            WikiPage subWiki_pageTwo_pageTwoChild;
018:
019:            PageReferenceRenamer renamer;
020:
021:            private PageCrawler crawler;
022:
023:            public void setUp() throws Exception {
024:                root = InMemoryPage.makeRoot("RooT");
025:                crawler = root.getPageCrawler();
026:                subWiki = crawler
027:                        .addPage(root, PathParser.parse("SubWiki"), "");
028:                renamer = new PageReferenceRenamer(root);
029:                subWiki_pageTwo = crawler.addPage(subWiki, PathParser
030:                        .parse("PageTwo"), "");
031:                subWiki_pageTwo_pageTwoChild = crawler.addPage(subWiki_pageTwo,
032:                        PathParser.parse("PageTwoChild"), "");
033:            }
034:
035:            public void testReferencesOnPageOne_1() throws Exception {
036:                checkChangesOnPageOne("Stuff PageTwo Stuff\n",
037:                        "Stuff PageThree Stuff\n");
038:            }
039:
040:            public void testReferencesOnPageOne_2() throws Exception {
041:                checkChangesOnPageOne("Stuff !-PageTwo-! Stuff\n",
042:                        "Stuff !-PageTwo-! Stuff\n");
043:            }
044:
045:            public void testReferencesOnPageOne_3() throws Exception {
046:                checkChangesOnPageOne("Stuff PageOne.PageTwo Stuff\n",
047:                        "Stuff PageOne.PageTwo Stuff\n");
048:            }
049:
050:            public void testReferencesOnPageOne_4() throws Exception {
051:                checkChangesOnPageOne(
052:                        "Stuff .SubWiki.PageTwo.PageTwoChild Stuff\n",
053:                        "Stuff .SubWiki.PageThree.PageTwoChild Stuff\n");
054:            }
055:
056:            public void testReferencesOnPageOne_5() throws Exception {
057:                checkChangesOnPageOne("Stuff ^PageTwo Stuff\n",
058:                        "Stuff ^PageTwo Stuff\n");
059:            }
060:
061:            public void testReferencesOnPageOne_6() throws Exception {
062:                checkChangesOnPageOne("# Stuff PageTwo Stuff\n",
063:                        "# Stuff PageTwo Stuff\n");
064:            }
065:
066:            public void testReferencesOnPageOne_7() throws Exception {
067:                checkChangesOnPageOne("{{{Stuff PageTwo Stuff}}}\n",
068:                        "{{{Stuff PageTwo Stuff}}}\n");
069:            }
070:
071:            public void testReferencesOnPageOne_8() throws Exception {
072:                checkChangesOnPageOne("Stuff .SubWiki.PageTwo Stuff\n",
073:                        "Stuff .SubWiki.PageThree Stuff\n");
074:            }
075:
076:            public void testReferencesOnPageOne_9() throws Exception {
077:                checkChangesOnPageOne("Stuff .SubWiki.PageTwo.NoPage Stuff\n",
078:                        "Stuff .SubWiki.PageThree.NoPage Stuff\n");
079:            }
080:
081:            public void testTestReferencesToSubWiki_1() throws Exception {
082:                PageData data = subWiki.getData();
083:                data.setContent("Stuff ^PageTwo Stuff\n");
084:                subWiki.commit(data);
085:
086:                renamer.renameReferences(subWiki_pageTwo, "PageThree");
087:                String updatedSubWikiContent = subWiki.getData().getContent();
088:                assertEquals("Stuff ^PageThree Stuff\n", updatedSubWikiContent);
089:            }
090:
091:            public void testTestReferencesToSubWiki_2() throws Exception {
092:                PageData data = subWiki.getData();
093:                data.setContent("Stuff ^PageTwo.DeepPage Stuff\n");
094:                subWiki.commit(data);
095:
096:                renamer.renameReferences(subWiki_pageTwo, "PageThree");
097:                String updatedSubWikiContent = subWiki.getData().getContent();
098:                assertEquals("Stuff ^PageThree.DeepPage Stuff\n",
099:                        updatedSubWikiContent);
100:            }
101:
102:            private void checkChangesOnPageOne(String beforeText,
103:                    String expectedAfterText) throws Exception {
104:                subWiki_pageOne = crawler.addPage(subWiki, PathParser
105:                        .parse("PageOne"), beforeText);
106:                renamer.renameReferences(subWiki_pageTwo, "PageThree");
107:                subWiki_pageOne = subWiki.getChildPage("PageOne");
108:                String updatedPageOneContent = subWiki_pageOne.getData()
109:                        .getContent();
110:                assertEquals(expectedAfterText, updatedPageOneContent);
111:            }
112:
113:            public void testRenameParentPage() throws Exception {
114:                PageData pageTwoChildData = subWiki_pageTwo_pageTwoChild
115:                        .getData();
116:                pageTwoChildData.setContent("gunk .SubWiki.PageTwo gunk");
117:                subWiki_pageTwo_pageTwoChild.commit(pageTwoChildData);
118:                renamer.renameReferences(subWiki_pageTwo, "PageThree");
119:                String updatedContent = subWiki_pageTwo_pageTwoChild.getData()
120:                        .getContent();
121:                assertEquals("gunk .SubWiki.PageThree gunk", updatedContent);
122:            }
123:
124:            public void testRenameParentWithReferenceOnSibling()
125:                    throws Exception {
126:                WikiPage pageOne = crawler.addPage(subWiki, PathParser
127:                        .parse("PageOne"), "gunk ^SubPage gunk");
128:                renamer.renameReferences(subWiki, "RenamedSubWiki");
129:                String updatedContent = pageOne.getData().getContent();
130:                assertEquals("gunk ^SubPage gunk", updatedContent);
131:            }
132:
133:            public void testRenameParentWithSubPageReferenceOnSibling()
134:                    throws Exception {
135:                WikiPage pageOne = crawler.addPage(subWiki, PathParser
136:                        .parse("PageOne"), "gunk PageTwo gunk");
137:                renamer.renameReferences(subWiki, "RenamedSubWiki");
138:                String updatedContent = pageOne.getData().getContent();
139:                assertEquals("gunk PageTwo gunk", updatedContent);
140:            }
141:
142:            public void testRenameSiblingOfRoot() throws Exception {
143:                WikiPage source = crawler.addPage(root, PathParser
144:                        .parse("SourcePage"), "gunk TargetPage gunk");
145:                WikiPage target = crawler.addPage(root, PathParser
146:                        .parse("TargetPage"));
147:                renamer.renameReferences(target, "RenamedPage");
148:                String updatedSourceContent = source.getData().getContent();
149:                assertEquals("gunk RenamedPage gunk", updatedSourceContent);
150:            }
151:
152:            public void testRenameSubpageOfRoot() throws Exception {
153:                WikiPage source = crawler.addPage(root, PathParser
154:                        .parse("SourcePage"), "gunk ^TargetPage gunk");
155:                WikiPage target = crawler.addPage(source, PathParser
156:                        .parse("TargetPage"));
157:                renamer.renameReferences(target, "RenamedPage");
158:                String updatedSourceContent = source.getData().getContent();
159:                assertEquals("gunk ^RenamedPage gunk", updatedSourceContent);
160:            }
161:
162:            public void testImageNotChanged() throws Exception {
163:                final String IMAGE_WIDGET = "!img http://PageTwo.jpg";
164:                checkChangesOnPageOne(IMAGE_WIDGET, IMAGE_WIDGET);
165:            }
166:
167:            public void testLinkNotChanged() throws Exception {
168:                final String LINK_WIDGET = "http://PageTwo";
169:                checkChangesOnPageOne(LINK_WIDGET, LINK_WIDGET);
170:            }
171:
172:            public void testPathNotChanged() throws Exception {
173:                final String PATH_WIDGET = "!path PageTwo";
174:                checkChangesOnPageOne(PATH_WIDGET, PATH_WIDGET);
175:            }
176:
177:            public void testFixtureNotChanged() throws Exception {
178:                final String FIXTURE_WIDGET = "!fixture PageTwo";
179:                checkChangesOnPageOne(FIXTURE_WIDGET, FIXTURE_WIDGET);
180:            }
181:
182:            public void testAliasTagNotChanged() throws Exception {
183:                final String ALIAS_LINK = "[[PageTwo][MyPageTwo]]";
184:                checkChangesOnPageOne(ALIAS_LINK, ALIAS_LINK);
185:            }
186:
187:            public void testAliasLinkRenamed() throws Exception {
188:                checkChangesOnPageOne("gunk [[gunk][PageTwo]] gunk",
189:                        "gunk [[gunk][PageThree]] gunk");
190:            }
191:
192:            public void testAliasLinWithLiteralDoesntGetCorrupted()
193:                    throws Exception {
194:                checkChangesOnPageOne("gunk [[!-gunk-!][PageTwo]] gunk",
195:                        "gunk [[!-gunk-!][PageThree]] gunk");
196:            }
197:
198:            public void testXrefWidgetRenamed() throws Exception {
199:                checkChangesOnPageOne("!see PageTwo", "!see PageThree");
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.