ASF Bugzilla – Attachment 18326 Details for
Bug 39626
Loading SOAP/XML-RPC requests from file in SoapSampleGui
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
OOPS! sorry here's the new one against the branch.
load-soap-message-from-file-2.diff (text/plain), 7.42 KB, created by
Davanum Srinivas
on 2006-05-22 04:10:38 UTC
(
hide
)
Description:
OOPS! sorry here's the new one against the branch.
Filename:
MIME Type:
Creator:
Davanum Srinivas
Created:
2006-05-22 04:10:38 UTC
Size:
7.42 KB
patch
obsolete
>Index: src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java >=================================================================== > >C:\APACHE\jmeter>diff -E -b -B -w -u -L "src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java (revision 408562)" -L "src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java (working copy)" src\protocol\http\org\apache\jmeter\protocol\http\control\gui\.svn\text-base\SoapSamplerGui.java.svn-base src\protocol\http\org\apache\jmeter\protocol\http\control\gui\.svn\tmp\SoapSamplerGui.java.tmp >--- src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java (revision 408562) >+++ src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java (working copy) >@@ -31,6 +31,7 @@ > import org.apache.jmeter.samplers.gui.AbstractSamplerGui; > 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; > >@@ -43,6 +44,8 @@ > private JCheckBox sendSoapAction; > private JLabeledTextArea soapXml; > >+ FilePanel soapXmlFile = new FilePanel(); >+ > public SoapSamplerGui() { > init(); > } >@@ -73,6 +76,7 @@ > SoapSampler sampler = (SoapSampler) s; > sampler.setURLData(urlField.getText()); > sampler.setXmlData(soapXml.getText()); >+ sampler.setXmlFile(soapXmlFile.getFilename()); > sampler.setSOAPAction(soapAction.getText()); > sampler.setSendSOAPAction(sendSoapAction.isSelected()); > } >@@ -110,6 +114,7 @@ > soapActionPanel.add(soapAction, 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) { >@@ -127,6 +132,7 @@ > sendSoapAction.setSelected(sampler.getSendSOAPAction()); > soapAction.setText(sampler.getSOAPAction()); > soapXml.setText(sampler.getXmlData()); >+ soapXmlFile.setFilename(sampler.getXmlFile()); > } > > public Dimension getPreferredSize() { >Index: src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java >=================================================================== > >C:\APACHE\jmeter>diff -E -b -B -w -u -L "src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java (revision 408562)" -L "src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java (working copy)" src\protocol\http\org\apache\jmeter\protocol\http\sampler\.svn\text-base\SoapSampler.java.svn-base src\protocol\http\org\apache\jmeter\protocol\http\sampler\.svn\tmp\SoapSampler.java.tmp >--- src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java (revision 408562) >+++ src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java (working copy) >@@ -19,6 +19,9 @@ > > import java.io.IOException; > import java.io.PrintWriter; >+import java.io.OutputStream; >+import java.io.InputStream; >+import java.io.FileInputStream; > import java.net.HttpURLConnection; > import java.net.MalformedURLException; > import java.net.URL; >@@ -44,6 +47,8 @@ > > public static final String URL_DATA = "SoapSampler.URL_DATA"; > >+ public static final String XML_DATA_FILE = "SoapSampler.xml_data_file"; >+ > public static final String SOAP_ACTION = "SoapSampler.SOAP_ACTION"; > > public static final String SEND_SOAP_ACTION = "SoapSampler.SEND_SOAP_ACTION"; >@@ -56,6 +61,25 @@ > return getPropertyAsString(XML_DATA); > } > >+ /** >+ * it's kinda obvious, but we state it anyways. Set the xml file with a >+ * string path. >+ * >+ * @param filename >+ */ >+ public void setXmlFile(String filename) { >+ setProperty(XML_DATA_FILE, filename); >+ } >+ >+ /** >+ * Get the file location of the xml file. >+ * >+ * @return String file path. >+ */ >+ public String getXmlFile() { >+ return getPropertyAsString(XML_DATA_FILE); >+ } >+ > public String getURLData() { > return getPropertyAsString(URL_DATA); > } >@@ -123,10 +147,28 @@ > * if an I/O exception occurs > */ > protected void sendPostData(URLConnection connection) throws IOException { >+ String xmlFile = getXmlFile(); >+ if (xmlFile != null && getXmlFile().length() > 0) { >+ OutputStream out = connection.getOutputStream(); >+ byte[] buf = new byte[1024]; >+ // 1k - the previous 100k made no sense (there's tons of buffers >+ // elsewhere in the chain) and it caused OOM when many concurrent >+ // uploads were being done. Could be fixed by increasing the evacuation >+ // ratio in bin/jmeter[.bat], but this is better. >+ int read; >+ InputStream in = new FileInputStream(xmlFile); >+ while ((read = in.read(buf)) > 0) { >+ out.write(buf, 0, read); >+ } >+ in.close(); >+ out.flush(); >+ out.close(); >+ } else { > PrintWriter out = new PrintWriter(connection.getOutputStream()); > out.print(getXmlData()); > out.close(); > } >+ } > > /* > * (non-Javadoc) >Index: src/core/org/apache/jmeter/gui/util/FilePanel.java >=================================================================== > >C:\APACHE\jmeter>diff -E -b -B -w -u -L "src/core/org/apache/jmeter/gui/util/FilePanel.java (revision 408562)" -L "src/core/org/apache/jmeter/gui/util/FilePanel.java (working copy)" src\core\org\apache\jmeter\gui\util\.svn\text-base\FilePanel.java.svn-base src\core\org\apache\jmeter\gui\util\.svn\tmp\FilePanel.java.tmp >--- src/core/org/apache/jmeter/gui/util/FilePanel.java (revision 408562) >+++ src/core/org/apache/jmeter/gui/util/FilePanel.java (working copy) >@@ -23,6 +23,7 @@ > import java.util.Iterator; > import java.util.LinkedList; > import java.util.List; >+import java.io.FileFilter; > > import javax.swing.BorderFactory; > import javax.swing.Box; >@@ -134,7 +135,12 @@ > > public void actionPerformed(ActionEvent e) { > if (e.getActionCommand().equals("browse")) { >- JFileChooser chooser = FileDialoger.promptToOpenFile(new String[] { filetype }); >+ JFileChooser chooser; >+ if(filetype == null){ >+ chooser = FileDialoger.promptToOpenFile(); >+ } else { >+ chooser = FileDialoger.promptToOpenFile(new String[] { filetype }); >+ } > if (chooser != null && chooser.getSelectedFile() != null) { > filename.setText(chooser.getSelectedFile().getPath()); > fireFileChanged(); >Index: src/core/org/apache/jmeter/gui/util/FileDialoger.java >=================================================================== > >C:\APACHE\jmeter>diff -E -b -B -w -u -L "src/core/org/apache/jmeter/gui/util/FileDialoger.java (revision 408562)" -L "src/core/org/apache/jmeter/gui/util/FileDialoger.java (working copy)" src\core\org\apache\jmeter\gui\util\.svn\text-base\FileDialoger.java.svn-base src\core\org\apache\jmeter\gui\util\.svn\tmp\FileDialoger.java.tmp >--- src/core/org/apache/jmeter/gui/util/FileDialoger.java (revision 408562) >+++ src/core/org/apache/jmeter/gui/util/FileDialoger.java (working copy) >@@ -67,7 +67,9 @@ > } > } > clearFileFilters(); >+ if(exts != null && exts.length > 0) { > jfc.addChoosableFileFilter(new JMeterFileFilter(exts)); >+ } > int retVal = jfc.showOpenDialog(GuiPackage.getInstance().getMainFrame()); > lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39626
:
18325
| 18326