/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * Licensed 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.proxy;

import org.apache.jmeter.junit.JMeterTestCase;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;

public class TestHttpRequestHdr  extends JMeterTestCase {
		public TestHttpRequestHdr(String name) {
			super(name);
		}

		public void setUp() {
		}

		public void testRepeatedArguments() throws Exception {
			String TEST_REQ = 
                "GET http://localhost/matrix.html?" 
                + "update=yes&d=1&d=2&d=&d=&d=&d=&d=&d=1&d=2&d=1&d="
					+ "&d= HTTP/1.0\n\n";
			HttpRequestHdr req = new HttpRequestHdr();
			req.parse(new java.io.ByteArrayInputStream(TEST_REQ.getBytes()));
			HTTPSamplerBase s = req.getSampler();
			assertEquals(13,s.getArguments().getArguments().size());
		}
}

@@ -664,16 +664,59 @@
 proxy;%0A%0A
+import org.apache.jmeter.config.Arguments;%0A
 import o
@@ -817,16 +817,189 @@
 lerBase;
+%0Aimport org.apache.jmeter.testelement.property.JMeterProperty;%0Aimport org.apache.jmeter.testelement.property.PropertyIterator;%0Aimport org.apache.log.output.jms.PropertyInfo;
 %0A%0Apublic
@@ -1275,9 +1275,8 @@
 html
-?
 %22 %0A 
@@ -1293,16 +1293,17 @@
      + %22
+?
 update=y
@@ -1346,22 +1346,33 @@
 1&d=
-%22%0A%09%09%09%09%09+ %22&d= 
+&d= %22%0A                + %22
 HTTP
@@ -1602,10 +1602,1004 @@
 ));%0A%09%09%7D%0A
+        %0A        // TODO: will need changing if arguments can be saved in decoded form %0A        public void testEncodedArguments() throws Exception %7B%0A            String TEST_REQ = %0A                %22GET http://localhost:80/matrix.html%22%0A                + %22?abc%22%0A                + %22?SPACE=a+b%22%0A                +%22&space=a%2520b%22%0A                +%22&query=What?%22%0A                + %22 HTTP/1.1%5Cn%5Cn%22;%0A            HttpRequestHdr req = new HttpRequestHdr();%0A            req.parse(new java.io.ByteArrayInputStream(TEST_REQ.getBytes()));%0A            Arguments arguments = req.getSampler().getArguments();%0A            assertEquals(3,arguments.getArguments().size());%0A            PropertyIterator pi= arguments.iterator();%0A            JMeterProperty next;%0A            next = pi.next(); assertEquals(%22abc?SPACE=a+b%22,next.getStringValue());%0A            next = pi.next(); assertEquals(%22space=a%2520b%22,next.getStringValue());%0A            next = pi.next(); assertEquals(%22query=What?%22,next.getStringValue());%0A        %7D%0A
 %7D%0A

Add encoding test