Source Code Cross Referenced for Circuit.java in  » Testing » PolePosition-0.20 » org » polepos » framework » 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 » PolePosition 0.20 » org.polepos.framework 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:        This file is part of the PolePosition database benchmark
003:        http://www.polepos.org
004:
005:        This program is free software; you can redistribute it and/or
006:        modify it under the terms of the GNU General Public License
007:        as published by the Free Software Foundation; either version 2
008:        of the License, or (at your option) any later version.
009:
010:        This program is distributed in the hope that it will be useful,
011:        but WITHOUT ANY WARRANTY; without even the implied warranty of
012:        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:        GNU General Public License for more details.
014:
015:        You should have received a copy of the GNU General Public
016:        License along with this program; if not, write to the Free
017:        Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
018:        MA  02111-1307, USA. */
019:
020:        package org.polepos.framework;
021:
022:        import java.lang.reflect.*;
023:        import java.util.*;
024:
025:        /**
026:         * a set of timed test cases that work against the same data
027:         */
028:        public abstract class Circuit {
029:
030:            private final List<Lap> mLaps;
031:
032:            private final TurnSetup[] mLapSetups;
033:
034:            private final StopWatch watch;
035:
036:            protected Circuit() {
037:                watch = new StopWatch();
038:                mLaps = new ArrayList<Lap>();
039:                mLapSetups = TurnSetup.read(this );
040:                addLaps();
041:            }
042:
043:            /**
044:             * public official name for reporting
045:             */
046:            public final String name() {
047:                String name = internalName();
048:                return name.substring(0, 1).toUpperCase() + name.substring(1);
049:            }
050:
051:            /**
052:             * internal name for BenchmarkSettings.properties
053:             */
054:            public final String internalName() {
055:                String name = this .getClass().getName();
056:                int pos = name.lastIndexOf(".");
057:                return name.substring(pos + 1).toLowerCase();
058:            }
059:
060:            /**
061:             * describes the intent of this circuit, what it wants to test
062:             */
063:            public abstract String description();
064:
065:            /**
066:             * @return the driver class needed to run on this Circuit
067:             */
068:            public abstract Class requiredDriver();
069:
070:            /**
071:             * @return the methods that are intended to be run 
072:             */
073:            protected abstract void addLaps();
074:
075:            public void add(Lap lap) {
076:                mLaps.add(lap);
077:            }
078:
079:            /**
080:             * setups are needed for reporting
081:             */
082:            public TurnSetup[] lapSetups() {
083:                return mLapSetups;
084:            }
085:
086:            public List<Lap> laps() {
087:                return Collections.unmodifiableList(mLaps);
088:            }
089:
090:            /**
091:             * calling all the laps for all the lapSetups
092:             */
093:            public TurnResult[] race(Team team, Car car, Driver driver) {
094:
095:                TurnResult[] results = new TurnResult[mLapSetups.length];
096:
097:                int index = 0;
098:
099:                for (TurnSetup setup : mLapSetups) {
100:
101:                    TurnResult result = new TurnResult();
102:                    results[index++] = result;
103:
104:                    try {
105:                        driver.takeSeatIn(car, setup);
106:                    } catch (CarMotorFailureException e1) {
107:                        e1.printStackTrace();
108:                        break;
109:                    }
110:
111:                    boolean first = true;
112:
113:                    for (Lap lap : mLaps) {
114:
115:                        Method method = null;
116:
117:                        try {
118:                            method = driver.getClass().getDeclaredMethod(
119:                                    lap.name(), (Class[]) null);
120:                        } catch (SecurityException e) {
121:                            e.printStackTrace();
122:                        } catch (NoSuchMethodException e) {
123:                            e.printStackTrace();
124:                        }
125:
126:                        if (!lap.hot()) {
127:                            if (first) {
128:                                first = false;
129:                            } else {
130:                                driver.backToPit();
131:                            }
132:
133:                            try {
134:                                driver.prepare();
135:                            } catch (CarMotorFailureException e) {
136:                                e.printStackTrace();
137:                            }
138:                        }
139:
140:                        watch.start();
141:
142:                        try {
143:                            method.invoke(driver, (Object[]) null);
144:                        } catch (Exception e) {
145:                            System.err.println("Exception on calling method "
146:                                    + method);
147:                            e.printStackTrace();
148:                        }
149:
150:                        watch.stop();
151:
152:                        if (lap.reportResult()) {
153:                            result.report(new Result(this, team, lap, setup,
154:                                    index, watch.millisEllapsed(), driver
155:                                            .checkSum()));
156:                        }
157:                    }
158:
159:                    driver.backToPit();
160:                }
161:                return results;
162:            }
163:
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.