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 se...@apache.org on 2005/08/04 23:27:51 UTC
cvs commit: jakarta-jmeter/test/src/org/apache/jmeter/protocol/http/sampler HTTPSamplerTest.java
sebb 2005/08/04 14:27:51
Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
HTTPSampler.java
Added: test/src/org/apache/jmeter/protocol/http/sampler
HTTPSamplerTest.java
Log:
Move test code to test tree
Revision Changes Path
1.102 +0 -121 jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
Index: HTTPSampler.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- HTTPSampler.java 12 Jul 2005 20:50:57 -0000 1.101
+++ HTTPSampler.java 4 Aug 2005 21:27:50 -0000 1.102
@@ -538,125 +538,4 @@
}
}
}
-
- public static class Test extends junit.framework.TestCase {
- public Test(String name) {
- super(name);
- }
-
- public void testArgumentWithoutEquals() throws Exception {
- HTTPSampler sampler = new HTTPSampler();
- sampler.setProtocol("http");
- sampler.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(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 {
- HTTPSampler config = new HTTPSampler();
- config.setProtocol("http");
- config.setMethod(GET);
- config.parseArguments("");
- config.setPath("/index.html");
- config.setDomain("www.apache.org");
- assertEquals("http://www.apache.org/index.html", config.getUrl().toString());
- }
- }
}
1.1 jakarta-jmeter/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerTest.java
Index: HTTPSamplerTest.java
===================================================================
/*
* 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.sampler;
/**
* A sampler which understands all the parts necessary to read statistics about
* HTTP requests, including cookies and authentication.
*
*/
public class HTTPSamplerTest extends junit.framework.TestCase {
public HTTPSamplerTest(String name) {
super(name);
}
public void testArgumentWithoutEquals() throws Exception {
HTTPSampler sampler = new HTTPSampler();
sampler.setProtocol("http");
sampler.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.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 {
HTTPSampler config = new HTTPSampler();
config.setProtocol("http");
config.setMethod(HTTPSampler.GET);
config.parseArguments("");
config.setPath("/index.html");
config.setDomain("www.apache.org");
assertEquals("http://www.apache.org/index.html", config.getUrl().toString());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-jmeter/test/src/org/apache/jmeter/protocol/http/sampler HTTPSamplerTest.java
Posted by sebb <se...@gmail.com>.
In due course, yes, I believe so.
Just thought I'd experiment with those two, as they did not need any
special access to private fields etc, and I was anyway changing one of
them.
S.
On 05/08/05, Peter Lin <wo...@gmail.com> wrote:
> I forget, are we planning on moving all JUnit tests out to the test directory?
>
> peter
>
>
> On 4 Aug 2005 21:27:51 -0000, sebb@apache.org <se...@apache.org> wrote:
> > sebb 2005/08/04 14:27:51
> >
> > Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
> > HTTPSampler.java
> > Added: test/src/org/apache/jmeter/protocol/http/sampler
> > HTTPSamplerTest.java
> > Log:
> > Move test code to test tree
> >
[...]
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-jmeter/test/src/org/apache/jmeter/protocol/http/sampler HTTPSamplerTest.java
Posted by Peter Lin <wo...@gmail.com>.
I forget, are we planning on moving all JUnit tests out to the test directory?
peter
On 4 Aug 2005 21:27:51 -0000, sebb@apache.org <se...@apache.org> wrote:
> sebb 2005/08/04 14:27:51
>
> Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
> HTTPSampler.java
> Added: test/src/org/apache/jmeter/protocol/http/sampler
> HTTPSamplerTest.java
> Log:
> Move test code to test tree
>
> Revision Changes Path
> 1.102 +0 -121 jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
>
> Index: HTTPSampler.java
> ===================================================================
> RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
> retrieving revision 1.101
> retrieving revision 1.102
> diff -u -r1.101 -r1.102
> --- HTTPSampler.java 12 Jul 2005 20:50:57 -0000 1.101
> +++ HTTPSampler.java 4 Aug 2005 21:27:50 -0000 1.102
> @@ -538,125 +538,4 @@
> }
> }
> }
> -
> - public static class Test extends junit.framework.TestCase {
> - public Test(String name) {
> - super(name);
> - }
> -
> - public void testArgumentWithoutEquals() throws Exception {
> - HTTPSampler sampler = new HTTPSampler();
> - sampler.setProtocol("http");
> - sampler.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(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 {
> - HTTPSampler config = new HTTPSampler();
> - config.setProtocol("http");
> - config.setMethod(GET);
> - config.parseArguments("");
> - config.setPath("/index.html");
> - config.setDomain("www.apache.org");
> - assertEquals("http://www.apache.org/index.html", config.getUrl().toString());
> - }
> - }
> }
>
>
>
> 1.1 jakarta-jmeter/test/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerTest.java
>
> Index: HTTPSamplerTest.java
> ===================================================================
> /*
> * 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.sampler;
>
> /**
> * A sampler which understands all the parts necessary to read statistics about
> * HTTP requests, including cookies and authentication.
> *
> */
> public class HTTPSamplerTest extends junit.framework.TestCase {
>
> public HTTPSamplerTest(String name) {
> super(name);
> }
>
> public void testArgumentWithoutEquals() throws Exception {
> HTTPSampler sampler = new HTTPSampler();
> sampler.setProtocol("http");
> sampler.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.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 {
> HTTPSampler config = new HTTPSampler();
> config.setProtocol("http");
> config.setMethod(HTTPSampler.GET);
> config.parseArguments("");
> config.setPath("/index.html");
> config.setDomain("www.apache.org");
> assertEquals("http://www.apache.org/index.html", config.getUrl().toString());
> }
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org