当前位置: 首页>>代码示例>>Java>>正文


Java HTTPSamplerBase.setDomain方法代码示例

本文整理汇总了Java中org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.setDomain方法的典型用法代码示例。如果您正苦于以下问题:Java HTTPSamplerBase.setDomain方法的具体用法?Java HTTPSamplerBase.setDomain怎么用?Java HTTPSamplerBase.setDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase的用法示例。


在下文中一共展示了HTTPSamplerBase.setDomain方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createUrlFromAnchor

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
/**
 * Create a new Sampler based on an HREF string plus a contextual URL
 * object. Given that an HREF string might be of three possible forms, some
 * processing is required.
 */
public static HTTPSamplerBase createUrlFromAnchor(String parsedUrlString, URL context) throws MalformedURLException {
    if (log.isDebugEnabled()) {
        log.debug("Creating URL from Anchor: " + parsedUrlString + ", base: " + context);
    }
    URL url = ConversionUtils.makeRelativeURL(context, parsedUrlString);
    HTTPSamplerBase sampler =HTTPSamplerFactory.newInstance();
    sampler.setDomain(url.getHost());
    sampler.setProtocol(url.getProtocol());
    sampler.setPort(url.getPort());
    sampler.setPath(url.getPath());
    sampler.parseArguments(url.getQuery());

    return sampler;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:HtmlParsingUtils.java

示例2: computeDomain

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
/**
 * Set domain on sampler
 * @param sampler {@link HTTPSamplerBase}
 * @param request {@link HttpRequestHdr}
 */
protected void computeDomain(HTTPSamplerBase sampler, HttpRequestHdr request) {
    sampler.setDomain(request.serverName());
    if (log.isDebugEnabled()) {
        log.debug("Proxy: setting server: " + sampler.getDomain());
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:DefaultSamplerCreator.java

示例3: testSendCookie

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
public void testSendCookie() throws Exception {
    man.add(new Cookie("id", "value", "jakarta.apache.org", "/", false, 9999999999L));
    HTTPSamplerBase sampler = new HTTPNullSampler();
    sampler.setDomain("jakarta.apache.org");
    sampler.setPath("/index.html");
    sampler.setMethod(HTTPConstants.GET);
    assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:9,代码来源:TestCookieManager.java

示例4: testSendCookie2

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
public void testSendCookie2() throws Exception {
    man.add(new Cookie("id", "value", ".apache.org", "/", false, 9999999999L));
    HTTPSamplerBase sampler = new HTTPNullSampler();
    sampler.setDomain("jakarta.apache.org");
    sampler.setPath("/index.html");
    sampler.setMethod(HTTPConstants.GET);
    assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:9,代码来源:TestCookieManager.java

示例5: testIsAnchorMatched

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
public void testIsAnchorMatched() throws Exception {
    HTTPSamplerBase target=new HTTPNullSampler();
    HTTPSamplerBase pattern=new HTTPNullSampler();

    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

    target.setProtocol("http:");
    assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

    pattern.setProtocol(".*");
    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
    
    target.setDomain("a.b.c");
    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));

    pattern.setDomain(".*");
    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
    
    target.setPath("/abc");
    assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));

    pattern.setPath(".*");
    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
    
    target.addArgument("param2", "value2", "=");
    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
    
    pattern.addArgument("param1", ".*", "=");
    assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));
    
    target.addArgument("param1", "value1", "=");
    assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:34,代码来源:TestHtmlParsingUtils.java

示例6: makeContext

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
private HTTPSamplerBase makeContext(String url) throws MalformedURLException {
    URL u = new URL(url);
    HTTPSamplerBase context = new HTTPNullSampler();
    context.setDomain(u.getHost());
    context.setPath(u.getPath());
    context.setPort(u.getPort());
    context.setProtocol(u.getProtocol());
    context.parseArguments(u.getQuery());
    return context;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:TestAnchorModifier.java

示例7: makeUrlConfig

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
private HTTPSamplerBase makeUrlConfig(String path) {
    HTTPSamplerBase config = new HTTPNullSampler();
    config.setDomain("www.apache.org");
    config.setMethod(HTTPConstants.GET);
    config.setPath(path);
    config.setPort(HTTPConstants.DEFAULT_HTTP_PORT);
    config.setProtocol(HTTPConstants.PROTOCOL_HTTP);
    return config;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:10,代码来源:TestAnchorModifier.java

示例8: createSampler

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
private HTTPSamplerBase createSampler() {
    HTTPSamplerBase sampler = new HTTPNullSampler();
    sampler.setDomain("server.com");
    sampler.setPath("index.html");
    sampler.setMethod(HTTPConstants.GET);
    sampler.setProtocol("http");
    return sampler;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:9,代码来源:TestURLRewritingModifier.java

示例9: createUrlFromAnchor

import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入方法依赖的package包/类
/**
 * Create a new Sampler based on an HREF string plus a contextual URL
 * object. Given that an HREF string might be of three possible forms, some
 * processing is required.
 *
 * @param parsedUrlString
 *            the url from the href
 * @param context
 *            the context in which the href was found. This is used to
 *            extract url information that might be missing in
 *            <code>parsedUrlString</code>
 * @return sampler with filled in information about the fully parsed url
 * @throws MalformedURLException
 *             when the given url (<code>parsedUrlString</code> plus
 *             <code>context</code> is malformed)
 */
public static HTTPSamplerBase createUrlFromAnchor(String parsedUrlString, URL context) throws MalformedURLException {
    if (log.isDebugEnabled()) {
        log.debug("Creating URL from Anchor: " + parsedUrlString + ", base: " + context);
    }
    URL url = ConversionUtils.makeRelativeURL(context, parsedUrlString);
    HTTPSamplerBase sampler =HTTPSamplerFactory.newInstance();
    sampler.setDomain(url.getHost());
    sampler.setProtocol(url.getProtocol());
    sampler.setPort(url.getPort());
    sampler.setPath(url.getPath());
    sampler.parseArguments(url.getQuery());

    return sampler;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:31,代码来源:HtmlParsingUtils.java


注:本文中的org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.setDomain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。