Source Code Cross Referenced for PageDataTest.java in  » Testing » StoryTestIQ » fitnesse » wiki » 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.wiki 
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.wiki;
004:
005:        import fitnesse.testutil.AbstractRegex;
006:        import fitnesse.responders.run.*;
007:
008:        import java.util.*;
009:        import java.text.SimpleDateFormat;
010:
011:        public class PageDataTest extends AbstractRegex {
012:            public WikiPage page;
013:
014:            private WikiPage root;
015:
016:            private PageCrawler crawler;
017:
018:            public void setUp() throws Exception {
019:                root = InMemoryPage.makeRoot("RooT");
020:                crawler = root.getPageCrawler();
021:                page = crawler.addPage(root, PathParser.parse("PagE"),
022:                        "some content");
023:            }
024:
025:            public void tearDown() throws Exception {
026:            }
027:
028:            public void testVariablePreprocessing() throws Exception {
029:                PageData d = new PageData(InMemoryPage.makeRoot("RooT"),
030:                        "!define x {''italic''}\n${x}\n");
031:                String preprocessedText = d.getContent();
032:                assertHasRegexp("''italic''", preprocessedText);
033:            }
034:
035:            public void testVariablesRenderedFirst() throws Exception {
036:                String text = "!define x {''italics''}\n${x}";
037:                WikiPage root = InMemoryPage.makeRoot("RooT");
038:                WikiPage page = crawler.addPage(root, PathParser
039:                        .parse("SomePage"), text);
040:                String html = page.getData().getHtml();
041:                assertHasRegexp("''italics''", html);
042:                assertHasRegexp("<i>italics</i>", html);
043:            }
044:
045:            public void testThatSpecialCharsAreNotEscapedTwice()
046:                    throws Exception {
047:                PageData d = new PageData(new MockWikiPage(), "<b>");
048:                String html = d.getHtml();
049:                assertEquals("&lt;b&gt;", html);
050:            }
051:
052:            public void testLiteral() throws Exception {
053:                WikiPage root = InMemoryPage.makeRoot("RooT");
054:                WikiPage page = crawler.addPage(root, PathParser
055:                        .parse("LiteralPage"), "!-literal-!");
056:                String renderedContent = page.getData().getHtml();
057:                assertHasRegexp("literal", renderedContent);
058:                assertDoesntHaveRegexp("!-literal-!", renderedContent);
059:            }
060:
061:            public void testClasspath() throws Exception {
062:                WikiPage root = InMemoryPage.makeRoot("RooT");
063:                WikiPage page = crawler.addPage(root, PathParser
064:                        .parse("ClassPath"), "!path 123\n!path abc\n");
065:                List paths = page.getData().getClasspaths();
066:                assertTrue(paths.contains("123"));
067:                assertTrue(paths.contains("abc"));
068:            }
069:
070:            public void testGetFixtureNames() throws Exception {
071:                WikiPage root = InMemoryPage.makeRoot("RooT");
072:                WikiPage page = crawler
073:                        .addPage(
074:                                root,
075:                                PathParser.parse("PageName"),
076:                                "!fixture FixtureOne\r\nNot.A.Fixture\r\n!fixture FixtureTwo\n\n!fixture FixtureThree");
077:                List fixtureNames = page.getData().getFixtureNames();
078:                assertEquals(3, fixtureNames.size());
079:                assertEquals("FixtureOne", fixtureNames.get(0));
080:                assertEquals("FixtureTwo", fixtureNames.get(1));
081:                assertEquals("FixtureThree", fixtureNames.get(2));
082:            }
083:
084:            public void testGetCrossReferences() throws Exception {
085:                WikiPage root = InMemoryPage.makeRoot("RooT");
086:                WikiPage page = crawler.addPage(root, PathParser
087:                        .parse("PageName"), "!xref XrefPage\r\n");
088:                List xrefs = page.getData().getXrefPages();
089:                assertEquals("XrefPage", xrefs.get(0));
090:            }
091:
092:            public void testDefaultAttributes() throws Exception {
093:                WikiPage normalPage = crawler.addPage(root, PathParser
094:                        .parse("NormalPage"));
095:                WikiPage testPage = crawler.addPage(root, PathParser
096:                        .parse("TestPage"));
097:                WikiPage suitePage = crawler.addPage(root, PathParser
098:                        .parse("SuitePage"));
099:                WikiPage suiteSetupPage = crawler.addPage(root, PathParser
100:                        .parse(SuiteResponder.SUITE_SETUP_NAME));
101:                WikiPage suiteTearDownPage = crawler.addPage(root, PathParser
102:                        .parse(SuiteResponder.SUITE_TEARDOWN_NAME));
103:
104:                PageData data = new PageData(normalPage);
105:                assertTrue(data.hasAttribute(WikiPage.ACTION_EDIT));
106:
107:                data = new PageData(testPage);
108:                assertTrue(data.hasAttribute(WikiPage.ACTION_TEST));
109:                assertFalse(data.hasAttribute(WikiPage.ACTION_SUITE));
110:
111:                data = new PageData(suitePage);
112:                assertFalse(data.hasAttribute(WikiPage.ACTION_TEST));
113:                assertTrue(data.hasAttribute(WikiPage.ACTION_SUITE));
114:
115:                data = new PageData(suiteSetupPage);
116:                assertFalse(data.hasAttribute(WikiPage.ACTION_SUITE));
117:
118:                data = new PageData(suiteTearDownPage);
119:                assertFalse(data.hasAttribute(WikiPage.ACTION_SUITE));
120:            }
121:
122:            public void testAttributesAreTruelyCopiedInCopyConstructor()
123:                    throws Exception {
124:                PageData data = root.getData();
125:                data.setAttribute(WikiPage.LAST_MODIFYING_USER, "Joe");
126:                PageData newData = new PageData(data);
127:                newData.setAttribute(WikiPage.LAST_MODIFYING_USER, "Jane");
128:
129:                assertEquals("Joe", data
130:                        .getAttribute(WikiPage.LAST_MODIFYING_USER));
131:            }
132:
133:            public void testLastModificationTime() throws Exception {
134:                SimpleDateFormat format = PageData.makeVersionTimeFormat();
135:                PageData data = new PageData(root);
136:                assertEquals(format.format(new Date()), format.format(data
137:                        .getLastModificationTime()));
138:                Date date = format.parse("20040101000001");
139:                data.setLastModificationTime(date);
140:                assertEquals("20040101000001", data.getProperties().get(
141:                        "LastModified"));
142:                assertEquals(date, data.getLastModificationTime());
143:            }
144:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.