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