Source Code Cross Referenced for StressTestRCSProvider.java in  » Wiki-Engine » JSPWiki » stress » 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 » Wiki Engine » JSPWiki » stress 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package stress;
002:
003:        import junit.framework.*;
004:        import java.io.*;
005:        import java.util.*;
006:
007:        import com.ecyrd.jspwiki.*;
008:        import com.ecyrd.jspwiki.providers.*;
009:
010:        /**
011:         *  Does stress testing on the RCSProvider.
012:         */
013:        public class StressTestRCSProvider extends TestCase {
014:            public static final String NAME1 = "Test1";
015:
016:            Properties props = new Properties();
017:
018:            TestEngine engine;
019:
020:            public StressTestRCSProvider(String s) {
021:                super (s);
022:            }
023:
024:            public void setUp() throws Exception {
025:                props.load(TestEngine
026:                        .findTestProperties("/jspwiki_rcs.properties"));
027:                props.setProperty(CachingProvider.PROP_CACHECAPACITY, "10000");
028:                engine = new TestEngine(props);
029:            }
030:
031:            public void tearDown() {
032:                String files = props
033:                        .getProperty(FileSystemProvider.PROP_PAGEDIR);
034:
035:                File f = new File(files, NAME1 + FileSystemProvider.FILE_EXT);
036:
037:                f.delete();
038:
039:                f = new File(files + File.separator + "RCS", NAME1
040:                        + FileSystemProvider.FILE_EXT + ",v");
041:
042:                f.delete();
043:
044:                f = new File(files, "RCS");
045:
046:                f.delete();
047:            }
048:
049:            /**
050:             *  Bug report by Anon: RCS under Windows 2k:
051:             * <PRE>
052:             * In getPageInfo of RCSFileProvider:
053:             *
054:             * Problem:
055:             *
056:             * With a longer rlog result, the break clause in the last "else if" 
057:             * breaks out of the reading loop before all the lines in the full 
058:             * rlog have been read in. This causes the process.wait() to hang.
059:             *
060:             * Suggested quick fix:
061:             *
062:             * Always read all the contents of the rlog, even if it is slower.
063:             * </PRE>
064:             *
065:             */
066:
067:            public void testMillionChanges() throws Exception {
068:                String text = "";
069:                String name = NAME1;
070:                int maxver = 2000; // Save 2000 versions.
071:                Benchmark mark = new Benchmark();
072:
073:                mark.start();
074:                for (int i = 0; i < maxver; i++) {
075:                    text = text + ".";
076:                    engine.saveText(name, text);
077:                }
078:                mark.stop();
079:
080:                System.out.println("Benchmark: " + mark.toString(2000)
081:                        + " pages/second");
082:                WikiPage pageinfo = engine.getPage(NAME1);
083:
084:                assertEquals("wrong version", maxver, pageinfo.getVersion());
085:                // +2 comes from \r\n at the end of each file.
086:                assertEquals("wrong text", maxver + 2, engine.getText(NAME1)
087:                        .length());
088:            }
089:
090:            private void runMassiveFileTest(int maxpages) throws Exception {
091:                String text = "Testing, 1, 2, 3: ";
092:                String name = NAME1;
093:                Benchmark mark = new Benchmark();
094:
095:                System.out.println("Building a massive repository of "
096:                        + maxpages + " pages...");
097:
098:                mark.start();
099:                for (int i = 0; i < maxpages; i++) {
100:                    engine.saveText(name + i, text + i);
101:                }
102:                mark.stop();
103:
104:                System.out.println("Total time to save " + maxpages
105:                        + " pages was " + mark.toString());
106:                System.out.println("Saved " + mark.toString(maxpages)
107:                        + " pages/second");
108:
109:                mark.reset();
110:
111:                mark.start();
112:                Collection pages = engine.getPageManager().getAllPages();
113:                mark.stop();
114:
115:                System.out.println("Got a list of all pages in " + mark);
116:
117:                mark.reset();
118:                mark.start();
119:
120:                for (Iterator i = pages.iterator(); i.hasNext();) {
121:                    String foo = engine.getPureText((WikiPage) i.next());
122:
123:                    assertNotNull(foo);
124:                }
125:                mark.stop();
126:
127:                System.out.println("Read through all of the pages in " + mark);
128:                System.out.println("which is " + mark.toString(maxpages)
129:                        + " pages/second");
130:            }
131:
132:            public void testMillionFiles1() throws Exception {
133:                runMassiveFileTest(100);
134:            }
135:
136:            public void testMillionFiles2() throws Exception {
137:                runMassiveFileTest(1000);
138:            }
139:
140:            public void testMillionFiles3() throws Exception {
141:                runMassiveFileTest(10000);
142:            }
143:
144:            public static Test suite() {
145:                return new TestSuite(StressTestRCSProvider.class);
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.