New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to specify keepalives on XML/RPC request #2025
Labels
Comments
Dan Keeley (migrated from Bugzilla): SoapSampler.diffIndex: SoapSampler.java
===================================================================
--- SoapSampler.java (revision 587078)
+++ SoapSampler.java (working copy)
@@ -23,6 +23,7 @@
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.jmeter.protocol.http.control.Header;
import org.apache.jmeter.protocol.http.control.HeaderManager;
+import org.apache.jmeter.testelement.property.BooleanProperty;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.jorphan.util.JOrphanUtils;
import org.apache.log.Logger;
@@ -53,11 +54,13 @@
public static final String SEND_SOAP_ACTION = "SoapSampler.SEND_SOAP_ACTION"; //$NON-NLS-1$
public static final String XML_DATA_FILE = "SoapSampler.xml_data_file"; //$NON-NLS-1$
+
+ public final static String USE_KEEPALIVE = "HTTPSampler.use_keepalive"; // $NON-NLS-1$
private static final String DOUBLE_QUOTE = "\""; //$NON-NLS-1$
private static final String SOAPACTION = "SOAPAction"; //$NON-NLS-1$
-
+
public void setXmlData(String data) {
setProperty(XML_DATA, data);
}
@@ -75,7 +78,7 @@
public void setXmlFile(String filename) {
setProperty(XML_DATA_FILE, filename);
}
-
+
/**
* Get the file location of the xml file.
*
@@ -84,7 +87,16 @@
public String getXmlFile() {
return getPropertyAsString(XML_DATA_FILE);
}
+
+ public void setUseKeepAlive(boolean value) {
+ setProperty(new BooleanProperty(USE_KEEPALIVE, value));
+ }
+ public boolean getUseKeepAlive() {
+ return getPropertyAsBoolean(USE_KEEPALIVE);
+ }
+
+
public String getURLData() {
return getPropertyAsString(URL_DATA);
} |
Dan Keeley (migrated from Bugzilla): SoapSamplerGui.java/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.jmeter.protocol.http.control.gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
import org.apache.jmeter.protocol.http.sampler.SoapSampler;
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
import org.apache.jmeter.testelement.AbstractTestElement;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.gui.util.FilePanel;
import org.apache.jorphan.gui.JLabeledTextArea;
import org.apache.jorphan.gui.JLabeledTextField;
public class SoapSamplerGui extends AbstractSamplerGui {
private JLabeledTextField urlField;
private JLabeledTextField soapAction;
private JCheckBox sendSoapAction;
private JCheckBox useKeepAlive;
private JLabeledTextArea soapXml;
private FilePanel soapXmlFile = new FilePanel();
public SoapSamplerGui() {
init();
}
public String getLabelResource() {
return "soap_sampler_title"; //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
*/
public TestElement createTestElement() {
SoapSampler sampler = new SoapSampler();
modifyTestElement(sampler);
return sampler;
}
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
public void modifyTestElement(TestElement s) {
this.configureTestElement(s);
if (s instanceof SoapSampler) {
SoapSampler sampler = (SoapSampler) s;
sampler.setURLData(urlField.getText());
sampler.setXmlData(soapXml.getText());
sampler.setXmlFile(soapXmlFile.getFilename());
sampler.setSOAPAction(soapAction.getText());
sampler.setSendSOAPAction(sendSoapAction.isSelected());
sampler.setUseKeepAlive(useKeepAlive.isSelected());
}
}
/**
* Implements JMeterGUIComponent.clearGui
*/
public void clearGui() {
super.clearGui();
urlField.setText(""); //$NON-NLS-1$
soapAction.setText(""); //$NON-NLS-1$
soapXml.setText(""); //$NON-NLS-1$
sendSoapAction.setSelected(true);
soapXmlFile.setFilename(""); //$NON-NLS-1$
useKeepAlive.setSelected(false);
}
private void init() {
setLayout(new BorderLayout());
setBorder(makeBorder());
add(makeTitlePanel(), BorderLayout.NORTH);
urlField = new JLabeledTextField(JMeterUtils.getResString("url"), 10); //$NON-NLS-1$
soapXml = new JLabeledTextArea(JMeterUtils.getResString("soap_data_title")); //$NON-NLS-1$
soapAction = new JLabeledTextField("", 10); //$NON-NLS-1$
sendSoapAction = new JCheckBox(JMeterUtils.getResString("soap_send_action"), true); //$NON-NLS-1$
useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel soapActionPanel = new JPanel();
soapActionPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 2;
c.gridx = 0;
c.gridy = 0;
c.weightx = 1;
soapActionPanel.add(urlField, c);
c.fill = GridBagConstraints.NONE;
c.gridwidth = 1;
c.gridy = 1;
c.weightx = 0;
soapActionPanel.add(sendSoapAction, c);
c.gridx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
soapActionPanel.add(soapAction, c);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 2;
c.gridy = 2;
c.gridx = 0;
soapActionPanel.add(useKeepAlive, c);
mainPanel.add(soapActionPanel, BorderLayout.NORTH);
mainPanel.add(soapXml, BorderLayout.CENTER);
mainPanel.add(soapXmlFile, BorderLayout.SOUTH);
sendSoapAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
soapAction.setEnabled(sendSoapAction.isSelected());
}
});
add(mainPanel, BorderLayout.CENTER);
}
public void configure(TestElement el) {
super.configure(el);
SoapSampler sampler = (SoapSampler) el;
urlField.setText(sampler.getURLData());
sendSoapAction.setSelected(sampler.getSendSOAPAction());
soapAction.setText(sampler.getSOAPAction());
soapXml.setText(sampler.getXmlData());
soapXmlFile.setFilename(sampler.getXmlFile());
useKeepAlive.setSelected(((AbstractTestElement) el).getPropertyAsBoolean(SoapSampler.USE_KEEPALIVE));
}
public Dimension getPreferredSize() {
return getMinimumSize();
}
} |
Sebb (migrated from Bugzilla): |
Sebb (migrated from Bugzilla): [I simplified it slightly to use the superclass methods] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dan Keeley (Bug 43485):
Would like the ability to specify keepalives on an XML/RPC request.
I have a patch for this, which i will attach shortly.
OS: other
The text was updated successfully, but these errors were encountered: