@Override
  public void configure(TestElement el) {
    super.configure(el);
    useGroupName.setSelected(el.getPropertyAsBoolean(USE_GROUP_NAME, false));
    saveHeaders.setSelected(el.getPropertyAsBoolean(SAVE_HEADERS, true));

    jPanelFilter.setIncludeSampleLabels(
        el.getPropertyAsString(CorrectedResultCollector.INCLUDE_SAMPLE_LABELS));
    jPanelFilter.setExcludeSampleLabels(
        el.getPropertyAsString(CorrectedResultCollector.EXCLUDE_SAMPLE_LABELS));

    if (!CorrectedResultCollector.EMPTY_FIELD.equals(
        el.getPropertyAsString(CorrectedResultCollector.START_OFFSET))) {
      jPanelFilter.setStartOffset((el.getPropertyAsLong(CorrectedResultCollector.START_OFFSET)));
    }
    if (!CorrectedResultCollector.EMPTY_FIELD.equals(
        el.getPropertyAsString(CorrectedResultCollector.END_OFFSET))) {
      jPanelFilter.setEndOffset((el.getPropertyAsLong(CorrectedResultCollector.END_OFFSET)));
    }

    jPanelFilter.setSelectedRegExpInc(
        el.getPropertyAsBoolean(CorrectedResultCollector.INCLUDE_REGEX_CHECKBOX_STATE));
    jPanelFilter.setSelectedRegExpExc(
        el.getPropertyAsBoolean(CorrectedResultCollector.EXCLUDE_REGEX_CHECKBOX_STATE));

    if (el instanceof CorrectedResultCollector) {
      setUpFiltering((CorrectedResultCollector) el);
    }
  }
Esempio n. 2
0
 private void recoverRunningVersion(List<?> list) {
   @SuppressWarnings("unchecked") // All implementations extend TestElement
   List<TestElement> telist = (List<TestElement>) list;
   for (TestElement te : telist) {
     te.recoverRunningVersion();
   }
 }
Esempio n. 3
0
 private void setRunningVersion(List<?> list, boolean running) {
   @SuppressWarnings("unchecked") // all implementations extend TestElement
   List<TestElement> telist = (List<TestElement>) list;
   for (TestElement te : telist) {
     te.setRunningVersion(running);
   }
 }
Esempio n. 4
0
 /**
  * Modifies a given TestElement to mirror the data in the gui components.
  *
  * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
  */
 public void modifyTestElement(TestElement te) {
   te.clear();
   this.configureTestElement(te);
   te.setProperty(BeanShellAssertion.SCRIPT, scriptField.getText());
   te.setProperty(BeanShellAssertion.FILENAME, filename.getText());
   te.setProperty(BeanShellAssertion.PARAMETERS, parameters.getText());
   te.setProperty(
       new BooleanProperty(BeanShellAssertion.RESET_INTERPRETER, resetInterpreter.isSelected()));
 }
Esempio n. 5
0
 @Override
 public void configure(TestElement element) {
   scriptField.setText(element.getPropertyAsString(BeanShellAssertion.SCRIPT));
   filename.setText(element.getPropertyAsString(BeanShellAssertion.FILENAME));
   parameters.setText(element.getPropertyAsString(BeanShellAssertion.PARAMETERS));
   resetInterpreter.setSelected(
       element.getPropertyAsBoolean(BeanShellAssertion.RESET_INTERPRETER));
   super.configure(element);
 }
Esempio n. 6
0
 /**
  * Tokenize the URL into two tokens. If the URL has more than one "?", the parse may fail. Only
  * the first two tokens are used. The first token is automatically parsed and set at URL_PATH.
  *
  * @param url
  * @return String parameters
  */
 public String stripFile(String url, TestElement el) {
   if (url.indexOf("?") > -1) {
     StringTokenizer tokens = this.tokenize(url, "?");
     this.URL_PATH = tokens.nextToken();
     el.setProperty(HTTPSamplerBase.PATH, URL_PATH);
     return tokens.hasMoreTokens() ? tokens.nextToken() : null;
   }
   el.setProperty(HTTPSamplerBase.PATH, url);
   return null;
 }
 public static void removeNode(ReportTreeNode node) {
   TestElement testElement = node.getTestElement();
   if (testElement.canRemove()) {
     ReportGuiPackage.getInstance().getTreeModel().removeNodeFromParent(node);
     ReportGuiPackage.getInstance().removeNode(testElement);
   } else {
     String message = testElement.getClass().getName() + " is busy";
     JOptionPane.showMessageDialog(null, message, "Cannot remove item", JOptionPane.ERROR_MESSAGE);
   }
 }
Esempio n. 8
0
  /**
   * A newly created component can be initialized with the contents of a Test Element object by
   * calling this method. The component is responsible for querying the Test Element object for the
   * relevant information to display in its GUI.
   *
   * @param el the TestElement to configure
   */
  @Override
  public void configure(TestElement el) {
    super.configure(el);

    if (el.getProperty(ReportPlan.USER_DEFINED_VARIABLES) != null) {
      argsPanel.configure(
          (Arguments) el.getProperty(ReportPlan.USER_DEFINED_VARIABLES).getObjectValue());
    }
    commentPanel.setText(el.getPropertyAsString(ReportPlan.REPORT_COMMENTS));
    baseDir.setFilename(el.getPropertyAsString(ReportPlan.BASEDIR));
  }
  @Override
  public void modifyTestElement(TestElement c) {
    super.modifyTestElement(c);
    c.setProperty(USE_GROUP_NAME, useGroupName.isSelected(), false);
    c.setProperty(SAVE_HEADERS, saveHeaders.isSelected(), true);
    c.setProperty(
        new StringProperty(
            CorrectedResultCollector.INCLUDE_SAMPLE_LABELS, jPanelFilter.getIncludeSampleLabels()));
    c.setProperty(
        new StringProperty(
            CorrectedResultCollector.EXCLUDE_SAMPLE_LABELS, jPanelFilter.getExcludeSampleLabels()));

    c.setProperty(
        new StringProperty(CorrectedResultCollector.START_OFFSET, jPanelFilter.getStartOffset()));
    c.setProperty(
        new StringProperty(CorrectedResultCollector.END_OFFSET, jPanelFilter.getEndOffset()));

    c.setProperty(
        new BooleanProperty(
            CorrectedResultCollector.INCLUDE_REGEX_CHECKBOX_STATE,
            jPanelFilter.isSelectedRegExpInc()));
    c.setProperty(
        new BooleanProperty(
            CorrectedResultCollector.EXCLUDE_REGEX_CHECKBOX_STATE,
            jPanelFilter.isSelectedRegExpExc()));
  }
Esempio n. 10
0
 /** {@inheritDoc} */
 @Override
 public void recoverRunningVersion(TestElement owner) {
   if (savedValue != null) {
     value = savedValue;
   }
   value.recoverRunningVersion();
 }
Esempio n. 11
0
 /**
  * parseLine calls the other parse methods to parse the given text.
  *
  * @param line
  */
 protected int parseLine(String line, TestElement el) {
   int count = 0;
   // we clean the line to get
   // rid of extra stuff
   String cleanedLine = this.cleanURL(line);
   log.debug("parsing line: " + line);
   // now we set request method
   el.setProperty(HTTPSamplerBase.METHOD, RMETHOD);
   if (FILTER != null) {
     log.debug("filter is not null");
     if (!FILTER.isFiltered(line, el)) {
       log.debug("line was not filtered");
       // increment the current count
       count++;
       // we filter the line first, before we try
       // to separate the URL into file and
       // parameters.
       line = FILTER.filter(cleanedLine);
       if (line != null) {
         createUrl(line, el);
       }
     } else {
       log.debug("Line was filtered");
     }
   } else {
     log.debug("filter was null");
     // increment the current count
     count++;
     // in the case when the filter is not set, we
     // parse all the lines
     createUrl(cleanedLine, el);
   }
   return count;
 }
Esempio n. 12
0
 /** {@inheritDoc} */
 @Override
 public void setRunningVersion(boolean runningVersion) {
   super.setRunningVersion(runningVersion);
   value.setRunningVersion(runningVersion);
   if (runningVersion) {
     savedValue = value;
   } else {
     savedValue = null;
   }
 }
Esempio n. 13
0
 /**
  * Determines if two test elements are equal.
  *
  * @return true if the value is not null and equals the other Objects value; false otherwise (even
  *     if both values are null)
  */
 @Override
 public boolean equals(Object o) {
   if (o instanceof TestElementProperty) {
     if (this == o) {
       return true;
     }
     if (value != null) {
       return value.equals(((JMeterProperty) o).getObjectValue());
     }
   }
   return false;
 }
 /**
  * Modifies a given TestElement to mirror the data in the gui components.
  *
  * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
  */
 public void modifyTestElement(TestElement element) {
   configureTestElement(element);
   // N.B. this will be a config element, so we cannot use the setXXX() methods
   element.setProperty(TCPSampler.CLASSNAME, classname.getText(), "");
   element.setProperty(TCPSampler.SERVER, server.getText());
   element.setProperty(TCPSampler.RE_USE_CONNECTION, reUseConnection.isSelected());
   element.setProperty(TCPSampler.PORT, port.getText());
   // element.setProperty(TCPSampler.FILENAME, filename.getText());
   element.setProperty(TCPSampler.NODELAY, setNoDelay.isSelected());
   element.setProperty(TCPSampler.TIMEOUT, timeout.getText());
   element.setProperty(TCPSampler.REQUEST, requestData.getText());
 }
 @Override
 public void configure(TestElement element) {
   super.configure(element);
   // N.B. this will be a config element, so we cannot use the getXXX() methods
   classname.setText(element.getPropertyAsString(TCPSampler.CLASSNAME));
   server.setText(element.getPropertyAsString(TCPSampler.SERVER));
   // Default to original behaviour, i.e. re-use connection
   reUseConnection.setSelected(element.getPropertyAsBoolean(TCPSampler.RE_USE_CONNECTION, true));
   port.setText(element.getPropertyAsString(TCPSampler.PORT));
   // filename.setText(element.getPropertyAsString(TCPSampler.FILENAME));
   timeout.setText(element.getPropertyAsString(TCPSampler.TIMEOUT));
   setNoDelay.setSelected(element.getPropertyAsBoolean(TCPSampler.NODELAY));
   requestData.setText(element.getPropertyAsString(TCPSampler.REQUEST));
 }
Esempio n. 16
0
 /** {@inheritDoc} */
 @Override
 public void mergeIn(JMeterProperty prop) {
   if (isEqualType(prop)) {
     value.addTestElement((TestElement) prop.getObjectValue());
   }
 }
Esempio n. 17
0
 /** {@inheritDoc} */
 @Override
 public TestElementProperty clone() {
   TestElementProperty prop = (TestElementProperty) super.clone();
   prop.value = (TestElement) value.clone();
   return prop;
 }
Esempio n. 18
0
 /** {@inheritDoc} */
 @Override
 public String getStringValue() {
   return value.toString();
 }
Esempio n. 19
0
 @Override
 public int hashCode() {
   return value == null ? 0 : value.hashCode();
 }
Esempio n. 20
0
 /** {@inheritDoc} */
 @Override
 public PropertyIterator iterator() {
   return value.propertyIterator();
 }
Esempio n. 21
0
 /** {@inheritDoc} */
 @Override
 public void clear() {
   value.clear();
 }
 @Override
 public void configure(TestElement el) {
   super.configure(el);
   useGroupName.setSelected(el.getPropertyAsBoolean(USE_GROUP_NAME, false));
   saveHeaders.setSelected(el.getPropertyAsBoolean(SAVE_HEADERS, true));
 }
Esempio n. 23
0
 /** {@inheritDoc} */
 @Override
 public void addProperty(JMeterProperty prop) {
   value.setProperty(prop);
 }
 @Override
 public void modifyTestElement(TestElement c) {
   super.modifyTestElement(c);
   c.setProperty(USE_GROUP_NAME, useGroupName.isSelected(), false);
   c.setProperty(SAVE_HEADERS, saveHeaders.isSelected(), true);
 }