Source Code Cross Referenced for SampleSaveConfiguration.java in  » Testing » jakarta-jmeter » org » apache » jmeter » samplers » 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 » jakarta jmeter » org.apache.jmeter.samplers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         * http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
013:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014:         * License for the specific language governing permissions and limitations
015:         * under the License.
016:         *  
017:         */
018:
019:        /*
020:         * Created on Sep 7, 2004
021:         */
022:        package org.apache.jmeter.samplers;
023:
024:        import java.io.ObjectStreamException;
025:        import java.io.Serializable;
026:        import java.text.DateFormat;
027:        import java.text.SimpleDateFormat;
028:        import java.util.Properties;
029:
030:        import org.apache.jmeter.testelement.TestPlan;
031:        import org.apache.jmeter.util.JMeterUtils;
032:
033:        /*
034:         * N.B. to add a new field, remember the following
035:         * - static _xyz
036:         * - instance xyz=_xyz
037:         * - clone s.xyz = xyz
038:         * - setXyz(boolean)
039:         * - saveXyz()
040:         * - update SampleSaveConfigurationConverter to add new fields to marshall() and shouldSerialiseMember()
041:         * - update SampleResultConverter and/or HTTPSampleConverter
042:         * - update CSV routines in OldSaveService
043:         * - update messages.properties to add save_xyz entry
044:         * 
045:         */
046:        /**
047:         * Holds details of which sample attributes to save.
048:         * 
049:         * The pop-up dialogue for this is created by the class SavePropertyDialog, which assumes:
050:         * For each field XXX
051:         * - methods have the signature "boolean saveXXX()" 
052:         * - a corresponding "void setXXX(boolean)" method
053:         * - messages.properties contains the key save_XXX
054:         * 
055:         * @author mstover
056:         *
057:         */
058:        public class SampleSaveConfiguration implements  Cloneable, Serializable {
059:            private static final long serialVersionUID = 6L;
060:
061:            // ---------------------------------------------------------------------
062:            // PROPERTY FILE CONSTANTS
063:            // ---------------------------------------------------------------------
064:
065:            /** Indicates that the results file should be in XML format. * */
066:            private static final String XML = "xml"; // $NON_NLS-1$
067:
068:            /** Indicates that the results file should be in CSV format. * */
069:            //NOTUSED private static final String CSV = "csv"; // $NON_NLS-1$
070:            /** Indicates that the results should be stored in a database. * */
071:            //NOTUSED private static final String DATABASE = "db"; // $NON_NLS-1$
072:            /** A properties file indicator for true. * */
073:            private static final String TRUE = "true"; // $NON_NLS-1$
074:
075:            /** A properties file indicator for false. * */
076:            private static final String FALSE = "false"; // $NON_NLS-1$
077:
078:            /** A properties file indicator for milliseconds. * */
079:            private static final String MILLISECONDS = "ms"; // $NON_NLS-1$
080:
081:            /** A properties file indicator for none. * */
082:            private static final String NONE = "none"; // $NON_NLS-1$
083:
084:            /** A properties file indicator for the first of a series. * */
085:            private static final String FIRST = "first"; // $NON_NLS-1$
086:
087:            /** A properties file indicator for all of a series. * */
088:            private static final String ALL = "all"; // $NON_NLS-1$
089:
090:            /***************************************************************************
091:             * The name of the property indicating which assertion results should be
092:             * saved.
093:             **************************************************************************/
094:            private static final String ASSERTION_RESULTS_FAILURE_MESSAGE_PROP = "jmeter.save.saveservice.assertion_results_failure_message"; // $NON_NLS-1$
095:
096:            /***************************************************************************
097:             * The name of the property indicating which assertion results should be
098:             * saved.
099:             **************************************************************************/
100:            private static final String ASSERTION_RESULTS_PROP = "jmeter.save.saveservice.assertion_results"; // $NON_NLS-1$
101:
102:            /***************************************************************************
103:             * The name of the property indicating which delimiter should be used when
104:             * saving in a delimited values format.
105:             **************************************************************************/
106:            private static final String DEFAULT_DELIMITER_PROP = "jmeter.save.saveservice.default_delimiter"; // $NON_NLS-1$
107:
108:            /***************************************************************************
109:             * The name of the property indicating which format should be used when
110:             * saving the results, e.g., xml or csv.
111:             **************************************************************************/
112:            private static final String OUTPUT_FORMAT_PROP = "jmeter.save.saveservice.output_format"; // $NON_NLS-1$
113:
114:            /***************************************************************************
115:             * The name of the property indicating whether field names should be printed
116:             * to a delimited file.
117:             **************************************************************************/
118:            private static final String PRINT_FIELD_NAMES_PROP = "jmeter.save.saveservice.print_field_names"; // $NON_NLS-1$
119:
120:            /***************************************************************************
121:             * The name of the property indicating whether the data type should be
122:             * saved.
123:             **************************************************************************/
124:            private static final String SAVE_DATA_TYPE_PROP = "jmeter.save.saveservice.data_type"; // $NON_NLS-1$
125:
126:            /***************************************************************************
127:             * The name of the property indicating whether the label should be saved.
128:             **************************************************************************/
129:            private static final String SAVE_LABEL_PROP = "jmeter.save.saveservice.label"; // $NON_NLS-1$
130:
131:            /***************************************************************************
132:             * The name of the property indicating whether the response code should be
133:             * saved.
134:             **************************************************************************/
135:            private static final String SAVE_RESPONSE_CODE_PROP = "jmeter.save.saveservice.response_code"; // $NON_NLS-1$
136:
137:            /***************************************************************************
138:             * The name of the property indicating whether the response data should be
139:             * saved.
140:             **************************************************************************/
141:            private static final String SAVE_RESPONSE_DATA_PROP = "jmeter.save.saveservice.response_data"; // $NON_NLS-1$
142:
143:            private static final String SAVE_RESPONSE_DATA_ON_ERROR_PROP = "jmeter.save.saveservice.response_data.on_error"; // $NON_NLS-1$
144:
145:            /***************************************************************************
146:             * The name of the property indicating whether the response message should
147:             * be saved.
148:             **************************************************************************/
149:            private static final String SAVE_RESPONSE_MESSAGE_PROP = "jmeter.save.saveservice.response_message"; // $NON_NLS-1$
150:
151:            /***************************************************************************
152:             * The name of the property indicating whether the success indicator should
153:             * be saved.
154:             **************************************************************************/
155:            private static final String SAVE_SUCCESSFUL_PROP = "jmeter.save.saveservice.successful"; // $NON_NLS-1$
156:
157:            /***************************************************************************
158:             * The name of the property indicating whether the thread name should be
159:             * saved.
160:             **************************************************************************/
161:            private static final String SAVE_THREAD_NAME_PROP = "jmeter.save.saveservice.thread_name"; // $NON_NLS-1$
162:
163:            // Save bytes read
164:            private static final String SAVE_BYTES_PROP = "jmeter.save.saveservice.bytes"; // $NON_NLS-1$
165:
166:            // Save URL
167:            private static final String SAVE_URL_PROP = "jmeter.save.saveservice.url"; // $NON_NLS-1$
168:
169:            // Save fileName for ResultSaver
170:            private static final String SAVE_FILENAME_PROP = "jmeter.save.saveservice.filename"; // $NON_NLS-1$
171:
172:            // Save hostname for ResultSaver
173:            private static final String SAVE_HOSTNAME_PROP = "jmeter.save.saveservice.hostname"; // $NON_NLS-1$
174:
175:            /***************************************************************************
176:             * The name of the property indicating whether the time should be saved.
177:             **************************************************************************/
178:            private static final String SAVE_TIME_PROP = "jmeter.save.saveservice.time"; // $NON_NLS-1$
179:
180:            /***************************************************************************
181:             * The name of the property giving the format of the time stamp
182:             **************************************************************************/
183:            private static final String TIME_STAMP_FORMAT_PROP = "jmeter.save.saveservice.timestamp_format"; // $NON_NLS-1$
184:
185:            private static final String SUBRESULTS_PROP = "jmeter.save.saveservice.subresults"; // $NON_NLS-1$
186:            private static final String ASSERTIONS_PROP = "jmeter.save.saveservice.assertions"; // $NON_NLS-1$
187:            private static final String LATENCY_PROP = "jmeter.save.saveservice.latency"; // $NON_NLS-1$
188:            private static final String SAMPLERDATA_PROP = "jmeter.save.saveservice.samplerData"; // $NON_NLS-1$
189:            private static final String RESPONSEHEADERS_PROP = "jmeter.save.saveservice.responseHeaders"; // $NON_NLS-1$
190:            private static final String REQUESTHEADERS_PROP = "jmeter.save.saveservice.requestHeaders"; // $NON_NLS-1$
191:            private static final String ENCODING_PROP = "jmeter.save.saveservice.encoding"; // $NON_NLS-1$
192:
193:            // optional processing instruction for line 2; e.g.
194:            // <?xml-stylesheet type="text/xsl" href="../extras/jmeter-results-detail-report_21.xsl"?>
195:            private static final String XML_PI = "jmeter.save.saveservice.xml_pi"; // $NON_NLS-1$
196:
197:            private static final String SAVE_THREAD_COUNTS = "jmeter.save.saveservice.thread_counts"; // $NON_NLS-1$
198:
199:            private static final String SAVE_SAMPLE_COUNT = "jmeter.save.saveservice.sample_count"; // $NON_NLS-1$
200:
201:            // N.B. Remember to update the equals and hashCode methods when adding new variables.
202:
203:            // Initialise values from properties
204:            private boolean time = _time, latency = _latency,
205:                    timestamp = _timestamp, success = _success, label = _label,
206:                    code = _code, message = _message, threadName = _threadName,
207:                    dataType = _dataType, encoding = _encoding,
208:                    assertions = _assertions, subresults = _subresults,
209:                    responseData = _responseData, samplerData = _samplerData,
210:                    xml = _xml, fieldNames = _fieldNames,
211:                    responseHeaders = _responseHeaders,
212:                    requestHeaders = _requestHeaders,
213:                    responseDataOnError = _responseDataOnError;
214:
215:            private boolean saveAssertionResultsFailureMessage = _saveAssertionResultsFailureMessage;
216:
217:            private boolean url = _url, bytes = _bytes, fileName = _fileName;
218:
219:            private boolean hostname = _hostname;
220:
221:            private boolean threadCounts = _threadCounts;
222:
223:            private boolean sampleCount = _sampleCount;
224:
225:            // Does not appear to be used (yet)
226:            private int assertionsResultsToSave = _assertionsResultsToSave;
227:
228:            // Don't save this, as it is derived from the time format
229:            private boolean printMilliseconds = _printMilliseconds;
230:
231:            /** A formatter for the time stamp. */
232:            private transient DateFormat formatter = _formatter;
233:            /* Make transient as we don't want to save the SimpleDataFormat class
234:             * Also, there's currently no way to change the value via the GUI, so changing it
235:             * later means editting the JMX, or recreating the Listener.
236:             */
237:
238:            // Defaults from properties:
239:            private static final boolean _time, _timestamp, _success, _label,
240:                    _code, _message, _threadName, _xml, _responseData,
241:                    _dataType, _encoding, _assertions, _latency, _subresults,
242:                    _samplerData, _fieldNames, _responseHeaders,
243:                    _requestHeaders;
244:
245:            private static final boolean _responseDataOnError;
246:
247:            private static final boolean _saveAssertionResultsFailureMessage;
248:
249:            private static final String _timeStampFormat;
250:
251:            private static int _assertionsResultsToSave;
252:
253:            // TODO turn into method?
254:            public static final int SAVE_NO_ASSERTIONS = 0;
255:
256:            public static final int SAVE_FIRST_ASSERTION = SAVE_NO_ASSERTIONS + 1;
257:
258:            public static final int SAVE_ALL_ASSERTIONS = SAVE_FIRST_ASSERTION + 1;
259:
260:            private static final boolean _printMilliseconds;
261:
262:            private static final boolean _bytes;
263:
264:            private static final boolean _url;
265:
266:            private static final boolean _fileName;
267:
268:            private static final boolean _hostname;
269:
270:            private static final boolean _threadCounts;
271:
272:            private static final boolean _sampleCount;
273:
274:            private static final DateFormat _formatter;
275:
276:            /**
277:             * The string used to separate fields when stored to disk, for example, the
278:             * comma for CSV files.
279:             */
280:            private static final String _delimiter;
281:
282:            private static final String DEFAULT_DELIMITER = ","; // $NON_NLS-1$
283:
284:            /**
285:             * Read in the properties having to do with saving from a properties file.
286:             */
287:            static {
288:                Properties props = JMeterUtils.getJMeterProperties();
289:
290:                _subresults = TRUE.equalsIgnoreCase(props.getProperty(
291:                        SUBRESULTS_PROP, TRUE));
292:                _assertions = TRUE.equalsIgnoreCase(props.getProperty(
293:                        ASSERTIONS_PROP, TRUE));
294:                _latency = TRUE.equalsIgnoreCase(props.getProperty(
295:                        LATENCY_PROP, TRUE));
296:                _samplerData = TRUE.equalsIgnoreCase(props.getProperty(
297:                        SAMPLERDATA_PROP, FALSE));
298:                _responseHeaders = TRUE.equalsIgnoreCase(props.getProperty(
299:                        RESPONSEHEADERS_PROP, FALSE));
300:                _requestHeaders = TRUE.equalsIgnoreCase(props.getProperty(
301:                        REQUESTHEADERS_PROP, FALSE));
302:                _encoding = TRUE.equalsIgnoreCase(props.getProperty(
303:                        ENCODING_PROP, FALSE));
304:
305:                String dlm = props.getProperty(DEFAULT_DELIMITER_PROP,
306:                        DEFAULT_DELIMITER);
307:                if (dlm.equals("\\t")) {// Make it easier to enter a tab (can use \<tab> but that is awkward)
308:                    dlm = "\t";
309:                }
310:                _delimiter = dlm;
311:
312:                _fieldNames = TRUE.equalsIgnoreCase(props.getProperty(
313:                        PRINT_FIELD_NAMES_PROP, FALSE));
314:
315:                _dataType = TRUE.equalsIgnoreCase(props.getProperty(
316:                        SAVE_DATA_TYPE_PROP, TRUE));
317:
318:                _label = TRUE.equalsIgnoreCase(props.getProperty(
319:                        SAVE_LABEL_PROP, TRUE));
320:
321:                _code = TRUE.equalsIgnoreCase(props.getProperty(
322:                        SAVE_RESPONSE_CODE_PROP, TRUE));
323:
324:                _responseData = TRUE.equalsIgnoreCase(props.getProperty(
325:                        SAVE_RESPONSE_DATA_PROP, FALSE));
326:
327:                _responseDataOnError = TRUE.equalsIgnoreCase(props.getProperty(
328:                        SAVE_RESPONSE_DATA_ON_ERROR_PROP, FALSE));
329:
330:                _message = TRUE.equalsIgnoreCase(props.getProperty(
331:                        SAVE_RESPONSE_MESSAGE_PROP, TRUE));
332:
333:                _success = TRUE.equalsIgnoreCase(props.getProperty(
334:                        SAVE_SUCCESSFUL_PROP, TRUE));
335:
336:                _threadName = TRUE.equalsIgnoreCase(props.getProperty(
337:                        SAVE_THREAD_NAME_PROP, TRUE));
338:
339:                _bytes = TRUE.equalsIgnoreCase(props.getProperty(
340:                        SAVE_BYTES_PROP, TRUE));
341:
342:                _url = TRUE.equalsIgnoreCase(props.getProperty(SAVE_URL_PROP,
343:                        FALSE));
344:
345:                _fileName = TRUE.equalsIgnoreCase(props.getProperty(
346:                        SAVE_FILENAME_PROP, FALSE));
347:
348:                _hostname = TRUE.equalsIgnoreCase(props.getProperty(
349:                        SAVE_HOSTNAME_PROP, FALSE));
350:
351:                _time = TRUE.equalsIgnoreCase(props.getProperty(SAVE_TIME_PROP,
352:                        TRUE));
353:
354:                _timeStampFormat = props.getProperty(TIME_STAMP_FORMAT_PROP,
355:                        MILLISECONDS);
356:
357:                _printMilliseconds = MILLISECONDS
358:                        .equalsIgnoreCase(_timeStampFormat);
359:
360:                // Prepare for a pretty date
361:                if (!_printMilliseconds
362:                        && !NONE.equalsIgnoreCase(_timeStampFormat)
363:                        && (_timeStampFormat != null)) {
364:                    _formatter = new SimpleDateFormat(_timeStampFormat);
365:                } else {
366:                    _formatter = null;
367:                }
368:
369:                _timestamp = !NONE.equalsIgnoreCase(_timeStampFormat);// reversed compare allows for null
370:
371:                _saveAssertionResultsFailureMessage = TRUE
372:                        .equalsIgnoreCase(props.getProperty(
373:                                ASSERTION_RESULTS_FAILURE_MESSAGE_PROP, FALSE));
374:
375:                String whichAssertionResults = props.getProperty(
376:                        ASSERTION_RESULTS_PROP, NONE);
377:                if (NONE.equals(whichAssertionResults)) {
378:                    _assertionsResultsToSave = SAVE_NO_ASSERTIONS;
379:                } else if (FIRST.equals(whichAssertionResults)) {
380:                    _assertionsResultsToSave = SAVE_FIRST_ASSERTION;
381:                } else if (ALL.equals(whichAssertionResults)) {
382:                    _assertionsResultsToSave = SAVE_ALL_ASSERTIONS;
383:                }
384:
385:                String howToSave = props.getProperty(OUTPUT_FORMAT_PROP, XML);
386:
387:                if (XML.equals(howToSave)) {
388:                    _xml = true;
389:                } else {
390:                    _xml = false;
391:                }
392:
393:                _threadCounts = TRUE.equalsIgnoreCase(props.getProperty(
394:                        SAVE_THREAD_COUNTS, FALSE));
395:
396:                _sampleCount = TRUE.equalsIgnoreCase(props.getProperty(
397:                        SAVE_SAMPLE_COUNT, FALSE));
398:            }
399:
400:            // Don't save this, as not settable via GUI
401:            private String delimiter = _delimiter;
402:            private static final SampleSaveConfiguration _static = new SampleSaveConfiguration();
403:
404:            // Give access to initial configuration
405:            public static SampleSaveConfiguration staticConfig() {
406:                return _static;
407:            }
408:
409:            public SampleSaveConfiguration() {
410:            }
411:
412:            /**
413:             * Alternate constructor for use by OldSaveService
414:             * 
415:             * @param value initial setting for boolean fields used in Config dialogue
416:             */
417:            public SampleSaveConfiguration(boolean value) {
418:                assertions = value;
419:                bytes = value;
420:                code = value;
421:                dataType = value;
422:                encoding = value;
423:                fieldNames = value;
424:                fileName = value;
425:                hostname = value;
426:                label = value;
427:                latency = value;
428:                message = value;
429:                printMilliseconds = _printMilliseconds;//is derived from properties only
430:                requestHeaders = value;
431:                responseData = value;
432:                responseDataOnError = value;
433:                responseHeaders = value;
434:                samplerData = value;
435:                saveAssertionResultsFailureMessage = value;
436:                subresults = value;
437:                success = value;
438:                threadCounts = value;
439:                sampleCount = value;
440:                threadName = value;
441:                time = value;
442:                timestamp = value;
443:                url = value;
444:                xml = value;
445:            }
446:
447:            private Object readResolve() throws ObjectStreamException {
448:                formatter = _formatter;
449:                return this ;
450:            }
451:
452:            public Object clone() {
453:                try {
454:                    SampleSaveConfiguration clone = (SampleSaveConfiguration) super 
455:                            .clone();
456:                    if (this .formatter != null) {
457:                        clone.formatter = (SimpleDateFormat) this .formatter
458:                                .clone();
459:                    }
460:                    return clone;
461:                } catch (CloneNotSupportedException e) {
462:                    // this should not happen
463:                    return null;
464:                }
465:            }
466:
467:            public boolean equals(Object obj) {
468:                if (this  == obj) {
469:                    return true;
470:                }
471:                if ((obj == null) || (obj.getClass() != this .getClass())) {
472:                    return false;
473:                }
474:                // We know we are comparing to another SampleSaveConfiguration
475:                SampleSaveConfiguration s = (SampleSaveConfiguration) obj;
476:                boolean primitiveValues = s.time == time
477:                        && s.latency == latency
478:                        && s.timestamp == timestamp
479:                        && s.success == success
480:                        && s.label == label
481:                        && s.code == code
482:                        && s.message == message
483:                        && s.threadName == threadName
484:                        && s.dataType == dataType
485:                        && s.encoding == encoding
486:                        && s.assertions == assertions
487:                        && s.subresults == subresults
488:                        && s.responseData == responseData
489:                        && s.samplerData == samplerData
490:                        && s.xml == xml
491:                        && s.fieldNames == fieldNames
492:                        && s.responseHeaders == responseHeaders
493:                        && s.requestHeaders == requestHeaders
494:                        && s.assertionsResultsToSave == assertionsResultsToSave
495:                        && s.saveAssertionResultsFailureMessage == saveAssertionResultsFailureMessage
496:                        && s.printMilliseconds == printMilliseconds
497:                        && s.responseDataOnError == responseDataOnError
498:                        && s.url == url && s.bytes == bytes
499:                        && s.fileName == fileName && s.hostname == hostname
500:                        && s.sampleCount == sampleCount
501:                        && s.threadCounts == threadCounts;
502:
503:                boolean stringValues = false;
504:                if (primitiveValues) {
505:                    stringValues = s.delimiter == delimiter
506:                            || (delimiter != null && delimiter
507:                                    .equals(s.delimiter));
508:                }
509:                boolean complexValues = false;
510:                if (primitiveValues && stringValues) {
511:                    complexValues = s.formatter == formatter
512:                            || (formatter != null && formatter
513:                                    .equals(s.formatter));
514:                }
515:
516:                return primitiveValues && stringValues && complexValues;
517:            }
518:
519:            public int hashCode() {
520:                int hash = 7;
521:                hash = 31 * hash + (time ? 1 : 0);
522:                hash = 31 * hash + (latency ? 1 : 0);
523:                hash = 31 * hash + (timestamp ? 1 : 0);
524:                hash = 31 * hash + (success ? 1 : 0);
525:                hash = 31 * hash + (label ? 1 : 0);
526:                hash = 31 * hash + (code ? 1 : 0);
527:                hash = 31 * hash + (message ? 1 : 0);
528:                hash = 31 * hash + (threadName ? 1 : 0);
529:                hash = 31 * hash + (dataType ? 1 : 0);
530:                hash = 31 * hash + (encoding ? 1 : 0);
531:                hash = 31 * hash + (assertions ? 1 : 0);
532:                hash = 31 * hash + (subresults ? 1 : 0);
533:                hash = 31 * hash + (responseData ? 1 : 0);
534:                hash = 31 * hash + (samplerData ? 1 : 0);
535:                hash = 31 * hash + (xml ? 1 : 0);
536:                hash = 31 * hash + (fieldNames ? 1 : 0);
537:                hash = 31 * hash + (responseHeaders ? 1 : 0);
538:                hash = 31 * hash + (requestHeaders ? 1 : 0);
539:                hash = 31 * hash + assertionsResultsToSave;
540:                hash = 31 * hash + (saveAssertionResultsFailureMessage ? 1 : 0);
541:                hash = 31 * hash + (printMilliseconds ? 1 : 0);
542:                hash = 31 * hash + (responseDataOnError ? 1 : 0);
543:                hash = 31 * hash + (url ? 1 : 0);
544:                hash = 31 * hash + (bytes ? 1 : 0);
545:                hash = 31 * hash + (fileName ? 1 : 0);
546:                hash = 31 * hash + (hostname ? 1 : 0);
547:                hash = 31 * hash + (threadCounts ? 1 : 0);
548:                hash = 31 * hash
549:                        + (delimiter != null ? delimiter.hashCode() : 0);
550:                hash = 31 * hash
551:                        + (formatter != null ? formatter.hashCode() : 0);
552:                hash = 31 * hash + (sampleCount ? 1 : 0);
553:
554:                return hash;
555:            }
556:
557:            ///////////////////// Start of standard save/set access methods /////////////////////
558:
559:            public boolean saveResponseHeaders() {
560:                return responseHeaders;
561:            }
562:
563:            public void setResponseHeaders(boolean r) {
564:                responseHeaders = r;
565:            }
566:
567:            public boolean saveRequestHeaders() {
568:                return requestHeaders;
569:            }
570:
571:            public void setRequestHeaders(boolean r) {
572:                requestHeaders = r;
573:            }
574:
575:            public boolean saveAssertions() {
576:                return assertions;
577:            }
578:
579:            public void setAssertions(boolean assertions) {
580:                this .assertions = assertions;
581:            }
582:
583:            public boolean saveCode() {
584:                return code;
585:            }
586:
587:            public void setCode(boolean code) {
588:                this .code = code;
589:            }
590:
591:            public boolean saveDataType() {
592:                return dataType;
593:            }
594:
595:            public void setDataType(boolean dataType) {
596:                this .dataType = dataType;
597:            }
598:
599:            public boolean saveEncoding() {
600:                return encoding;
601:            }
602:
603:            public void setEncoding(boolean encoding) {
604:                this .encoding = encoding;
605:            }
606:
607:            public boolean saveLabel() {
608:                return label;
609:            }
610:
611:            public void setLabel(boolean label) {
612:                this .label = label;
613:            }
614:
615:            public boolean saveLatency() {
616:                return latency;
617:            }
618:
619:            public void setLatency(boolean latency) {
620:                this .latency = latency;
621:            }
622:
623:            public boolean saveMessage() {
624:                return message;
625:            }
626:
627:            public void setMessage(boolean message) {
628:                this .message = message;
629:            }
630:
631:            public boolean saveResponseData(SampleResult res) {
632:                return responseData || TestPlan.getFunctionalMode()
633:                        || (responseDataOnError && !res.isSuccessful());
634:            }
635:
636:            public boolean saveResponseData() {
637:                return responseData;
638:            }
639:
640:            public void setResponseData(boolean responseData) {
641:                this .responseData = responseData;
642:            }
643:
644:            public boolean saveSamplerData(SampleResult res) {
645:                return samplerData || TestPlan.getFunctionalMode() // as per 2.0 branch
646:                        || (responseDataOnError && !res.isSuccessful());
647:            }
648:
649:            public boolean saveSamplerData() {
650:                return samplerData;
651:            }
652:
653:            public void setSamplerData(boolean samplerData) {
654:                this .samplerData = samplerData;
655:            }
656:
657:            public boolean saveSubresults() {
658:                return subresults;
659:            }
660:
661:            public void setSubresults(boolean subresults) {
662:                this .subresults = subresults;
663:            }
664:
665:            public boolean saveSuccess() {
666:                return success;
667:            }
668:
669:            public void setSuccess(boolean success) {
670:                this .success = success;
671:            }
672:
673:            public boolean saveThreadName() {
674:                return threadName;
675:            }
676:
677:            public void setThreadName(boolean threadName) {
678:                this .threadName = threadName;
679:            }
680:
681:            public boolean saveTime() {
682:                return time;
683:            }
684:
685:            public void setTime(boolean time) {
686:                this .time = time;
687:            }
688:
689:            public boolean saveTimestamp() {
690:                return timestamp;
691:            }
692:
693:            public void setTimestamp(boolean timestamp) {
694:                this .timestamp = timestamp;
695:            }
696:
697:            public boolean saveAsXml() {
698:                return xml;
699:            }
700:
701:            public void setAsXml(boolean xml) {
702:                this .xml = xml;
703:            }
704:
705:            public boolean saveFieldNames() {
706:                return fieldNames;
707:            }
708:
709:            public void setFieldNames(boolean printFieldNames) {
710:                this .fieldNames = printFieldNames;
711:            }
712:
713:            public boolean saveUrl() {
714:                return url;
715:            }
716:
717:            public void setUrl(boolean save) {
718:                this .url = save;
719:            }
720:
721:            public boolean saveBytes() {
722:                return bytes;
723:            }
724:
725:            public void setBytes(boolean save) {
726:                this .bytes = save;
727:            }
728:
729:            public boolean saveFileName() {
730:                return fileName;
731:            }
732:
733:            public void setFileName(boolean save) {
734:                this .fileName = save;
735:            }
736:
737:            public boolean saveAssertionResultsFailureMessage() {
738:                return saveAssertionResultsFailureMessage;
739:            }
740:
741:            public void setAssertionResultsFailureMessage(boolean b) {
742:                saveAssertionResultsFailureMessage = b;
743:            }
744:
745:            public boolean saveThreadCounts() {
746:                return threadCounts;
747:            }
748:
749:            public void setThreadCounts(boolean save) {
750:                this .threadCounts = save;
751:            }
752:
753:            public boolean saveSampleCount() {
754:                return sampleCount;
755:            }
756:
757:            public void setSampleCount(boolean save) {
758:                this .sampleCount = save;
759:            }
760:
761:            ///////////////// End of standard field accessors /////////////////////
762:
763:            /**
764:             * Only intended for use by OldSaveService (and test cases)
765:             */
766:            public void setFormatter(DateFormat fmt) {
767:                printMilliseconds = (fmt == null); // maintain relationship
768:                formatter = fmt;
769:            }
770:
771:            public boolean printMilliseconds() {
772:                return printMilliseconds;
773:            }
774:
775:            public DateFormat formatter() {
776:                return formatter;
777:            }
778:
779:            public int assertionsResultsToSave() {
780:                return assertionsResultsToSave;
781:            }
782:
783:            public String getDelimiter() {
784:                return delimiter;
785:            }
786:
787:            public String getXmlPi() {
788:                return JMeterUtils.getJMeterProperties()
789:                        .getProperty(XML_PI, ""); // Defaults to empty;
790:            }
791:
792:            // Used by old Save service
793:            public void setDelimiter(String delim) {
794:                delimiter = delim;
795:            }
796:
797:            // Used by SampleSaveConfigurationConverter.unmarshall()
798:            public void setDefaultDelimiter() {
799:                delimiter = _delimiter;
800:            }
801:
802:            // Used by SampleSaveConfigurationConverter.unmarshall()
803:            public void setDefaultTimeStampFormat() {
804:                printMilliseconds = _printMilliseconds;
805:                formatter = _formatter;
806:            }
807:
808:            public boolean saveHostname() {
809:                return hostname;
810:            }
811:
812:            public void setHostname(boolean save) {
813:                hostname = save;
814:            }
815:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.