You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ms...@apache.org on 2002/07/10 03:21:03 UTC
cvs commit: jakarta-jmeter/src_1/org/apache/jmeter/resources messages.properties messages_ja.properties messages_no.properties
mstover1 2002/07/09 18:21:03
Modified: src_1/org/apache/jmeter/resources messages.properties
messages_ja.properties messages_no.properties
Added: src_1/org/apache/jmeter/protocol/http/control/gui
SoapSamplerGui.java
src_1/org/apache/jmeter/protocol/http/sampler
SoapSampler.java
Log:
New Soap Sampler
Revision Changes Path
1.1 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java
Index: SoapSamplerGui.java
===================================================================
package org.apache.jmeter.protocol.http.control.gui;
import java.awt.Font;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import org.apache.jmeter.gui.util.JLabeledTextArea;
import org.apache.jmeter.gui.util.JLabeledTextField;
import org.apache.jmeter.gui.util.VerticalLayout;
import org.apache.jmeter.protocol.http.sampler.SoapSampler;
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
/**
* @author mstover
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
*/
public class SoapSamplerGui extends AbstractSamplerGui {
private static final String label = JMeterUtils.getResString("soap_sampler_title");
JLabeledTextField urlField = new JLabeledTextField(JMeterUtils.getResString("url"));
JLabeledTextArea soapXml = new JLabeledTextArea(JMeterUtils.getResString("soap_data_title"),
null);
public SoapSamplerGui()
{
init();
}
/**
* @see JMeterGUIComponent#getStaticLabel()
*/
public String getStaticLabel() {
return label;
}
/**
* @see JMeterGUIComponent#createTestElement()
*/
public TestElement createTestElement() {
SoapSampler sampler = new SoapSampler();
this.configureTestElement(sampler);
try {
URL url = new URL(urlField.getText());
sampler.setDomain(url.getHost());
sampler.setPort(url.getPort());
sampler.setProtocol(url.getProtocol());
sampler.setMethod(SoapSampler.POST);
sampler.setPath(url.getPath());
sampler.setXmlData(soapXml.getText());
} catch(MalformedURLException e) {
}
return sampler;
}
private void init()
{
this.setLayout(new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
// MAIN PANEL
JPanel mainPanel = new JPanel();
Border margin = new EmptyBorder(10, 10, 5, 10);
mainPanel.setBorder(margin);
mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
// TITLE
JLabel panelTitleLabel = new JLabel(label);
Font curFont = panelTitleLabel.getFont();
int curFontSize = curFont.getSize();
curFontSize += 4;
panelTitleLabel.setFont(new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
mainPanel.add(panelTitleLabel);
// NAME
mainPanel.add(getNamePanel());
mainPanel.add(urlField);
// OPTIONAL TASKS
mainPanel.add(soapXml);
this.add(mainPanel);
}
public void configure(TestElement el)
{
super.configure(el);
SoapSampler sampler = (SoapSampler)el;
try {
urlField.setText(sampler.makeUrlConfig().getUrl().toString());
} catch(MalformedURLException e) {
}
soapXml.setText(sampler.getXmlData());
}
}
1.1 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
Index: SoapSampler.java
===================================================================
package org.apache.jmeter.protocol.http.sampler;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URLConnection;
import org.apache.jmeter.protocol.http.config.UrlConfig;
/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
*/
public class SoapSampler extends HTTPSampler
{
public static final String XML_DATA = "HTTPSamper.xml_data";
public void setXmlData(String data)
{
setProperty(XML_DATA,data);
}
public String getXmlData()
{
return getPropertyAsString(XML_DATA);
}
/****************************************
* Send POST data from <code>Entry</code> to the open connection.
*
*@param connection <code>URLConnection</code> of where POST data should
* be sent
*@param url contains the query string for POST
*@exception IOException if an I/O exception occurs
***************************************/
public void sendPostData(URLConnection connection, UrlConfig url)
throws IOException
{
((HttpURLConnection)connection).setRequestMethod("POST");
connection.setRequestProperty("Content-length", "" + getXmlData().length());
connection.setRequestProperty("Content-type", "text/xml");
connection.setDoOutput(true);
// [Jordi <jsalvata@atg.com]
// Note: this is illegal. We've not yet called connection.connect(), so we shouldn't
// be calling getOutputStream for it, according to the docs.
// It seems to work, though...
// [/Jordi]
// Mike: This is the I've seen it done, so I've copied it. Never read no "docs" ;-)
PrintWriter out = new PrintWriter(connection.getOutputStream());
out.print(getXmlData());
out.close();
}
}
1.20 +3 -1 jakarta-jmeter/src_1/org/apache/jmeter/resources/messages.properties
Index: messages.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/resources/messages.properties,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- messages.properties 29 Jun 2002 00:37:00 -0000 1.19
+++ messages.properties 10 Jul 2002 01:21:03 -0000 1.20
@@ -244,4 +244,6 @@
functional_mode=Functional Test Mode
functional_mode_explanation=Select functional test mode only if you need \nto record to file the data received from the server for each request. \n\nSelecting this option impacts performance considerably.
stopping_test_title=Stopping Test
-stopping_test=Shutting down all test threads. Please be patient.
\ No newline at end of file
+stopping_test=Shutting down all test threads. Please be patient.
+soap_sampler_title=Soap/XML-RPC Sampler
+soap_data_title=Soap/XML-RPC Data
\ No newline at end of file
1.19 +3 -1 jakarta-jmeter/src_1/org/apache/jmeter/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/resources/messages_ja.properties,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- messages_ja.properties 29 Jun 2002 00:37:00 -0000 1.18
+++ messages_ja.properties 10 Jul 2002 01:21:03 -0000 1.19
@@ -238,4 +238,6 @@
functional_mode=Functional Test Mode
functional_mode_explanation=Select functional test mode only if you need \nto record to file the data received from the server for each request. \n\nSelecting this option impacts performance considerably.
stopping_test_title=Stopping Test
-stopping_test=Shutting down all test threads. Please be patient.
\ No newline at end of file
+stopping_test=Shutting down all test threads. Please be patient.
+soap_sampler_title=Soap/XML-RPC Sampler
+soap_data_title=Soap/XML-RPC Data
\ No newline at end of file
1.19 +3 -1 jakarta-jmeter/src_1/org/apache/jmeter/resources/messages_no.properties
Index: messages_no.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/resources/messages_no.properties,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- messages_no.properties 29 Jun 2002 00:37:00 -0000 1.18
+++ messages_no.properties 10 Jul 2002 01:21:03 -0000 1.19
@@ -237,4 +237,6 @@
functional_mode=Functional Test Mode
functional_mode_explanation=Select functional test mode only if you need \nto record to file the data received from the server for each request. \n\nSelecting this option impacts performance considerably.
stopping_test_title=Stopping Test
-stopping_test=Shutting down all test threads. Please be patient.
\ No newline at end of file
+stopping_test=Shutting down all test threads. Please be patient.
+soap_sampler_title=Soap/XML-RPC Sampler
+soap_data_title=Soap/XML-RPC Data
\ No newline at end of file
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>