use of org.apache.jmeter.protocol.http.control.HttpMirrorServer in project jmeter by apache.
the class TestHTTPSamplersAgainstHttpMirrorServer method suite.
// This is used to emulate @before class and @after class
public static Test suite() {
final TestSuite testSuite = new TestSuite(TestHTTPSamplersAgainstHttpMirrorServer.class);
// Add parameterised tests. For simplicity we assume each has cases 0-10
for (int i = 0; i < 11; i++) {
testSuite.addTest(new TestHTTPSamplersAgainstHttpMirrorServer("itemised_testGetRequest_Parameters", i));
testSuite.addTest(new TestHTTPSamplersAgainstHttpMirrorServer("itemised_testGetRequest_Parameters3", i));
testSuite.addTest(new TestHTTPSamplersAgainstHttpMirrorServer("itemised_testPostRequest_UrlEncoded", i));
testSuite.addTest(new TestHTTPSamplersAgainstHttpMirrorServer("itemised_testPostRequest_UrlEncoded3", i));
}
TestSetup setup = new TestSetup(testSuite) {
private HttpMirrorServer httpServer;
@Override
protected void setUp() throws Exception {
httpServer = TestHTTPMirrorThread.startHttpMirror(MIRROR_PORT);
// Create the test file content
TEST_FILE_CONTENT = "some foo content &?=01234+56789-|⪡♪œ₡ĕͤÅ⁒쎅%C3%85".getBytes("UTF-8");
// create a temporary file to make sure we always have a file to give to the PostWriter
// Whereever we are or Whatever the current path is.
temporaryFile = File.createTempFile("TestHTTPSamplersAgainstHttpMirrorServer", "tmp");
OutputStream output = new FileOutputStream(temporaryFile);
output.write(TEST_FILE_CONTENT);
output.flush();
output.close();
}
@Override
protected void tearDown() throws Exception {
// Shutdown mirror server
httpServer.stopServer();
httpServer = null;
// delete temporay file
if (!temporaryFile.delete()) {
Assert.fail("Could not delete file:" + temporaryFile.getAbsolutePath());
}
}
};
return setup;
}
Aggregations