use of org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui in project jmeter by apache.
the class TestCacheManagerThreadIteration method testJmeterVariableCacheWhenThreadIterationIsANewUser.
@Test
public void testJmeterVariableCacheWhenThreadIterationIsANewUser() {
jmvars.putObject(SAME_USER, true);
jmctx.setVariables(jmvars);
HTTPSamplerBase sampler = (HTTPSamplerBase) new HttpTestSampleGui().createTestElement();
cacheManager.setControlledByThread(true);
sampler.setCacheManager(cacheManager);
sampler.setThreadContext(jmctx);
boolean res = (boolean) cacheManager.getThreadContext().getVariables().getObject(SAME_USER);
assertTrue("When test different user on the different iternation, the cache should be cleared", res);
}
use of org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui in project jmeter by apache.
the class TestHTTPHC4Impl method testFileargWithMimeTypeWithCharset.
@Test
void testFileargWithMimeTypeWithCharset() throws Exception {
HTTPSamplerBase sampler = (HTTPSamplerBase) new HttpTestSampleGui().createTestElement();
sampler.setThreadContext(jmctx);
sampler.setDoMultipart(true);
HttpEntityEnclosingRequestBase post = new HttpPost();
HTTPFileArg fileArg = new HTTPFileArg();
fileArg.setMimeType("text/html; charset=utf-8");
fileArg.setName("somefile.html");
fileArg.setParamName("upload");
File dummyFile = File.createTempFile("somefile", ".html");
dummyFile.deleteOnExit();
fileArg.setPath(dummyFile.getAbsolutePath());
sampler.setHTTPFiles(Collections.singletonList(fileArg).toArray(new HTTPFileArg[1]));
HTTPHC4Impl hc = new HTTPHC4Impl(sampler);
String requestData = hc.setupHttpEntityEnclosingRequestData(post);
assertTrue(requestData.contains("charset=utf-8"));
}
Aggregations