Added:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPFileArgs.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPFileArgs.java?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPFileArgs.java
(added)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPFileArgs.java
Wed May 7 19:15:58 2008
@@ -0,0 +1,232 @@
+/*
+ * 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.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jmeter.config.ConfigTestElement;
+import org.apache.jmeter.testelement.property.CollectionProperty;
+import org.apache.jmeter.testelement.property.PropertyIterator;
+import org.apache.jmeter.testelement.property.TestElementProperty;
+
+/**
+ * A set of HTTPFileArg objects.
+ *
+ */
+public class HTTPFileArgs extends ConfigTestElement implements Serializable {
+
+ /** The name of the property used to store the files. */
+ private static final String HTTP_FILE_ARGS = "HTTPFileArgs.files";
//$NON-NLS-1$
+
+ /**
+ * Create a new HTTPFileArgs object with no files.
+ */
+ public HTTPFileArgs() {
+ setProperty(new CollectionProperty(HTTP_FILE_ARGS, new
ArrayList()));
+ }
+
+ /**
+ * Get the files.
+ *
+ * @return the files
+ */
+ public CollectionProperty getHTTPFileArgsCollection() {
+ return (CollectionProperty) getProperty(HTTP_FILE_ARGS);
+ }
+
+ /**
+ * Clear the files.
+ */
+ public void clear() {
+ super.clear();
+ setProperty(new CollectionProperty(HTTP_FILE_ARGS, new
ArrayList()));
+ }
+
+ /**
+ * Set the list of files. Any existing files will be lost.
+ *
+ * @param files the new files
+ */
+ public void setHTTPFileArgs(List files) {
+ setProperty(new CollectionProperty(HTTP_FILE_ARGS, files));
+ }
+
+ /**
+ * Add a new file with the given path.
+ *
+ * @param path
+ * the path of the file
+ */
+ public void addHTTPFileArg(String path) {
+ addHTTPFileArg(new HTTPFileArg(path));
+ }
+
+ /**
+ * Add a new file.
+ *
+ * @param file
+ * the new file
+ */
+ public void addHTTPFileArg(HTTPFileArg file) {
+ TestElementProperty newHTTPFileArg = new
TestElementProperty(file.getPath(), file);
+ if (isRunningVersion()) {
+ this.setTemporary(newHTTPFileArg);
+ }
+ getHTTPFileArgsCollection().addItem(newHTTPFileArg);
+ }
+
+ /**
+ * adds a new File to the HTTPFileArgs list to be uploaded with http
+ * request.
+ *
+ * @param path file full path.
+ * @param param http parameter name.
+ * @param mime mime type of file.
+ */
+ public void addHTTPFileArg(String path, String param, String mime) {
+ addHTTPFileArg(new HTTPFileArg(path, param, mime));
+ }
+
+ /**
+ * Get a PropertyIterator of the files.
+ *
+ * @return an iteration of the files
+ */
+ public PropertyIterator iterator() {
+ return getHTTPFileArgsCollection().iterator();
+ }
+
+ /**
+ * Get the current arguments as an array.
+ *
+ * @return an array of file arguments
+ */
+ public HTTPFileArg[] asArray(){
+ CollectionProperty props = getHTTPFileArgsCollection();
+ final int size = props.size();
+ HTTPFileArg[] args = new HTTPFileArg[size];
+ for(int i=0; i<size; i++){
+ args[i]=(HTTPFileArg) props.get(i).getObjectValue();
+ }
+ return args;
+ }
+ /**
+ * Create a string representation of the files.
+ *
+ * @return the string representation of the files
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ PropertyIterator iter = getHTTPFileArgsCollection().iterator();
+ while (iter.hasNext()) {
+ HTTPFileArg file = (HTTPFileArg)
iter.next().getObjectValue();
+ str.append(file.getPath());
+ if (iter.hasNext()) {
+ str.append("&"); //$NON-NLS-1$
+ }
+ }
+ return str.toString();
+ }
+
+ /**
+ * Remove the specified file from the list.
+ *
+ * @param row
+ * the index of the file to remove
+ */
+ public void removeHTTPFileArg(int row) {
+ if (row < getHTTPFileArgCount()) {
+ getHTTPFileArgsCollection().remove(row);
+ }
+ }
+
+ /**
+ * Remove the specified file from the list.
+ *
+ * @param file
+ * the file to remove
+ */
+ public void removeHTTPFileArg(HTTPFileArg file) {
+ PropertyIterator iter = getHTTPFileArgsCollection().iterator();
+ while (iter.hasNext()) {
+ HTTPFileArg item = (HTTPFileArg)
iter.next().getObjectValue();
+ if (file.equals(item)) {
+ iter.remove();
+ }
+ }
+ }
+
+ /**
+ * Remove the file with the specified path.
+ *
+ * @param filePath
+ * the path of the file to remove
+ */
+ public void removeHTTPFileArg(String filePath) {
+ PropertyIterator iter = getHTTPFileArgsCollection().iterator();
+ while (iter.hasNext()) {
+ HTTPFileArg file = (HTTPFileArg)
iter.next().getObjectValue();
+ if (file.getPath().equals(filePath)) {
+ iter.remove();
+ }
+ }
+ }
+
+ /**
+ * Remove all files from the list.
+ */
+ public void removeAllHTTPFileArgs() {
+ getHTTPFileArgsCollection().clear();
+ }
+
+ /**
+ * Add a new empty file to the list. The new file will have the
+ * empty string as its path.
+ */
+ public void addEmptyHTTPFileArg() {
+ addHTTPFileArg(new HTTPFileArg(""));
+ }
+
+ /**
+ * Get the number of files in the list.
+ *
+ * @return the number of files
+ */
+ public int getHTTPFileArgCount() {
+ return getHTTPFileArgsCollection().size();
+ }
+
+ /**
+ * Get a single file.
+ *
+ * @param row
+ * the index of the file to return.
+ * @return the file at the specified index, or null if no file
+ * exists at that index.
+ */
+ public HTTPFileArg getHTTPFileArg(int row) {
+ HTTPFileArg file = null;
+ if (row < getHTTPFileArgCount()) {
+ file = (HTTPFileArg)
getHTTPFileArgsCollection().get(row).getObjectValue();
+ }
+ return file;
+ }
+}
Propchange:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPFileArgs.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPFileArgs.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
Wed May 7 19:15:58 2008
@@ -0,0 +1,81 @@
+/*
+ * 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.config;
+
+import junit.framework.TestCase;
+
+import org.apache.jmeter.config.Argument;
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.http.util.HTTPFileArg;
+import org.apache.jmeter.protocol.http.util.HTTPFileArgs;
+
+public class MultipartUrlConfigTest extends TestCase {
+
+ public MultipartUrlConfigTest(String name) {
+ super(name);
+ }
+
+ public void testConstructors() {
+ MultipartUrlConfig muc = new MultipartUrlConfig();
+ assertEquals(0, muc.getArguments().getArgumentCount());
+ assertEquals(0, muc.getHTTPFileArgs().getHTTPFileArgCount());
+ muc = new MultipartUrlConfig("boundary");
+ assertEquals(0, muc.getArguments().getArgumentCount());
+ assertEquals(0, muc.getHTTPFileArgs().getHTTPFileArgCount());
+ assertEquals("boundary", muc.getBoundary());
+ }
+
+ public void testParseArguments() {
+ String queryString
+ = "Content-Disposition: form-data; name=\"aa\"\n"
+ + "Content-Type: text/plain; charset=ISO-8859-1\n"
+ + "Content-Transfer-Encoding: 8bit\n"
+ + "\n"
+ + "aa\n"
+ + "--7d159c1302d0y0\n"
+ + "Content-Disposition: form-data; name=\"xx\"\n"
+ + "Content-Type: text/plain; charset=ISO-8859-1\n"
+ + "Content-Transfer-Encoding: 8bit\n"
+ + "\n"
+ + "xx\n"
+ + "--7d159c1302d0y0\n"
+ + "Content-Disposition: form-data; name=\"param1\";
filename=\"file1\"\n"
+ + "Content-Type: text/plain\n"
+ + "Content-Transfer-Encoding: binary\n"
+ + "\n"
+ + "file content\n"
+ + "\n";
+ MultipartUrlConfig muc = new
MultipartUrlConfig("7d159c1302d0y0");
+ muc.parseArguments(queryString);
+ HTTPFileArgs files = muc.getHTTPFileArgs();
+ assertEquals(1, files.getHTTPFileArgCount());
+ HTTPFileArg file = (HTTPFileArg)
files.iterator().next().getObjectValue();
+ assertEquals("file1", file.getPath());
+ assertEquals("param1", file.getParamName());
+ assertEquals("text/plain", file.getMimeType());
+ Arguments args = muc.getArguments();
+ assertEquals(2, args.getArgumentCount());
+ Argument arg = args.getArgument(0);
+ assertEquals("aa", arg.getName());
+ assertEquals("aa", arg.getValue());
+ arg = args.getArgument(1);
+ assertEquals("xx", arg.getName());
+ assertEquals("xx", arg.getValue());
+ }
+}
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/NullURLConnection.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/NullURLConnection.java?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/NullURLConnection.java
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/NullURLConnection.java
Wed May 7 19:15:58 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.sampler;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.MalformedURLException;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Dummy URLConnection class for use by classes that need an
+ * URLConnection for junit tests.
+ *
+ */
+public final class NullURLConnection extends URLConnection {
+
+ private Map data = new Properties();
+
+ public NullURLConnection() throws MalformedURLException {
+ this(new URL("http://localhost"));
+ }
+
+ public NullURLConnection(URL url) {
+ super(url);
+ }
+
+ public void connect() {
+ }
+
+ public void setRequestProperty(String name, String value) {
+ data.put(name, value);
+ }
+
+ public String getRequestProperty(String name) {
+ return (String) data.get(name);
+ }
+}
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/NullURLConnection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/NullURLConnection.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
Wed May 7 19:15:58 2008
@@ -0,0 +1,45 @@
+/*
+ * 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.sampler;
+
+import java.net.URLConnection;
+import junit.framework.TestCase;
+
+import org.apache.jmeter.protocol.http.util.HTTPFileArg;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
+
+public class PutWriterTest extends TestCase {
+
+ public PutWriterTest(String name) {
+ super(name);
+ }
+
+ public void testSetHeaders() throws Exception {
+ URLConnection uc = new NullURLConnection();
+ HTTPSampler sampler = new HTTPSampler();
+ sampler.setHTTPFiles(new HTTPFileArg[]{new HTTPFileArg("file1",
"", "mime1")});
+ PutWriter pw = new PutWriter();
+ pw.setHeaders(uc, sampler);
+ assertEquals("mime1",
uc.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE));
+ uc = new NullURLConnection();
+ sampler.setHTTPFiles(new HTTPFileArg[]{new HTTPFileArg("file2",
"param2", "mime2")});
+ pw.setHeaders(uc, sampler);
+ assertEquals("mime2",
uc.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE));
+ }
+}
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java?rev=654389&r1=654388&r2=654389&view=diff
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java
(original)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java
Wed May 7 19:15:58 2008
@@ -20,7 +20,7 @@
import org.apache.jmeter.config.Argument;
import org.apache.jmeter.config.Arguments;
-
+import org.apache.jmeter.protocol.http.util.HTTPFileArg;
import junit.framework.TestCase;
public class TestHTTPSamplers extends TestCase {
@@ -34,14 +34,16 @@
HTTPSamplerBase sampler = new HTTPNullSampler();
Arguments args;
Argument arg;
-
+
args = sampler.getArguments();
assertEquals(0,args.getArgumentCount());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
sampler.parseArguments("");
args = sampler.getArguments();
assertEquals(0,args.getArgumentCount());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
sampler.parseArguments("name1");
args = sampler.getArguments();
assertEquals(1,args.getArgumentCount());
@@ -49,7 +51,8 @@
assertEquals("name1",arg.getName());
assertEquals("",arg.getMetaData());
assertEquals("",arg.getValue());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
sampler.parseArguments("name2=");
args = sampler.getArguments();
assertEquals(2,args.getArgumentCount());
@@ -57,7 +60,8 @@
assertEquals("name2",arg.getName());
assertEquals("=",arg.getMetaData());
assertEquals("",arg.getValue());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
sampler.parseArguments("name3=value3");
args = sampler.getArguments();
assertEquals(3,args.getArgumentCount());
@@ -65,7 +69,7 @@
assertEquals("name3",arg.getName());
assertEquals("=",arg.getMetaData());
assertEquals("value3",arg.getValue());
-
+ assertEquals(0,sampler.getHTTPFileCount());
}
// Parse arguments all at once
@@ -73,29 +77,33 @@
HTTPSamplerBase sampler = new HTTPNullSampler();
Arguments args;
Argument arg;
-
+
args = sampler.getArguments();
assertEquals(0,args.getArgumentCount());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
sampler.parseArguments("&name1&name2=&name3=value3");
args = sampler.getArguments();
assertEquals(3,args.getArgumentCount());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
arg=args.getArgument(0);
assertEquals("name1",arg.getName());
assertEquals("",arg.getMetaData());
assertEquals("",arg.getValue());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
arg=args.getArgument(1);
assertEquals("name2",arg.getName());
assertEquals("=",arg.getMetaData());
assertEquals("",arg.getValue());
-
+ assertEquals(0,sampler.getHTTPFileCount());
+
arg=args.getArgument(2);
assertEquals("name3",arg.getName());
assertEquals("=",arg.getMetaData());
assertEquals("value3",arg.getValue());
-
+ assertEquals(0,sampler.getHTTPFileCount());
}
public void testArgumentWithoutEquals() throws Exception {
@@ -212,4 +220,114 @@
config.setDomain("www.apache.org");
assertEquals("http://www.apache.org/index.html",
config.getUrl().toString());
}
+
+ public void testFileList(){
+ HTTPSamplerBase config = new HTTPNullSampler();
+ HTTPFileArg[] arg;
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+
+ config.setFileField("");
+ config.setFilename("");
+ config.setMimetype("");
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+
+ config.setMimetype("text/plain");
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+ assertEquals("text/plain",arg[0].getMimeType());
+ assertEquals("",arg[0].getPath());
+ assertEquals("",arg[0].getParamName());
+
+ config.setFileField("test123.tmp");
+ config.setFilename("/tmp/test123.tmp");
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+ assertEquals("text/plain",arg[0].getMimeType());
+ assertEquals("/tmp/test123.tmp",arg[0].getPath());
+ assertEquals("test123.tmp",arg[0].getParamName());
+
+ HTTPFileArg[] files = {};
+
+ // Ignore empty file specs
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+ files = new HTTPFileArg[]{
+ new HTTPFileArg(),
+ new HTTPFileArg(),
+ };
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+
+ // Ignore trailing empty spec
+ files = new HTTPFileArg[]{
+ new HTTPFileArg("file"),
+ new HTTPFileArg(),
+ };
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+
+ // Ignore leading empty spec
+ files = new HTTPFileArg[]{
+ new HTTPFileArg(),
+ new HTTPFileArg("file1"),
+ new HTTPFileArg(),
+ new HTTPFileArg("file2"),
+ new HTTPFileArg(),
+ };
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(2,arg.length);
+ }
+
+ public void testSetAndGetFileField() {
+ HTTPSamplerBase sampler = new HTTPNullSampler();
+ sampler.setFileField("param");
+ assertEquals("param", sampler.getFileField());
+ HTTPFileArg file = sampler.getHTTPFiles()[0];
+ assertEquals("param", file.getParamName());
+
+ sampler.setFileField("param2");
+ assertEquals("param2", sampler.getFileField());
+ file = sampler.getHTTPFiles()[0];
+ assertEquals("param2", file.getParamName());
+ }
+
+ public void testSetAndGetFilename() {
+ HTTPSamplerBase sampler = new HTTPNullSampler();
+ sampler.setFilename("name");
+ assertEquals("name", sampler.getFilename());
+ HTTPFileArg file = sampler.getHTTPFiles()[0];
+ assertEquals("name", file.getPath());
+
+ sampler.setFilename("name2");
+ assertEquals("name2", sampler.getFilename());
+ file = sampler.getHTTPFiles()[0];
+ assertEquals("name2", file.getPath());
+ }
+
+ public void testSetAndGetMimetype() {
+ HTTPSamplerBase sampler = new HTTPNullSampler();
+ sampler.setMimetype("mime");
+ assertEquals("mime", sampler.getMimetype());
+ HTTPFileArg file = sampler.getHTTPFiles()[0];
+ assertEquals("mime", file.getMimeType());
+
+ sampler.setMimetype("mime2");
+ assertEquals("mime2", sampler.getMimetype());
+ file = sampler.getHTTPFiles()[0];
+ assertEquals("mime2", file.getMimeType());
+ }
}
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java.bak
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java.bak?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java.bak
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java.bak
Wed May 7 19:15:58 2008
@@ -0,0 +1,287 @@
+/*
+ * 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.sampler;
+
+import org.apache.jmeter.config.Argument;
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.http.util.HTTPFileArg;
+
+import junit.framework.TestCase;
+
+public class TestHTTPSamplers extends TestCase {
+
+ public TestHTTPSamplers(String arg0) {
+ super(arg0);
+ }
+
+ // Parse arguments singly
+ public void testParseArguments(){
+ HTTPSamplerBase sampler = new HTTPNullSampler();
+ Arguments args;
+ Argument arg;
+
+ args = sampler.getArguments();
+ assertEquals(0,args.getArgumentCount());
+
+ sampler.parseArguments("");
+ args = sampler.getArguments();
+ assertEquals(0,args.getArgumentCount());
+
+ sampler.parseArguments("name1");
+ args = sampler.getArguments();
+ assertEquals(1,args.getArgumentCount());
+ arg=args.getArgument(0);
+ assertEquals("name1",arg.getName());
+ assertEquals("",arg.getMetaData());
+ assertEquals("",arg.getValue());
+
+ sampler.parseArguments("name2=");
+ args = sampler.getArguments();
+ assertEquals(2,args.getArgumentCount());
+ arg=args.getArgument(1);
+ assertEquals("name2",arg.getName());
+ assertEquals("=",arg.getMetaData());
+ assertEquals("",arg.getValue());
+
+ sampler.parseArguments("name3=value3");
+ args = sampler.getArguments();
+ assertEquals(3,args.getArgumentCount());
+ arg=args.getArgument(2);
+ assertEquals("name3",arg.getName());
+ assertEquals("=",arg.getMetaData());
+ assertEquals("value3",arg.getValue());
+
+ }
+
+ // Parse arguments all at once
+ public void testParseArguments2(){
+ HTTPSamplerBase sampler = new HTTPNullSampler();
+ Arguments args;
+ Argument arg;
+
+ args = sampler.getArguments();
+ assertEquals(0,args.getArgumentCount());
+
+ sampler.parseArguments("&name1&name2=&name3=value3");
+ args = sampler.getArguments();
+ assertEquals(3,args.getArgumentCount());
+
+ arg=args.getArgument(0);
+ assertEquals("name1",arg.getName());
+ assertEquals("",arg.getMetaData());
+ assertEquals("",arg.getValue());
+
+ arg=args.getArgument(1);
+ assertEquals("name2",arg.getName());
+ assertEquals("=",arg.getMetaData());
+ assertEquals("",arg.getValue());
+
+ arg=args.getArgument(2);
+ assertEquals("name3",arg.getName());
+ assertEquals("=",arg.getMetaData());
+ assertEquals("value3",arg.getValue());
+
+ }
+
+ public void testArgumentWithoutEquals() throws Exception {
+ HTTPSamplerBase sampler = new HTTPNullSampler();
+ sampler.setProtocol("http");
+ sampler.setMethod(HTTPSamplerBase.GET);
+ sampler.setPath("/index.html?pear");
+ sampler.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?pear",
sampler.getUrl().toString());
+ }
+
+ public void testMakingUrl() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.addArgument("param1", "value1");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1=value1",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl2() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.addArgument("param1", "value1");
+ config.setPath("/index.html?p1=p2");
+ config.setDomain("www.apache.org");
+
assertEquals("http://www.apache.org/index.html?param1=value1&p1=p2",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl3() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.POST);
+ config.addArgument("param1", "value1");
+ config.setPath("/index.html?p1=p2");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?p1=p2",
config.getUrl().toString());
+ }
+
+ // test cases for making Url, and exercise method
+ // addArgument(String name,String value,String metadata)
+
+ public void testMakingUrl4() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.addArgument("param1", "value1", "=");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1=value1",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl5() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.addArgument("param1", "", "=");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1=",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl6() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.addArgument("param1", "", "");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1",
config.getUrl().toString());
+ }
+
+ // test cases for making Url, and exercise method
+ // parseArguments(String queryString)
+
+ public void testMakingUrl7() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.parseArguments("param1=value1");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1=value1",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl8() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.parseArguments("param1=");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1=",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl9() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.parseArguments("param1");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html?param1",
config.getUrl().toString());
+ }
+
+ public void testMakingUrl10() throws Exception {
+ HTTPSamplerBase config = new HTTPNullSampler();
+ config.setProtocol("http");
+ config.setMethod(HTTPSamplerBase.GET);
+ config.parseArguments("");
+ config.setPath("/index.html");
+ config.setDomain("www.apache.org");
+ assertEquals("http://www.apache.org/index.html",
config.getUrl().toString());
+ }
+
+ public void testFileList(){
+ HTTPSamplerBase config = new HTTPNullSampler();
+ HTTPFileArg[] arg;
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+
+ config.setFileField("");
+ config.setFilename("");
+ config.setMimetype("");
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+
+ config.setMimetype("text/plain");
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+ assertEquals("text/plain",arg[0].getMimeType());
+ assertEquals("",arg[0].getPath());
+ assertEquals("",arg[0].getParamName());
+
+ config.setFileField("test123.tmp");
+ config.setFilename("/tmp/test123.tmp");
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+ assertEquals("text/plain",arg[0].getMimeType());
+ assertEquals("/tmp/test123.tmp",arg[0].getPath());
+ assertEquals("test123.tmp",arg[0].getParamName());
+
+ HTTPFileArg[] files = {};
+
+ // Ignore empty file specs
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+ files = new HTTPFileArg[]{
+ new HTTPFileArg(),
+ new HTTPFileArg(),
+ };
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(0,arg.length);
+
+ // Ignore trailing empty spec
+ files = new HTTPFileArg[]{
+ new HTTPFileArg("file"),
+ new HTTPFileArg(),
+ };
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+
+ // Ignore leading empty spec
+ files = new HTTPFileArg[]{
+ new HTTPFileArg(),
+ new HTTPFileArg("file1"),
+ new HTTPFileArg(),
+ new HTTPFileArg("file2"),
+ new HTTPFileArg(),
+ };
+ config.setHTTPFiles(files);
+ arg = config.getHTTPFiles();
+ assertNotNull(arg);
+ assertEquals(1,arg.length);
+ }
+}
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArg.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArg.java?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArg.java
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArg.java
Wed May 7 19:15:58 2008
@@ -0,0 +1,66 @@
+/*
+ * 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.util;
+
+import junit.framework.TestCase;
+
+public class TestHTTPFileArg extends TestCase {
+ public TestHTTPFileArg(String name) {
+ super(name);
+ }
+
+ public void testConstructors() throws Exception {
+ HTTPFileArg file = new HTTPFileArg();
+ assertEquals("no parameter failure", "", file.getPath());
+ assertEquals("no parameter failure", "", file.getParamName());
+ assertEquals("no parameter failure", "", file.getMimeType());
+ file = new HTTPFileArg("path");
+ assertEquals("single parameter failure", "path",
file.getPath());
+ assertEquals("single parameter failure", "",
file.getParamName());
+ assertEquals("single parameter failure", "",
file.getMimeType());
+ file = new HTTPFileArg("path", "param", "mimetype");
+ assertEquals("three parameter failure", "path", file.getPath());
+ assertEquals("three parameter failure", "param",
file.getParamName());
+ assertEquals("three parameter failure", "mimetype",
file.getMimeType());
+ HTTPFileArg file2 = new HTTPFileArg(file);
+ assertEquals("copy constructor failure", "path",
file2.getPath());
+ assertEquals("copy constructor failure", "param",
file2.getParamName());
+ assertEquals("copy constructor failure", "mimetype",
file2.getMimeType());
+ }
+
+ public void testGettersSetters() throws Exception {
+ HTTPFileArg file = new HTTPFileArg();
+ assertEquals("", file.getPath());
+ assertEquals("", file.getParamName());
+ assertEquals("", file.getMimeType());
+ file.setPath("path");
+ file.setParamName("param");
+ file.setMimeType("mimetype");
+ file.setHeader("header");
+ assertEquals("path", file.getPath());
+ assertEquals("param", file.getParamName());
+ assertEquals("mimetype", file.getMimeType());
+ assertEquals("header", file.getHeader());
+ }
+
+ public void testToString() throws Exception {
+ HTTPFileArg file = new HTTPFileArg("path1", "param1",
"mimetype1");
+
assertEquals("path:'path1'|param:'param1'|mimetype:'mimetype1'",
file.toString());
+ }
+}
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArg.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArg.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArgs.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArgs.java?rev=654389&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArgs.java
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArgs.java
Wed May 7 19:15:58 2008
@@ -0,0 +1,118 @@
+/*
+ * 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.util;
+
+import java.util.List;
+import java.util.LinkedList;
+import junit.framework.TestCase;
+
+import org.apache.jmeter.testelement.property.PropertyIterator;
+
+public class TestHTTPFileArgs extends TestCase {
+ public TestHTTPFileArgs(String name) {
+ super(name);
+ }
+
+ public void testConstructors() throws Exception {
+ HTTPFileArgs files = new HTTPFileArgs();
+ assertEquals(0, files.getHTTPFileArgCount());
+ }
+
+ public void testAdding() throws Exception {
+ HTTPFileArgs files = new HTTPFileArgs();
+ assertEquals(0, files.getHTTPFileArgCount());
+ files.addHTTPFileArg("hede");
+ assertEquals(1, files.getHTTPFileArgCount());
+ assertEquals("hede", ((HTTPFileArg)
files.iterator().next().getObjectValue()).getPath());
+ HTTPFileArg file = new HTTPFileArg("hodo");
+ files.addHTTPFileArg(file);
+ assertEquals(2, files.getHTTPFileArgCount());
+ PropertyIterator iter = files.iterator();
+ assertEquals("hede", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("hodo", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ files.addEmptyHTTPFileArg();
+ assertEquals(3, files.getHTTPFileArgCount());
+ iter = files.iterator();
+ assertEquals("hede", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("hodo", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ }
+
+ public void testSetHTTPFileArgs() throws Exception {
+ List newHTTPFileArgs = new LinkedList();
+ newHTTPFileArgs.add(new HTTPFileArg("hede"));
+ HTTPFileArgs files = new HTTPFileArgs();
+ files.setHTTPFileArgs((List) newHTTPFileArgs);
+ assertEquals(1, files.getHTTPFileArgCount());
+ assertEquals("hede", ((HTTPFileArg)
files.iterator().next().getObjectValue()).getPath());
+ }
+
+ public void testRemoving() throws Exception {
+ HTTPFileArgs files = new HTTPFileArgs();
+ assertEquals(0, files.getHTTPFileArgCount());
+ files.addHTTPFileArg("hede");
+ assertEquals(1, files.getHTTPFileArgCount());
+ files.clear();
+ assertEquals(0, files.getHTTPFileArgCount());
+ files.addHTTPFileArg("file1");
+ files.addHTTPFileArg("file2");
+ files.addHTTPFileArg("file3");
+ HTTPFileArg file = new HTTPFileArg("file4");
+ files.addHTTPFileArg(file);
+ files.addHTTPFileArg("file5");
+ files.addHTTPFileArg("file6");
+ assertEquals(6, files.getHTTPFileArgCount());
+ files.removeHTTPFileArg("file3");
+ assertEquals(5, files.getHTTPFileArgCount());
+ PropertyIterator iter = files.iterator();
+ assertEquals("file1", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file2", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file4", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file5", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file6", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ files.removeHTTPFileArg(file);
+ assertEquals(4, files.getHTTPFileArgCount());
+ iter = files.iterator();
+ assertEquals("file1", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file2", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file5", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file6", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ files.removeHTTPFileArg(new HTTPFileArg("file5"));
+ assertEquals(3, files.getHTTPFileArgCount());
+ iter = files.iterator();
+ assertEquals("file1", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file2", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file6", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ files.removeHTTPFileArg(1);
+ assertEquals(2, files.getHTTPFileArgCount());
+ iter = files.iterator();
+ assertEquals("file1", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ assertEquals("file6", ((HTTPFileArg)
iter.next().getObjectValue()).getPath());
+ files.removeAllHTTPFileArgs();
+ assertEquals(0, files.getHTTPFileArgCount());
+ }
+
+ public void testToString() throws Exception {
+ HTTPFileArgs files = new HTTPFileArgs();
+ files.addHTTPFileArg("file1");
+ files.addHTTPFileArg("file2");
+ files.addHTTPFileArg("file3");
+ assertEquals("file1&file2&file3", files.toString());
+ }
+}
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArgs.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPFileArgs.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=654389&r1=654388&r2=654389&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Wed May 7 19:15:58 2008
@@ -68,6 +68,8 @@
<p>HTTP(S) samplers can now save just the MD5 hash of responses, rather than
the entire response.</p>
+<p>The HTTP Samplers can now POST multiple files</p>
+
<p>
View Results Tree Listener now uses Tidy to display XML.
This should allow more content to be displayed succesfully.
@@ -189,6 +191,7 @@
<li>Webservice(SOAP) Sampler can now load local WSDL files using the file:
protocol</li>
<li>Bug 44872 - Add "All Files" filter to Open File dialogs</li>
<li>Mirror server can now be run independently (mirror-server.cmd and
mirror-server.sh)</li>
+<li>Bug 19128 - Added multiple file POST support to HTTP Samplers</li>
</ul>
<h4>Non-functional changes</h4>
Modified: jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/http-request.png
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/images/screenshots/webtest/http-request.png?rev=654389&r1=654388&r2=654389&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=654389&r1=654388&r2=654389&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Wed May 7
19:15:58 2008
@@ -81,7 +81,7 @@
</component>
-<component name="HTTP Request" index="§-num;.1.2" width="683"
height="590" screenshot="webtest/http-request.png">
+<component name="HTTP Request" index="§-num;.1.2" width="682"
height="619" screenshot="webtest/http-request.png">
<description>
<p>This sampler lets you send an HTTP/HTTPS request to a web server.
It
@@ -111,10 +111,13 @@
them. This can save you time if you have a lot of HTTP requests or
requests with many
parameters.</p>
- <p><b>There are two versions of the sampler:</b>
+ <p><b>There are three versions of the sampler:</b>
<ul>
<li>HTTP Request - uses the default Java HTTP implementation</li>
<li>HTTP Request HTTPClient - uses Apache Commons HttpClient</li>
+ <li>AJP/1.3 Sampler - uses the Tomcat mod_jk protocol (allows testing
of Tomcat in AJP mode without needing Apache httpd)
+ The AJP Sampler does not support multiple file upload; only the first
file will be used.
+ </li>
</ul>
</p>
<p>The default (Java) implementation has some limitations:</p>
@@ -212,17 +215,18 @@
Additionally, you can specify whether each parameter should be URL
encoded. If you are not sure what this
means, it is probably best to select it. If your values contain
characters such as &amp; or spaces, or
question marks, then encoding is usually required.</p></property>
- <property name="Filename" required="No">Name of the file to send. If
left blank, JMeter
+ <property name="File Path:" required="No">Name of the file to send.
If left blank, JMeter
does not send a file, if filled in, JMeter automatically sends the
request as
a multipart form request.
<p>
- If it is a POST or PUT request and the 'name' atribute (below) are
omitted, then the file is sent as the entire body
+ If it is a POST or PUT request and there is a single file whose 'name'
attribute (below) is omitted,
+ then the file is sent as the entire body
of the request, i.e. no wrappers are added. This allows arbitrary
bodies to be sent. This functionality is present for POST requests
after version 2.2, and also for PUT requests after version 2.3.
<b>See below for some further information on parameter handling.</b>
</p>
</property>
- <property name="Value for 'name' attribute" required="No">Value of the
"name" web request parameter.</property>
+ <property name="Parameter name:" required="No">Value of the "name" web
request parameter.</property>
<property name="MIME Type" required="No">MIME type (for example,
text/plain).
If it is a POST or PUT request and either the 'name' atribute (below)
are omitted or the request body is
constructed from parameter values only, then the value of this field
is used as the value of the
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]