Source Code Cross Referenced for PerformanceTest.java in  » Database-ORM » dozer » net » sf » dozer » functional_tests » 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 » Database ORM » dozer » net.sf.dozer.functional_tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package net.sf.dozer.functional_tests;
017:
018:        import net.sf.dozer.util.mapping.MapperIF;
019:        import net.sf.dozer.util.mapping.vo.SimpleObj;
020:        import net.sf.dozer.util.mapping.vo.SimpleObjPrime;
021:        import net.sf.dozer.util.mapping.vo.SimpleObjPrime2;
022:        import net.sf.dozer.util.mapping.vo.TestObject;
023:        import net.sf.dozer.util.mapping.vo.TestObjectPrime;
024:        import net.sf.dozer.util.mapping.vo.deep.DestDeepObj;
025:        import net.sf.dozer.util.mapping.vo.deep.SrcDeepObj;
026:        import net.sf.dozer.util.mapping.vo.inheritance.AnotherSubClass;
027:        import net.sf.dozer.util.mapping.vo.inheritance.AnotherSubClassPrime;
028:        import net.sf.dozer.util.mapping.vo.perf.MyClassA;
029:        import net.sf.dozer.util.mapping.vo.perf.MyClassB;
030:
031:        import org.apache.commons.lang.time.StopWatch;
032:        import org.apache.commons.logging.Log;
033:        import org.apache.commons.logging.LogFactory;
034:
035:        /**
036:         * @author tierney.matt
037:         * @author garsombke.franz
038:         */
039:        public class PerformanceTest extends AbstractMapperTest {
040:            private static Log log = LogFactory.getLog(PerformanceTest.class);
041:            private static MapperIF mapper;
042:
043:            private int numIters = 1;
044:
045:            protected void setUp() throws Exception {
046:                super .setUp();
047:                if (mapper == null) {
048:                    mapper = getMapper(new String[] { "dozerBeanMapping.xml" });
049:                }
050:            }
051:
052:            /*
053:             * Baseline Performance Numbers. Established with Release 2.0 - Jan 2006
054:             * 
055:             * All performance results based on 25000 numIters and jdk 1.4.2(unless otherwise specified)
056:             * 
057:             * TEST TOTAL TIME(ms) - 1/1/06
058:             * 
059:             * testMapping1 19562 testMapping2 2859 testMapping3 2782 testMapping4 8391 testMapping5 4985
060:             * 
061:             * 
062:             * MHT Computer - 8/12/06 
063:             * #1 17015 #2 1954 #3 1890 #4 5985 #5 4062
064:             * 
065:             * 
066:             * MHT Computer - 9/26/06 - After 2.3 release 
067:             * #1 19578 #2 1937 #3 1953 #4 6734 #5 4641
068:             * 
069:             * 
070:             * MHT Computer - 10/1/06 - 2.4 release. After removing Reflection caching to resolve general CGLIB/Proxy issues 
071:             * #1 29313 #2 2985 #3 3130 #4 9891 #5 7656
072:             * 
073:             * 
074:             * MHT Computer - 12/20/06 - 2.5 release. After adding code submitted for fixing recursive mapping infinite loop
075:             * problem. Due to maintaining mappedFields variable in MappingProcessor. Is this ok or better way to do it? Not sure
076:             * #1 31422 #2 3485 #3 3547 #4 11656 #5 8281
077:             * 
078:             * 
079:             * MHT Computer - 1/26/07 - 2.5 release. After making misc perf improvements to improve test case #6
080:             * #1 26047 #2 3375 #3 3469 #4 11672 #5 7516 #6 45850
081:             * 
082:             * 
083:             * MHT Computer - 2/1/07 - 2.5 release. Just prior to release of 2.5
084:             * #1 26266 #2 3094 #3 3203 #4 11297 #5 7453 #6 42312
085:             * 
086:             * 
087:             * MHT Computer - 4/2/07 - 3.2 release.
088:             * #1 24891 #2 3125 #3 3219 #4 10609 #5 7328 #6 45156
089:             * 
090:             * 
091:             * MHT Computer - 4/7/07 - 3.2.1 release.
092:             * jdk1.4 #1 25391 #2 3094 #3 3156 #4 10516 #5 7406 #6 44922
093:             * jdk1.5 #1 24016 #2 2797 #3 2890 #4 10031 #5 7125 #6 41797
094:             * 
095:             * 
096:             * MHT Computer - 4/19/07 - 3.2.1 release. Rebaseline test #6. Unused and Uneccessary test data setup logic was
097:             * skewing prior results.
098:             * jdk1.4 #1 25391 #2 3094 #3 3156 #4 10516 #5 7406 #6 31687
099:             * jdk1.5 #1 24016 #2 2797 #3 2890 #4 10031 #5 7125 #6 26265
100:             * 
101:             * 
102:             * MHT Computer - 4/24/07 - 3.3 release
103:             * jdk1.4 #1 25485 #2 2907 #3 3219 #4 10375 #5 7312 #6 33703
104:             * jdk1.5 #1 23172 #2 2406 #3 2750 #4 9817 #5 6771 #6 26718
105:             * 
106:             * 
107:             * MHT Computer - 5/16/07 - 3.4 release
108:             * jdk1.4 #1 27854 #2 2945 #3 3123 #4 11844 #5 8437 #6 19567
109:             * jdk1.5 #1 27485 #2 2532 #3 2906 #4 11297 #5 8157 #6 16797
110:             * 
111:             * 
112:             * MHT Computer - 7/06/07 - 4.0 release after map backed property refactor
113:             * jdk1.4 #1 27047 #2 3140 #3 3172 #4 12328 #5 8359 #6 33281
114:             * jdk1.5 #1 26484 #2 3016 #3 3062 #4 11781 #5 7906 #6 30594
115:             * 
116:             *
117:             * MHT Computer - 7/15/07 - 4.0 release
118:             * jdk1.4 #1 24078 #2 2844 #3 2891 #4 11656 #5 7797 #6 36156
119:             * jdk1.5 #1 24625 #2 2656 #3 2688 #4 11515 #5 7781 #6 31797
120:             * 
121:             * MHT Computer - 9/25/07 - 4.1 release
122:             * jdk1.4 #1 25766 #2 2938 #3 3000 #4 12078 #5 8156 #6 36031
123:             * jdk1.5 #1 24516 #2 2578 #3 2672 #4 11671 #5 7875 #6 32000
124:             * 
125:             * MHT Computer - 12/15/07 - 4.2 release
126:             * jdk1.4 #1 23937 #2 2781 #3 2781 #4 11696 #5 7687 #6 36953
127:             * jdk1.5 #1 24157 #2 2594 #3 2640 #4 12438 #5 7984 #6 34531
128:             * 
129:             */
130:
131:            public void testMapping1() throws Exception {
132:                // TestObject --> TestObjectPrime
133:                TestObject src = testDataFactory
134:                        .getInputGeneralMappingTestObject();
135:                runGeneric("testMapping1", src, TestObjectPrime.class, 35000);
136:            }
137:
138:            public void testMapping2() throws Exception {
139:                // SimpleObject --> SimpleObjectPrime
140:                SimpleObj src = testDataFactory.getSimpleObj();
141:                runGeneric("testMapping2", src, SimpleObjPrime.class, 3600);
142:            }
143:
144:            public void testMapping3() throws Exception {
145:                // SimpleObject --> SimpleObjectPrime2
146:                SimpleObj src = testDataFactory.getSimpleObj();
147:                runGeneric("testMapping3", src, SimpleObjPrime2.class, 3700);
148:            }
149:
150:            public void testMapping4() throws Exception {
151:                // AnotherSubClass --> AnotherSubClassPrime (Inheritance)
152:                AnotherSubClass src = testDataFactory.getAnotherSubClass();
153:                runGeneric("testMapping4", src, AnotherSubClassPrime.class,
154:                        12000);
155:            }
156:
157:            public void testMapping5() throws Exception {
158:                // SrcDeepObj --> DestDeepObj (Field Deep)
159:                SrcDeepObj src = testDataFactory.getSrcDeepObj();
160:                runGeneric("testMapping5", src, DestDeepObj.class, 9000);
161:            }
162:
163:            // 1-2007: Test Case submitted by Dave B.
164:            public void testMapping6() throws Exception {
165:                // MyClassA --> MyClassB. Src object contains List with 500 String elements.
166:                MyClassA src = testDataFactory.getRandomMyClassA();
167:                runGeneric("testMapping6", src, MyClassB.class, 50000);
168:            }
169:
170:            protected DataObjectInstantiator getDataObjectInstantiator() {
171:                return NoProxyDataObjectInstantiator.INSTANCE;
172:            }
173:
174:            private void runGeneric(String testName, Object src,
175:                    Class destClass, long maxTimeAllowed) throws Exception {
176:                // warm up the mapper
177:                mapper.map(src, destClass);
178:
179:                // perform x number of additional mappings
180:                log.debug("Begin timings for " + testName);
181:                StopWatch timer = new StopWatch();
182:                timer.start();
183:                for (int i = 0; i < numIters; i++) {
184:                    mapper.map(src, destClass);
185:                }
186:                timer.stop();
187:                log.debug("Total time for additional " + numIters
188:                        + " mappings: " + timer.getTime() + " milliseconds");
189:                log.debug("avg time for " + numIters + " mappings: "
190:                        + (timer.getTime() / numIters) + " milliseconds");
191:
192:                if (timer.getTime() > maxTimeAllowed) {
193:                    log.error("Elapsed time exceeded max allowed: "
194:                            + maxTimeAllowed + " Actual time: "
195:                            + timer.getTime());
196:                }
197:            }
198:
199:            /* public static void main(String[] args) {
200:               junit.textui.TestRunner.run(PerformanceTest.class);
201:             }*/
202:
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.