Examples of SampleSaveConfiguration


Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

    SampleResult result = e.getResult();

    if (!isErrorLogging() || !result.isSuccessful()) {
      sendToVisualizer(result);

      SampleSaveConfiguration config = getSaveConfig();
      result.setSaveConfig(config);

      try {
        if (!config.saveAsXml()) {
          if (out != null) {
            String savee = OldSaveService.resultToDelimitedString(result);
            out.println(savee);
          }
        }
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

   */
  public SampleSaveConfiguration getSaveConfig() {
    try {
      return (SampleSaveConfiguration) getProperty(SAVE_CONFIG).getObjectValue();
    } catch (ClassCastException e) {
      setSaveConfig(new SampleSaveConfiguration());
      return getSaveConfig();
    }
  }
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

   *            the separation string
   * @return the separated value representation of the result
   */
  public static String resultToDelimitedString(SampleResult sample, String delimiter) {
    StringBuffer text = new StringBuffer();
    SampleSaveConfiguration saveConfig = sample.getSaveConfig();

    if (saveConfig.saveTimestamp()) {
      text.append(sample.getTimeStamp());
      text.append(delimiter);
    } else if (saveConfig.formatter() != null) {
      String stamp = saveConfig.formatter().format(new Date(sample.getTimeStamp()));
      text.append(stamp);
      text.append(delimiter);
    }

    if (saveConfig.saveTime()) {
      text.append(sample.getTime());
      text.append(delimiter);
    }

    if (saveConfig.saveLabel()) {
      text.append(sample.getSampleLabel());
      text.append(delimiter);
    }

    if (saveConfig.saveCode()) {
      text.append(sample.getResponseCode());
      text.append(delimiter);
    }

    if (saveConfig.saveMessage()) {
      text.append(sample.getResponseMessage());
      text.append(delimiter);
    }

    if (saveConfig.saveThreadName()) {
      text.append(sample.getThreadName());
      text.append(delimiter);
    }

    if (saveConfig.saveDataType()) {
      text.append(sample.getDataType());
      text.append(delimiter);
    }

    if (saveConfig.saveSuccess()) {
      text.append(sample.isSuccessful());
      text.append(delimiter);
    }

    if (saveConfig.saveAssertionResultsFailureMessage()) {
      String message = null;
      AssertionResult[] results = sample.getAssertionResults();

      if ((results != null) && (results.length > 0)) {
        message = results[0].getFailureMessage();
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

            String line = dataReader.readLine();
            if (line == null) {
                throw new IOException(filename + ": unable to read header line");
            }
            long lineNumber = 1;
            SampleSaveConfiguration saveConfig = CSVSaveService
                    .getSampleSaveConfiguration(line, filename);
            if (saveConfig == null) {// not a valid header
                log.info(filename
                        + " does not appear to have a valid header. Using default configuration.");
                saveConfig = (SampleSaveConfiguration) resultCollector
                        .getSaveConfig().clone(); // may change the format later
                dataReader.reset(); // restart from beginning
                lineNumber = 0;
            }
            String[] parts;
            final char delim = saveConfig.getDelimiter().charAt(0);
            // TODO: does it matter that an empty line will terminate the loop?
            // CSV output files should never contain empty lines, so probably
            // not
            // If so, then need to check whether the reader is at EOF
            while ((parts = csvReadFile(dataReader, delim)).length != 0) {
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

        if (parts == null) {
            return null; // failed to recognise the header
        }

        // We know the column names all exist, so create the config
        SampleSaveConfiguration saveConfig = new SampleSaveConfiguration(false);

        int varCount = 0;
        for (int i = 0; i < parts.length; i++) {
            String label = parts[i];
            if (isVariableName(label)) {
                varCount++;
            } else {
                Functor set = (Functor) headerLabelMethods.get(label);
                set.invoke(saveConfig, new Boolean[] { Boolean.TRUE });
            }
        }

        if (delim != null) {
            log.warn("Default delimiter '" + _saveConfig.getDelimiter()
                    + "' did not work; using alternate '" + delim
                    + "' for reading " + filename);
            saveConfig.setDelimiter(delim);
        }

        saveConfig.setVarCount(varCount);

        return saveConfig;
    }
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

    public static String resultToDelimitedString(SampleEvent event,
            final String delimiter) {
        StringQuoter text = new StringQuoter(delimiter.charAt(0));

        SampleResult sample = event.getResult();
        SampleSaveConfiguration saveConfig = sample.getSaveConfig();

        if (saveConfig.saveTimestamp()) {
            if (saveConfig.printMilliseconds()) {
                text.append(sample.getTimeStamp());
            } else if (saveConfig.formatter() != null) {
                String stamp = saveConfig.formatter().format(
                        new Date(sample.getTimeStamp()));
                text.append(stamp);
            }
        }

        if (saveConfig.saveTime()) {
            text.append(sample.getTime());
        }

        if (saveConfig.saveLabel()) {
            text.append(sample.getSampleLabel());
        }

        if (saveConfig.saveCode()) {
            text.append(sample.getResponseCode());
        }

        if (saveConfig.saveMessage()) {
            text.append(sample.getResponseMessage());
        }

        if (saveConfig.saveThreadName()) {
            text.append(sample.getThreadName());
        }

        if (saveConfig.saveDataType()) {
            text.append(sample.getDataType());
        }

        if (saveConfig.saveSuccess()) {
            text.append(sample.isSuccessful());
        }

        if (saveConfig.saveAssertionResultsFailureMessage()) {
            String message = null;
            AssertionResult[] results = sample.getAssertionResults();

            if (results != null) {
                // Find the first non-null message
                for (int i = 0; i < results.length; i++) {
                    message = results[i].getFailureMessage();
                    if (message != null) {
                        break;
                    }
                }
            }

            if (message != null) {
                text.append(message);
            } else {
                text.append(""); // Need to append something so delimiter is
                                 // added
            }
        }

        if (saveConfig.saveBytes()) {
            text.append(sample.getBytes());
        }

        if (saveConfig.saveThreadCounts()) {
            text.append(sample.getGroupThreads());
            text.append(sample.getAllThreads());
        }
        if (saveConfig.saveUrl()) {
            text.append(sample.getURL());
        }

        if (saveConfig.saveFileName()) {
            text.append(sample.getResultFileName());
        }

        if (saveConfig.saveLatency()) {
            text.append(sample.getLatency());
        }

        if (saveConfig.saveEncoding()) {
            text.append(sample.getDataEncodingWithDefault());
        }

        if (saveConfig.saveSampleCount()) {
            // Need both sample and error count to be any use
            text.append(sample.getSampleCount());
            text.append(sample.getErrorCount());
        }

        if (saveConfig.saveHostname()) {
            text.append(event.getHostname());
        }

        if (saveConfig.saveIdleTime()) {
            text.append(event.getResult().getIdleTime());
        }

        for (int i = 0; i < SampleEvent.getVarCount(); i++) {
            text.append(event.getVarValue(i));
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

    }

    public ResultCollector(Summariser summer) {
        setErrorLogging(false);
        setSuccessOnlyLogging(false);
        setProperty(new ObjectProperty(SAVE_CONFIG, new SampleSaveConfiguration()));
        summariser = summer;
    }
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

        SampleResult result = event.getResult();

        if (isSampleWanted(result.isSuccessful())) {
            sendToVisualizer(result);
            if (out != null && !isResultMarked(result) && !this.isStats) {
                SampleSaveConfiguration config = getSaveConfig();
                result.setSaveConfig(config);
                try {
                    if (config.saveAsXml()) {
                        SaveService.saveSampleResult(event, out);
                    } else { // !saveAsXml
                        String savee = CSVSaveService.resultToDelimitedString(event);
                        out.println(savee);
                    }
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

     */
    public SampleSaveConfiguration getSaveConfig() {
        try {
            return (SampleSaveConfiguration) getProperty(SAVE_CONFIG).getObjectValue();
        } catch (ClassCastException e) {
            setSaveConfig(new SampleSaveConfiguration());
            return getSaveConfig();
        }
    }
View Full Code Here

Examples of org.apache.jmeter.samplers.SampleSaveConfiguration

            String line = dataReader.readLine();
            if (line == null){
                throw new IOException(filename+": unable to read header line");
            }
            long lineNumber=1;
            SampleSaveConfiguration saveConfig = CSVSaveService.getSampleSaveConfiguration(line,filename);
            if (saveConfig == null) {// not a valid header
                log.info(filename+" does not appear to have a valid header. Using default configuration.");
                saveConfig = (SampleSaveConfiguration) resultCollector.getSaveConfig().clone(); // may change the format later
                dataReader.reset(); // restart from beginning
                lineNumber = 0;
            }
            String [] parts;
            final char delim = saveConfig.getDelimiter().charAt(0);
            // TODO: does it matter that an empty line will terminate the loop?
            // CSV output files should never contain empty lines, so probably not
            // If so, then need to check whether the reader is at EOF
            while ((parts = csvReadFile(dataReader, delim)).length != 0) {
                lineNumber++;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.