本文整理汇总了Java中org.apache.jmeter.protocol.http.sampler.HTTPSampleResult类的典型用法代码示例。如果您正苦于以下问题:Java HTTPSampleResult类的具体用法?Java HTTPSampleResult怎么用?Java HTTPSampleResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTTPSampleResult类属于org.apache.jmeter.protocol.http.sampler包,在下文中一共展示了HTTPSampleResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addFormUrls
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
private void addFormUrls(Document html, HTTPSampleResult result, HTTPSamplerBase config,
List<HTTPSamplerBase> potentialLinks) {
NodeList rootList = html.getChildNodes();
List<HTTPSamplerBase> urls = new LinkedList<>();
for (int x = 0; x < rootList.getLength(); x++) {
urls.addAll(HtmlParsingUtils.createURLFromForm(rootList.item(x), result.getURL()));
}
for (HTTPSamplerBase newUrl : urls) {
newUrl.setMethod(HTTPConstants.POST);
if (log.isDebugEnabled()) {
log.debug("Potential Form match: " + newUrl.toString());
}
if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) {
log.debug("Matched!");
potentialLinks.add(newUrl);
}
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:19,代码来源:AnchorModifier.java
示例2: unmarshal
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
HTTPSampleResult res = (HTTPSampleResult) createCollection(context.getRequiredType());
retrieveAttributes(reader, context, res);
while (reader.hasMoreChildren()) {
reader.moveDown();
Object subItem = readItem(reader, context, res);
if (!retrieveItem(reader, context, res, subItem)) {
retrieveHTTPItem(reader, res, subItem);
}
reader.moveUp();
}
// If we have a file, but no data, then read the file
String resultFileName = res.getResultFileName();
if (resultFileName.length()>0
&& res.getResponseData().length == 0) {
readFile(resultFileName,res);
}
return res;
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:23,代码来源:HTTPResultConverter.java
示例3: retrieveHTTPItem
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
private void retrieveHTTPItem(HierarchicalStreamReader reader,
HTTPSampleResult res, Object subItem) {
if (subItem instanceof URL) {
res.setURL((URL) subItem);
} else {
String nodeName = reader.getNodeName();
if (nodeName.equals(TAG_COOKIES)) {
res.setCookies((String) subItem);
} else if (nodeName.equals(TAG_METHOD)) {
res.setHTTPMethod((String) subItem);
} else if (nodeName.equals(TAG_QUERY_STRING)) {
res.setQueryString((String) subItem);
} else if (nodeName.equals(TAG_REDIRECT_LOCATION)) {
res.setRedirectLocation((String) subItem);
}
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:HTTPResultConverter.java
示例4: addFormUrls
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
private void addFormUrls(Document html, HTTPSampleResult result, HTTPSamplerBase config,
List<HTTPSamplerBase> potentialLinks) {
NodeList rootList = html.getChildNodes();
List<HTTPSamplerBase> urls = new LinkedList<HTTPSamplerBase>();
for (int x = 0; x < rootList.getLength(); x++) {
urls.addAll(HtmlParsingUtils.createURLFromForm(rootList.item(x), result.getURL()));
}
for (HTTPSamplerBase newUrl : urls) {
newUrl.setMethod(HTTPConstants.POST);
if (log.isDebugEnabled()) {
log.debug("Potential Form match: " + newUrl.toString());
}
if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) {
log.debug("Matched!");
potentialLinks.add(newUrl);
}
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:19,代码来源:AnchorModifier.java
示例5: testSimpleParse
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleParse() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"index.html\">Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setSamplerData(context.toString());
result.setURL(context.getUrl());
jmctx.setPreviousResult(result);
parser.process();
assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TestAnchorModifier.java
示例6: testSimpleParse1
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleParse1() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
config.setProtocol(HTTPConstants.PROTOCOL_HTTPS);
config.setPort(HTTPConstants.DEFAULT_HTTPS_PORT);
HTTPSamplerBase context = makeContext("https://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"index.html\">Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setSamplerData(context.toString());
result.setURL(context.getUrl());
jmctx.setPreviousResult(result);
parser.process();
assertEquals("https://www.apache.org/subdir/index.html", config.getUrl().toString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:19,代码来源:TestAnchorModifier.java
示例7: testSimpleParse2
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleParse2() throws Exception {
HTTPSamplerBase config = makeUrlConfig("/index\\.html");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"/index.html\">Goto index page</a>" + "hfdfjiudfjdfjkjfkdjf"
+ "<b>bold text</b><a href=lowerdir/index.html>lower</a>" + "</body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
String newUrl = config.getUrl().toString();
assertTrue("http://www.apache.org/index.html".equals(newUrl)
|| "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl));
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:19,代码来源:TestAnchorModifier.java
示例8: testSimpleParse3
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleParse3() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*index.*");
config.getArguments().addArgument("param1", "value1");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
String newUrl = config.getUrl().toString();
assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:18,代码来源:TestAnchorModifier.java
示例9: testSimpleParse4
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleParse4() throws Exception {
HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<A HREF=\"index.html\">Goto index page</A></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
String newUrl = config.getUrl().toString();
assertEquals("http://www.apache.org/subdir/index.html", newUrl);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TestAnchorModifier.java
示例10: testSimpleParse5
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleParse5() throws Exception {
HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"../index.html\">Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
String newUrl = config.getUrl().toString();
assertEquals("http://www.apache.org/subdir/index.html", newUrl);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TestAnchorModifier.java
示例11: testFailSimpleParse1
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testFailSimpleParse1() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
String newUrl = config.getUrl().toString();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
assertEquals(newUrl, config.getUrl().toString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TestAnchorModifier.java
示例12: testFailSimpleParse3
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testFailSimpleParse3() throws Exception {
HTTPSamplerBase config = makeUrlConfig("/home/index.html");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
String newUrl = config.getUrl().toString();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
assertEquals(newUrl + "?param1=value1", config.getUrl().toString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TestAnchorModifier.java
示例13: testFailSimpleParse2
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testFailSimpleParse2() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*login\\.html");
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setPreviousResult(result);
parser.process();
String newUrl = config.getUrl().toString();
assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl));
assertEquals(config.getUrl().toString(), newUrl);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TestAnchorModifier.java
示例14: testSimpleFormParse
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSimpleFormParse() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*index.html");
config.addArgument("test", "g.*");
config.setMethod(HTTPConstants.POST);
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<form action=\"index.html\" method=\"POST\">" + "<input type=\"checkbox\" name=\"test\""
+ " value=\"goto\">Goto index page</form></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
assertEquals("test=goto", config.getQueryString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:TestAnchorModifier.java
示例15: testBadCharParse
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testBadCharParse() throws Exception {
HTTPSamplerBase config = makeUrlConfig(".*index.html");
config.addArgument("te$st", "g.*");
config.setMethod(HTTPConstants.POST);
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<form action=\"index.html\" method=\"POST\">" + "<input type=\"checkbox\" name=\"te$st\""
+ " value=\"goto\">Goto index page</form></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
assertEquals("te%24st=goto", config.getQueryString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:TestAnchorModifier.java
示例16: testSpecialCharParse
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
public void testSpecialCharParse() throws Exception {
String specialChars = "-_.!~*'()%25";// These are some of the special characters
String htmlEncodedFixture = URLEncoder.encode(specialChars, "UTF-8");
HTTPSamplerBase config = makeUrlConfig(".*index.html");
config.addArgument("test", ".*");
config.setMethod(HTTPConstants.POST);
HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
String responseText = "<html><head><title>Test page</title></head><body>"
+ "<form action=\"index.html\" method=\"POST\">" + "<input type=\"hidden\" name=\"test\""
+ " value=\"" + htmlEncodedFixture + "\">Goto index page</form></body></html>";
HTTPSampleResult result = new HTTPSampleResult();
result.setResponseData(responseText, null);
result.setSampleLabel(context.toString());
result.setURL(context.getUrl());
jmctx.setCurrentSampler(context);
jmctx.setCurrentSampler(config);
jmctx.setPreviousResult(result);
parser.process();
assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
assertEquals("test=" + htmlEncodedFixture, config.getQueryString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:TestAnchorModifier.java
示例17: getDataMapForSample
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
private Map<String, Object> getDataMapForSample(SampleResult sample) {
Map<String, Object> data = new HashMap<>();
if(sample instanceof HTTPSampleResult) {
HTTPSampleResult httpSampleResult = (HTTPSampleResult) sample;
data.put("url", httpSampleResult.getUrlAsString());
data.put("httpMethod", httpSampleResult.getHTTPMethod());
data.put("responseCode", httpSampleResult.getResponseCode());
}
return data;
}
开发者ID:denkbar,项目名称:step,代码行数:11,代码来源:SampleListenerImpl.java
示例18: mapSampleAttributesToReturnObject
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
private void mapSampleAttributesToReturnObject(JsonObjectBuilder object, SampleResult sample) {
object.add("label", sample.getSampleLabel());
if(sample instanceof HTTPSampleResult) {
HTTPSampleResult httpSampleResult = (HTTPSampleResult) sample;
object.add("url", httpSampleResult.getUrlAsString());
object.add("method", httpSampleResult.getHTTPMethod());
object.add("responseCode", httpSampleResult.getResponseCode());
}
}
开发者ID:denkbar,项目名称:step,代码行数:10,代码来源:SampleListenerImpl.java
示例19: saveDetails
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
/**
* Save the Last-Modified, Etag, and Expires headers if the result is cacheable.
* Version for Java implementation.
* @param conn connection
* @param res result
*/
public void saveDetails(URLConnection conn, HTTPSampleResult res){
if (isCacheable(res) && !hasVaryHeader(conn)){
String lastModified = conn.getHeaderField(HTTPConstants.LAST_MODIFIED);
String expires = conn.getHeaderField(HTTPConstants.EXPIRES);
String etag = conn.getHeaderField(HTTPConstants.ETAG);
String url = conn.getURL().toString();
String cacheControl = conn.getHeaderField(HTTPConstants.CACHE_CONTROL);
String date = conn.getHeaderField(HTTPConstants.DATE);
setCache(lastModified, cacheControl, expires, etag, url, date);
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:CacheManager.java
示例20: isCacheableMethod
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult; //导入依赖的package包/类
private boolean isCacheableMethod(HTTPSampleResult res) {
final String resMethod = res.getHTTPMethod();
for(String method : CACHEABLE_METHODS) {
if (method.equalsIgnoreCase(resMethod)) {
return true;
}
}
return false;
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:10,代码来源:CacheManager.java
注:本文中的org.apache.jmeter.protocol.http.sampler.HTTPSampleResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论