Source Code Cross Referenced for Test.java in  » Testing » jacareto » jacareto » test » 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 » jacareto » jacareto.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Jacareto Copyright (c) 2002-2005
003:         * Applied Computer Science Research Group, Darmstadt University of
004:         * Technology, Institute of Mathematics & Computer Science,
005:         * Ludwigsburg University of Education, and Computer Based
006:         * Learning Research Group, Aachen University. All rights reserved.
007:         *
008:         * Jacareto is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2 of the License, or (at your option) any later version.
012:         *
013:         * Jacareto is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         * General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public
019:         * License along with Jacareto; if not, write to the Free
020:         * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         *
022:         */
023:
024:        package jacareto.test;
025:
026:        import jacareto.comp.Components;
027:        import jacareto.record.Recordable;
028:        import jacareto.system.Environment;
029:
030:        import java.awt.Component;
031:
032:        /**
033:         * This class stands for a generic test record element.
034:         * 
035:         * <p>
036:         * A test will be performed with the {@link #evaluate(Components)} method. If it fails, the error
037:         * message can be retrieved by calling the method {@link #getEvaluationMessage()}.
038:         * </p>
039:         * 
040:         * <p>
041:         * The values of the tested component will be corrected after the evaluation when the method {@link
042:         * #isCorrecting()} returns <code>true</code>. The test never fails when {@link #isIgnoring()}
043:         * returns <code>true</code>.
044:         * </p>
045:         *
046:         * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
047:         * @version 1.01
048:         */
049:        public abstract class Test extends Recordable {
050:            /** The name of the component. */
051:            private String componentName;
052:
053:            /** The message with the information of the last evaluation. */
054:            private String evaluationMessage;
055:
056:            /** Whether or not the test result will be ignored. */
057:            private boolean isIgnoring;
058:
059:            /** Whether or not the values of the component will be corrected. */
060:            private boolean isCorrecting;
061:
062:            /** The last test result. */
063:            private boolean lastResult;
064:
065:            /** Whether or not the failure has been corrected in the last test run. */
066:            private boolean lastCorrected;
067:
068:            /** Whether or not the failure has been ignored in the last test run. */
069:            private boolean lastIgnored;
070:
071:            /**
072:             * Creates a new test record element with the specified values.
073:             *
074:             * @param env the environment
075:             * @param componentName the name of the component
076:             * @param isIgnoring if the test result should be ignored
077:             * @param isCorrecting if the values of the component should be corrected when the test has
078:             *        failed
079:             */
080:            public Test(Environment env, String componentName,
081:                    boolean isIgnoring, boolean isCorrecting) {
082:                super (env);
083:                setComponentName(componentName);
084:                setIgnoring(isIgnoring);
085:                setCorrecting(isCorrecting);
086:
087:                //setEvaluationMessage (null);
088:            }
089:
090:            /**
091:             * Creates a new test with the values of the given component and default values.
092:             *
093:             * @param env the environment.
094:             * @param components the components instance
095:             * @param component the component to test
096:             */
097:            public Test(Environment env, Components components,
098:                    Component component) {
099:                super (env);
100:
101:                if (components != null) {
102:                    setComponentName(components.getName(component));
103:                }
104:
105:                setIgnoring(false);
106:                setCorrecting(false);
107:            }
108:
109:            /**
110:             * Creates a new test with default values and no environment. The environment should be defined
111:             * with the method {@link jacareto.system.EnvironmentMember#setEnvironment(Environment)}
112:             * before environment instances will be accessed.
113:             */
114:            public Test() {
115:                this (null, null, null);
116:            }
117:
118:            /**
119:             * Returns the component name.
120:             *
121:             * @return DOCUMENT ME!
122:             */
123:            public String getComponentName() {
124:                return componentName;
125:            }
126:
127:            /**
128:             * Sets the component's name.
129:             *
130:             * @param componentName the name of the component.
131:             */
132:            public void setComponentName(String componentName) {
133:                this .componentName = componentName;
134:            }
135:
136:            /**
137:             * Specifies whether or not the test result should be ignored or not. If it should be ignored,
138:             * the method {@link #evaluate(Components)} will always return <code>true</code>
139:             *
140:             * @param isIgnoring whether or not this test ignores the test result
141:             */
142:            public void setIgnoring(boolean isIgnoring) {
143:                this .isIgnoring = isIgnoring;
144:            }
145:
146:            /**
147:             * Returns whether or not the test result will be ignored.
148:             *
149:             * @return DOCUMENT ME!
150:             */
151:            public boolean isIgnoring() {
152:                return isIgnoring;
153:            }
154:
155:            /**
156:             * Specifies whether or not the values of the component should be corrected when the test has
157:             * failed.
158:             *
159:             * @param isCorrecting whether or not the values will be corrected
160:             */
161:            public void setCorrecting(boolean isCorrecting) {
162:                this .isCorrecting = isCorrecting;
163:            }
164:
165:            /**
166:             * Returns whether or not the test result will be corrected.
167:             *
168:             * @return DOCUMENT ME!
169:             */
170:            public boolean isCorrecting() {
171:                return isCorrecting;
172:            }
173:
174:            /**
175:             * Evaluates the test. Should return <code>false</code> if the test fails, otherwise
176:             * <code>true</code>. If the test has failed, the error message can be retrieved. by calling
177:             * the method {@link #getEvaluationMessage()}. If {@link #isCorrecting()} returns
178:             * <code>true</code>, after the test the fields (or whatever) of the component will be set to
179:             * the right values in case of a failure. If {@link #isIgnoring()} returns <code>true</code>,
180:             * the behavior of this method is exactly the same as in the opposite case, except it always
181:             * returns <code>true</code>.
182:             *
183:             * @param components the components instance
184:             *
185:             * @return <code>true</code> if all is ok, otherwise <code>false</code>
186:             */
187:            public abstract boolean evaluate(Components components);
188:
189:            /**
190:             * Returns the evaluation message.
191:             *
192:             * @return the message, or <code>null</code> if the method {@link #evaluate(Components)} has
193:             *         never been called.
194:             */
195:            public String getEvaluationMessage() {
196:                return evaluationMessage;
197:            }
198:
199:            /**
200:             * Defines the evaluation message.
201:             *
202:             * @param evaluationMessage the evaluaton message
203:             */
204:            protected void setEvaluationMessage(String evaluationMessage) {
205:                this .evaluationMessage = evaluationMessage;
206:            }
207:
208:            /**
209:             * Returns <code>true</code>, because usually a test is an atomic record element.
210:             *
211:             * @return <code>true</code>
212:             */
213:            public boolean isAtomic() {
214:                return true;
215:            }
216:
217:            /**
218:             * Returns the result of the last test run.
219:             *
220:             * @return DOCUMENT ME!
221:             */
222:            public boolean getLastResult() {
223:                return lastResult;
224:            }
225:
226:            /**
227:             * Returns whether or not the failure of the last run has been corrected.
228:             *
229:             * @return DOCUMENT ME!
230:             */
231:            public boolean getLastCorrected() {
232:                return lastCorrected;
233:            }
234:
235:            /**
236:             * Returns whether or not the failure of the last run has been ignored.
237:             *
238:             * @return DOCUMENT ME!
239:             */
240:            public boolean getLastIgnored() {
241:                return lastIgnored;
242:            }
243:
244:            /**
245:             * Sets the result of the last test run.
246:             *
247:             * @param lastResult DOCUMENT ME!
248:             */
249:            protected void setLastResult(boolean lastResult) {
250:                this .lastResult = lastResult;
251:            }
252:
253:            /**
254:             * Sets whether or not the failure of the last run has been corrected.
255:             *
256:             * @param lastCorrected DOCUMENT ME!
257:             */
258:            protected void setLastCorrected(boolean lastCorrected) {
259:                this .lastCorrected = lastCorrected;
260:            }
261:
262:            /**
263:             * Sets whether or not the failure of the last run has been ignored.
264:             *
265:             * @param lastIgnored DOCUMENT ME!
266:             */
267:            protected void setLastIgnored(boolean lastIgnored) {
268:                this.lastIgnored = lastIgnored;
269:            }
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.