本文整理汇总了Java中org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase类的典型用法代码示例。如果您正苦于以下问题:Java HTTPSamplerBase类的具体用法?Java HTTPSamplerBase怎么用?Java HTTPSamplerBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTTPSamplerBase类属于org.apache.jmeter.protocol.http.sampler包,在下文中一共展示了HTTPSamplerBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testAllEncryptionCombinations
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
@Test
public void testAllEncryptionCombinations() throws Exception {
for (String ki : WSSEncryptionPreProcessor.keyIdentifiers) {
for (String ke : WSSEncryptionPreProcessor.keyEncryptionAlgorithms) {
for (String se : WSSEncryptionPreProcessor.symmetricEncryptionAlgorithms) {
for (boolean ek : new boolean[]{true, false}) {
initCertSettings(mod);
mod.setKeyIdentifier(ki);
mod.setKeyEncryptionAlgorithm(ke);
mod.setSymmetricEncryptionAlgorithm(se);
mod.setCreateEncryptedKey(ek);
HTTPSamplerBase sampler = createHTTPSampler();
context.setCurrentSampler(sampler);
mod.process();
String encryptedContent = SamplerPayloadAccessor.getPayload(sampler);
assertThat(encryptedContent, containsString("Type=\"http://www.w3.org/2001/04/xmlenc#Content\""));
assertThat(encryptedContent, containsString(se));
}
}
}
}
}
开发者ID:tilln,项目名称:jmeter-wssecurity,代码行数:23,代码来源:TestWSSEncryptionPreProcessor.java
示例2: testTimestampPrecision
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
@Test
public void testTimestampPrecision() throws Exception {
for (boolean millis : new boolean[]{true, false}) {
mod = new WSSUsernameTokenPreProcessor();
mod.setThreadContext(context);
mod.setPasswordType("Password Digest");
mod.setUsername(USERNAME);
mod.setPassword(PASSWORD);
mod.setAddCreated(true);
mod.setPrecisionInMilliSeconds(millis);
HTTPSamplerBase sampler = createHTTPSampler();
context.setCurrentSampler(sampler);
mod.process();
String content = SamplerPayloadAccessor.getPayload(sampler);
assertThat(content, containsString(":UsernameToken"));
assertTrue(content.matches(
".*:Created>\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d"+(millis ? "\\.\\d\\d\\d" : "")+"\\D+</.*"));
}
}
开发者ID:tilln,项目名称:jmeter-wssecurity,代码行数:20,代码来源:TestWSSUsernameTokenPreProcessor.java
示例3: getCookiesForUrl
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Get array of valid HttpClient cookies for the URL
*
* @param cookiesCP cookies to consider
* @param url the target URL
* @param allowVariableCookie flag whether to allow jmeter variables in cookie values
* @return array of HttpClient cookies
*
*/
org.apache.commons.httpclient.Cookie[] getCookiesForUrl(
CollectionProperty cookiesCP,
URL url,
boolean allowVariableCookie){
org.apache.commons.httpclient.Cookie[] cookies =
new org.apache.commons.httpclient.Cookie[cookiesCP.size()];
int i = 0;
for (JMeterProperty jMeterProperty : cookiesCP) {
Cookie jmcookie = (Cookie) jMeterProperty.getObjectValue();
// Set to running version, to allow function evaluation for the cookie values (bug 28715)
if (allowVariableCookie) {
jmcookie.setRunningVersion(true);
}
cookies[i++] = makeCookie(jmcookie);
if (allowVariableCookie) {
jmcookie.setRunningVersion(false);
}
}
String host = url.getHost();
String protocol = url.getProtocol();
int port= HTTPSamplerBase.getDefaultPort(protocol,url.getPort());
String path = url.getPath();
boolean secure = HTTPSamplerBase.isSecure(protocol);
return cookieSpec.match(host, port, path, secure, cookies);
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:35,代码来源:HC3CookieHandler.java
示例4: addFormUrls
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的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
示例5: initilizeElement
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
@Override
public TestElement initilizeElement() {
AjpSampler ele = new AjpSampler();
this.baseElement(ele, "AJP/1.3 Sampler");
ArgumentsInitializer initer = new ArgumentsInitializer();
ele.setArguments((Arguments) initer.initilizeElement());
ele.setFollowRedirects(true);
ele.setMethod(HTTPSamplerBase.GET);
ele.setDoMultipartPost(false);
ele.setContentEncoding(EMPTY_STRING);
ele.setDomain(EMPTY_STRING);
ele.setEmbeddedUrlRE(EMPTY_STRING);
ele.setPath(EMPTY_STRING);
ele.setAutoRedirects(false);
ele.setFollowRedirects(true);
ele.setUseKeepAlive(true);
ele.setPort(80);
ele.setProtocol(EMPTY_STRING);
return ele;
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:24,代码来源:AjpSamplerInitializer.java
示例6: placeAndProcessTestElements
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
private void placeAndProcessTestElements(HashTree hashTree, List<TestElement> samples)
{
for (TestElement element : samples)
{
List<TestElement> descendants = findAndRemoveHeaderManagers(element);
HashTree parent = hashTree.add(element);
descendants.forEach(parent::add);
if (element instanceof HTTPSamplerBase)
{
HTTPSamplerBase http = (HTTPSamplerBase)element;
LOG.info("Start sampler processing");
scriptProcessor.processScenario(http, parent, vars, this);
LOG.info("Stop sampler processing");
}
}
}
开发者ID:d0k1,项目名称:jsflight,代码行数:19,代码来源:JMeterRecorder.java
示例7: extractAppropriateTestElements
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
private List<TestElement> extractAppropriateTestElements(RecordingController recordingController)
{
List<TestElement> samples = new ArrayList<>();
for (TestElement sample; (sample = recordingController.next()) != null;)
{
// skip unknown nasty requests
if (sample instanceof HTTPSamplerBase)
{
HTTPSamplerBase http = (HTTPSamplerBase)sample;
if (http.getArguments().getArgumentCount() > 0
&& http.getArguments().getArgument(0).getValue().startsWith("0Q0O0M0K0I0"))
{
continue;
}
}
samples.add(sample);
}
Collections.sort(samples, (o1, o2) -> {
String num1 = o1.getName().split(" ")[0];
String num2 = o2.getName().split(" ")[0];
return ((Integer)Integer.parseInt(num1)).compareTo(Integer.parseInt(num2));
});
return samples;
}
开发者ID:d0k1,项目名称:jsflight,代码行数:27,代码来源:JMeterRecorder.java
示例8: processScenario
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Post process every stored request just before it get saved to disk
*
* @param sampler recorded http-request (sampler)
* @param tree HashTree (XML like data structure) that represents exact recorded sampler
*/
public void processScenario(HTTPSamplerBase sampler, HashTree tree, Arguments userVariables, JMeterRecorder recorder)
{
Binding binding = new Binding();
binding.setVariable(ScriptBindingConstants.LOGGER, LOG);
binding.setVariable(ScriptBindingConstants.SAMPLER, sampler);
binding.setVariable(ScriptBindingConstants.TREE, tree);
binding.setVariable(ScriptBindingConstants.CONTEXT, recorder.getContext());
binding.setVariable(ScriptBindingConstants.JSFLIGHT, JMeterJSFlightBridge.getInstance());
binding.setVariable(ScriptBindingConstants.USER_VARIABLES, userVariables);
binding.setVariable(ScriptBindingConstants.CLASSLOADER, classLoader);
Script compiledProcessScript = ScriptEngine.getScript(getScenarioProcessorScript());
if (compiledProcessScript == null)
{
return;
}
compiledProcessScript.setBinding(binding);
LOG.info("Run compiled script");
try {
compiledProcessScript.run();
} catch (Throwable throwable) {
LOG.error(throwable.getMessage(), throwable);
}
}
开发者ID:d0k1,项目名称:jsflight,代码行数:31,代码来源:JMeterScriptProcessor.java
示例9: modifyTestElement
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
public void modifyTestElement(TestElement sampler) {
sampler.clear();
oauthConfigGui.modifyTestElement(sampler);
urlConfigGui.modifyTestElement(sampler);
final HTTPSamplerBase samplerBase = (HTTPSamplerBase) sampler;
if (getImages.isSelected()) {
samplerBase.setImageParser(true);
} else {
// The default is false, so we can remove the property to simplify JMX files
// This also allows HTTPDefaults to work for this checkbox
sampler.removeProperty(HTTPSamplerBase.IMAGE_PARSER);
}
samplerBase.setMonitor(isMon.isSelected());
samplerBase.setMD5(useMD5.isSelected());
samplerBase.setEmbeddedUrlRE(embeddedRE.getText());
this.configureTestElement(sampler);
}
开发者ID:groovenauts,项目名称:jmeter_oauth_plugin,代码行数:23,代码来源:OAuthSamplerGui.java
示例10: getCookiesForUrl
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Get array of valid HttpClient cookies for the URL
*
* @param url the target URL
* @return array of HttpClient cookies
*
*/
org.apache.commons.httpclient.Cookie[] getCookiesForUrl(
CollectionProperty cookiesCP,
URL url,
boolean allowVariableCookie){
org.apache.commons.httpclient.Cookie cookies[]=
new org.apache.commons.httpclient.Cookie[cookiesCP.size()];
int i=0;
for (PropertyIterator iter = cookiesCP.iterator(); iter.hasNext();) {
Cookie jmcookie = (Cookie) iter.next().getObjectValue();
// Set to running version, to allow function evaluation for the cookie values (bug 28715)
if (allowVariableCookie) {
jmcookie.setRunningVersion(true);
}
cookies[i++] = makeCookie(jmcookie);
if (allowVariableCookie) {
jmcookie.setRunningVersion(false);
}
}
String host = url.getHost();
String protocol = url.getProtocol();
int port= HTTPSamplerBase.getDefaultPort(protocol,url.getPort());
String path = url.getPath();
boolean secure = HTTPSamplerBase.isSecure(protocol);
return cookieSpec.match(host, port, path, secure, cookies);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:33,代码来源:HC3CookieHandler.java
示例11: modifyTestElement
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
@Override
public void modifyTestElement(TestElement s) {
WebServiceSampler sampler = (WebServiceSampler) s;
this.configureTestElement(sampler);
sampler.setDomain(domain.getText());
sampler.setProperty(HTTPSamplerBase.PORT,port.getText());
sampler.setProtocol(protocol.getText());
sampler.setPath(path.getText());
sampler.setWsdlURL(wsdlField.getText());
sampler.setMethod(HTTPConstants.POST);
sampler.setSoapAction(soapAction.getText());
sampler.setMaintainSession(maintainSession.isSelected());
sampler.setXmlData(soapXml.getText());
sampler.setXmlFile(soapXmlFile.getFilename());
sampler.setXmlPathLoc(randomXmlFile.getText());
sampler.setTimeout(connectTimeout.getText());
sampler.setMemoryCache(memCache.isSelected());
sampler.setReadResponse(readResponse.isSelected());
sampler.setUseProxy(useProxy.isSelected());
sampler.setProxyHost(proxyHost.getText());
sampler.setProxyPort(proxyPort.getText());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:28,代码来源:WebServiceSamplerGui.java
示例12: configure
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void configure(TestElement element) {
super.configure(element);
final HTTPSamplerBase samplerBase = (HTTPSamplerBase) element;
urlConfigGui.configure(element);
getImages.setSelected(samplerBase.isImageParser());
concurrentDwn.setSelected(samplerBase.isConcurrentDwn());
concurrentPool.setText(samplerBase.getConcurrentPool());
isMon.setSelected(samplerBase.isMonitor());
useMD5.setSelected(samplerBase.useMD5());
embeddedRE.setText(samplerBase.getEmbeddedUrlRE());
if (!isAJP) {
sourceIpAddr.setText(samplerBase.getIpSource());
sourceIpType.setSelectedIndex(samplerBase.getIpSourceType());
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:HttpTestSampleGui.java
示例13: modifyTestElement
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Modifies a given TestElement to mirror the data in the gui components.
* <p>
* {@inheritDoc}
*/
@Override
public void modifyTestElement(TestElement sampler) {
sampler.clear();
urlConfigGui.modifyTestElement(sampler);
final HTTPSamplerBase samplerBase = (HTTPSamplerBase) sampler;
samplerBase.setImageParser(getImages.isSelected());
enableConcurrentDwn(getImages.isSelected());
samplerBase.setConcurrentDwn(concurrentDwn.isSelected());
samplerBase.setConcurrentPool(concurrentPool.getText());
samplerBase.setMonitor(isMon.isSelected());
samplerBase.setMD5(useMD5.isSelected());
samplerBase.setEmbeddedUrlRE(embeddedRE.getText());
if (!isAJP) {
samplerBase.setIpSource(sourceIpAddr.getText());
samplerBase.setIpSourceType(sourceIpType.getSelectedIndex());
}
this.configureTestElement(sampler);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:HttpTestSampleGui.java
示例14: createSourceAddrPanel
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
protected JPanel createSourceAddrPanel() {
final JPanel sourceAddrPanel = new HorizontalPanel();
sourceAddrPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils
.getResString("web_testing_source_ip"))); // $NON-NLS-1$
if (!isAJP) {
// Add a new field source ip address (for HC implementations only)
sourceIpType.setSelectedIndex(HTTPSamplerBase.SourceType.HOSTNAME.ordinal()); //default: IP/Hostname
sourceIpType.setFont(FONT_VERY_SMALL);
sourceAddrPanel.add(sourceIpType);
sourceIpAddr = new JTextField();
sourceAddrPanel.add(sourceIpAddr);
}
return sourceAddrPanel;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:HttpTestSampleGui.java
示例15: clearGui
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void clearGui() {
super.clearGui();
getImages.setSelected(false);
concurrentDwn.setSelected(false);
concurrentPool.setText(String.valueOf(HTTPSamplerBase.CONCURRENT_POOL_SIZE));
enableConcurrentDwn(false);
isMon.setSelected(false);
useMD5.setSelected(false);
urlConfigGui.clear();
embeddedRE.setText(""); // $NON-NLS-1$
if (!isAJP) {
sourceIpAddr.setText(""); // $NON-NLS-1$
sourceIpType.setSelectedIndex(HTTPSamplerBase.SourceType.HOSTNAME.ordinal()); //default: IP/Hostname
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:HttpTestSampleGui.java
示例16: addFormUrls
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的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
示例17: filterUrl
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
boolean filterUrl(HTTPSamplerBase sampler) {
String domain = sampler.getDomain();
if (domain == null || domain.length() == 0) {
return false;
}
String url = generateMatchUrl(sampler);
CollectionProperty includePatterns = getIncludePatterns();
if (includePatterns.size() > 0) {
if (!matchesPatterns(url, includePatterns)) {
return false;
}
}
CollectionProperty excludePatterns = getExcludePatterns();
if (excludePatterns.size() > 0) {
if (matchesPatterns(url, excludePatterns)) {
return false;
}
}
return true;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:ProxyControl.java
示例18: serverPort
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* Find the :PORT from http://server.ect:PORT/some/file.xxx
*
* @return server's port (or UNSPECIFIED if not found)
*/
public int serverPort() {
String str = url;
// chop to "server.name:x/thing"
int i = str.indexOf("//");
if (i > 0) {
str = str.substring(i + 2);
}
// chop to server.name:xx
i = str.indexOf('/');
if (0 < i) {
str = str.substring(0, i);
}
// chop to server.name
i = str.lastIndexOf(':');
if (0 < i) {
return Integer.parseInt(str.substring(i + 1).trim());
}
return HTTPSamplerBase.UNSPECIFIED_PORT;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:25,代码来源:HttpRequestHdr.java
示例19: getProtocol
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
* @param sampler {@link HTTPSamplerBase}
* @return String Protocol (http or https)
*/
public String getProtocol(HTTPSamplerBase sampler) {
if (url.indexOf("//") > -1) {
String protocol = url.substring(0, url.indexOf(':'));
if (log.isDebugEnabled()) {
log.debug("Proxy: setting protocol to : " + protocol);
}
return protocol;
} else if (sampler.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT) {
if (log.isDebugEnabled()) {
log.debug("Proxy: setting protocol to https");
}
return HTTPS;
} else {
if (log.isDebugEnabled()) {
log.debug("Proxy setting default protocol to: http");
}
return HTTP;
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:HttpRequestHdr.java
示例20: createSampler
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; //导入依赖的package包/类
/**
*
* @see org.apache.jmeter.protocol.http.proxy.SamplerCreator#createSampler(org.apache.jmeter.protocol.http.proxy.HttpRequestHdr, java.util.Map, java.util.Map)
*/
@Override
public HTTPSamplerBase createSampler(HttpRequestHdr request,
Map<String, String> pageEncodings, Map<String, String> formEncodings) {
// Instantiate the sampler
HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance(request.getHttpSamplerName());
sampler.setProperty(TestElement.GUI_CLASS, HttpTestSampleGui.class.getName());
// Defaults
sampler.setFollowRedirects(false);
sampler.setUseKeepAlive(true);
if (log.isDebugEnabled()) {
log.debug("getSampler: sampler path = " + sampler.getPath());
}
return sampler;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:22,代码来源:DefaultSamplerCreator.java
注:本文中的org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论