Search in sources :

Example 1 with TextFile

use of org.apache.jorphan.io.TextFile in project jmeter by apache.

the class TestAnchorModifier method testProcessingHTMLFile.

private void testProcessingHTMLFile(String HTMLFileName) throws Exception {
    File file = new File(System.getProperty("user.dir") + "/testfiles/load_bug_list.jmx");
    HTTPSamplerBase config = (HTTPSamplerBase) SaveService.loadTree(file).getArray()[0];
    config.setRunningVersion(true);
    HTTPSampleResult result = new HTTPSampleResult();
    file = new File(System.getProperty("user.dir") + "/testfiles/Load_JMeter_Page.jmx");
    HTTPSamplerBase context = (HTTPSamplerBase) SaveService.loadTree(file).getArray()[0];
    jmctx.setCurrentSampler(context);
    jmctx.setCurrentSampler(config);
    result.setResponseData(new TextFile(System.getProperty("user.dir") + HTMLFileName).getText(), null);
    result.setSampleLabel(context.toString());
    result.setSamplerData(context.toString());
    result.setURL(new URL("http://bz.apache.org/fakepage.html"));
    jmctx.setPreviousResult(result);
    AnchorModifier modifier = new AnchorModifier();
    modifier.setThreadContext(jmctx);
    modifier.process();
    assertEquals("http://bz.apache.org/bugzilla/buglist.cgi?" + "bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED" + "&email1=&emailtype1=substring&emailassigned_to1=1" + "&email2=&emailtype2=substring&emailreporter2=1" + "&bugidtype=include&bug_id=&changedin=&votes=" + "&chfieldfrom=&chfieldto=Now&chfieldvalue=" + "&product=JMeter&short_desc=&short_desc_type=substring" + "&long_desc=&long_desc_type=substring&bug_file_loc=" + "&bug_file_loc_type=substring&keywords=" + "&keywords_type=anywords" + "&field0-0-0=noop&type0-0-0=noop&value0-0-0=" + "&cmdtype=doit&order=Reuse+same+sort+as+last+time", config.toString());
    config.recoverRunningVersion();
    assertEquals("http://bz.apache.org/bugzilla/buglist.cgi?" + "bug_status=.*&bug_status=.*&bug_status=.*&email1=" + "&emailtype1=substring&emailassigned_to1=1&email2=" + "&emailtype2=substring&emailreporter2=1" + "&bugidtype=include&bug_id=&changedin=&votes=" + "&chfieldfrom=&chfieldto=Now&chfieldvalue=" + "&product=JMeter&short_desc=&short_desc_type=substring" + "&long_desc=&long_desc_type=substring&bug_file_loc=" + "&bug_file_loc_type=substring&keywords=" + "&keywords_type=anywords&field0-0-0=noop" + "&type0-0-0=noop&value0-0-0=&cmdtype=doit" + "&order=Reuse+same+sort+as+last+time", config.toString());
}
Also used : HTTPSampleResult(org.apache.jmeter.protocol.http.sampler.HTTPSampleResult) TextFile(org.apache.jorphan.io.TextFile) TextFile(org.apache.jorphan.io.TextFile) File(java.io.File) URL(java.net.URL) HTTPSamplerBase(org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase)

Aggregations

File (java.io.File)1 URL (java.net.URL)1 HTTPSampleResult (org.apache.jmeter.protocol.http.sampler.HTTPSampleResult)1 HTTPSamplerBase (org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase)1 TextFile (org.apache.jorphan.io.TextFile)1