Author: sebb
Date: Thu Dec 16 02:31:27 2010
New Revision: 1049769
URL: http://svn.apache.org/viewvc?rev=1049769&view=rev
Log:
Add tests for HC4
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java
(with props)
Modified:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Added:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java?rev=1049769&view=auto
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java
(added)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java
Thu Dec 16 02:31:27 2010
@@ -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 org.apache.jmeter.samplers.Interruptible;
+
+/**
+ * A sampler which understands all the parts necessary to read statistics about
+ * HTTP requests, including cookies and authentication.
+ * This sampler uses the Apache HttpClient implementation
+ */
+class HTTPSampler3 extends HTTPSamplerBase implements Interruptible {
+
+ private static final long serialVersionUID = 241L;
+
+ private final transient HTTPHC4Impl hc;
+
+ public HTTPSampler3(){
+ hc = new HTTPHC4Impl(this);
+ }
+
+ public boolean interrupt() {
+ return hc.interrupt();
+ }
+
+ @Override
+ protected HTTPSampleResult sample(java.net.URL u, String method,
+ boolean areFollowingRedirect, int depth) {
+ return hc.sample(u, method, areFollowingRedirect, depth);
+ }
+}
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler3.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java?rev=1049769&r1=1049768&r2=1049769&view=diff
==============================================================================
---
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
(original)
+++
jakarta/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Thu Dec 16 02:31:27 2010
@@ -57,6 +57,7 @@ import junit.extensions.TestSetup;
public class TestHTTPSamplersAgainstHttpMirrorServer extends JMeterTestCase {
private final static int HTTP_SAMPLER = 0;
private final static int HTTP_SAMPLER2 = 1;
+ private final static int HTTP_SAMPLER3 = 2;
/** The encodings used for http headers and control information */
private final static String ISO_8859_1 = "ISO-8859-1"; // $NON-NLS-1$
@@ -110,6 +111,10 @@ public class TestHTTPSamplersAgainstHttp
testPostRequest_UrlEncoded(HTTP_SAMPLER2, US_ASCII);
}
+ public void testPostRequest_UrlEncoded3() throws Exception {
+ testPostRequest_UrlEncoded(HTTP_SAMPLER3, US_ASCII);
+ }
+
public void testPostRequest_FormMultipart() throws Exception {
testPostRequest_FormMultipart(HTTP_SAMPLER, ISO_8859_1);
}
@@ -118,6 +123,10 @@ public class TestHTTPSamplersAgainstHttp
testPostRequest_FormMultipart(HTTP_SAMPLER2, US_ASCII);
}
+ public void testPostRequest_FormMultipart3() throws Exception {
+ testPostRequest_FormMultipart(HTTP_SAMPLER3, US_ASCII);
+ }
+
public void testPostRequest_FileUpload() throws Exception {
testPostRequest_FileUpload(HTTP_SAMPLER, ISO_8859_1);
}
@@ -126,6 +135,10 @@ public class TestHTTPSamplersAgainstHttp
testPostRequest_FileUpload(HTTP_SAMPLER2, US_ASCII);
}
+ public void testPostRequest_FileUpload3() throws Exception {
+ testPostRequest_FileUpload(HTTP_SAMPLER3, US_ASCII);
+ }
+
public void testPostRequest_BodyFromParameterValues() throws Exception {
testPostRequest_BodyFromParameterValues(HTTP_SAMPLER, ISO_8859_1);
}
@@ -134,6 +147,10 @@ public class TestHTTPSamplersAgainstHttp
testPostRequest_BodyFromParameterValues(HTTP_SAMPLER2, US_ASCII);
}
+ public void testPostRequest_BodyFromParameterValues3() throws Exception {
+ testPostRequest_BodyFromParameterValues(HTTP_SAMPLER3, US_ASCII);
+ }
+
public void testGetRequest() throws Exception {
testGetRequest(HTTP_SAMPLER);
}
@@ -142,6 +159,10 @@ public class TestHTTPSamplersAgainstHttp
testGetRequest(HTTP_SAMPLER2);
}
+ public void testGetRequest3() throws Exception {
+ testGetRequest(HTTP_SAMPLER3);
+ }
+
public void testGetRequest_Parameters() throws Exception {
testGetRequest_Parameters(HTTP_SAMPLER);
}
@@ -150,6 +171,10 @@ public class TestHTTPSamplersAgainstHttp
testGetRequest_Parameters(HTTP_SAMPLER2);
}
+ public void testGetRequest_Parameters3() throws Exception {
+ testGetRequest_Parameters(HTTP_SAMPLER3);
+ }
+
private void testPostRequest_UrlEncoded(int samplerType, String
samplerDefaultEncoding) throws Exception {
String titleField = "title";
String titleValue = "mytitle";
@@ -1322,11 +1347,14 @@ public class TestHTTPSamplersAgainstHttp
}
private HTTPSamplerBase createHttpSampler(int samplerType) {
- if(samplerType == HTTP_SAMPLER2) {
- return new HTTPSampler2();
- }
- else {
- return new HTTPSampler();
+ switch(samplerType) {
+ case HTTP_SAMPLER:
+ return new HTTPSampler();
+ case HTTP_SAMPLER2:
+ return new HTTPSampler2();
+ case HTTP_SAMPLER3:
+ return new HTTPSampler3();
}
+ throw new IllegalArgumentException("Unexpected type: "+samplerType);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]