本文整理汇总了Java中org.apache.jmeter.protocol.http.util.HTTPArgument类的典型用法代码示例。如果您正苦于以下问题:Java HTTPArgument类的具体用法?Java HTTPArgument怎么用?Java HTTPArgument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTTPArgument类属于org.apache.jmeter.protocol.http.util包,在下文中一共展示了HTTPArgument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sampleTest2
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
@Test
public void sampleTest2() throws Exception {
http2Req.testStarted();
Arguments args = new Arguments();
String text = "{\"header\":{\"applicationId\":\"HJS\"},\"initSession\":{}}";
HTTPArgument arg = new HTTPArgument("", text.replaceAll("\n","\r\n"), false);
arg.setAlwaysEncoded(false);
args.addArgument(arg);
http2Req.setProperty(new TestElementProperty(HTTP2Request.ARGUMENTS, args));
URL url = new URL("https", "www.sprint.com", 443, "/apiservices/framework/initSession");
HTTP2Connection connection = Mockito.mock(HTTP2Connection.class);
Mockito.when(connection.isClosed()).thenReturn(true);
Mockito.doNothing().when(connection).connect(Mockito.any(String.class), Mockito.any(Integer.class));
Mockito.when(connection.getConnectionId()).thenReturn("10www.sprint.com443");
HTTP2SampleResult sampleResult =new HTTP2SampleResult(url, "POST");
http2Req.addConnection("10www.sprint.com443", connection);
http2Req.setConnection(url, sampleResult);
http2Req.setProperty(new BooleanProperty(HTTP2Request.SYNCREQUEST, true));
HTTP2SampleResult sample = http2Req.sample(url, "POST", false, 0, http2Req.getConnection(), sampleResult);
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:27,代码来源:HTTP2RequestTest.java
示例2: createPostContentTest
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
@Test
public void createPostContentTest() throws Exception {
String text = "{\"header\":{\"applicationId\":\"HJS\"},\"initSession\":{}}";
DataPostContent dataPostExp = new DataPostContent();
dataPostExp.setDataPath("/apiservices/framework/initSession");
dataPostExp.setPayload(text.getBytes());
Arguments args = new Arguments();
HTTPArgument arg = new HTTPArgument("", text.replaceAll("\n","\r\n"), false);
arg.setAlwaysEncoded(false);
args.addArgument(arg);
http2Req.setProperty(new TestElementProperty(HTTP2Request.ARGUMENTS, args));
http2Req.setProperty(HTTP2Request.PATH, "/apiservices/framework/initSession");
DataPostContent dataPostRes = http2Req.createPostContent("POST");
assertEquals(dataPostExp.getDataPath(), dataPostRes.getDataPath());
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:22,代码来源:HTTP2RequestTest.java
示例3: getSendParameterValuesAsPostBody
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
/**
* Determine if none of the parameters have a name, and if that
* is the case, it means that the parameter values should be sent
* as the entity body
*
* @return true if none of the parameters have a name specified
*/
public boolean getSendParameterValuesAsPostBody() {
if (getPostBodyRaw()) {
return true;
} else {
boolean noArgumentsHasName = true;
PropertyIterator args = getArguments().iterator();
while (args.hasNext()) {
HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
if (arg.getName() != null && arg.getName().length() > 0) {
noArgumentsHasName = false;
break;
}
}
return noArgumentsHasName;
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:24,代码来源:HTTPSamplerBase.java
示例4: modifyTestElement
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
@Override
public void modifyTestElement(TestElement element) {
configureTestElement(element);
element.setProperty(WebSocketSampler.DOMAIN, domain.getText());
element.setProperty(WebSocketSampler.PATH, path.getText());
element.setProperty(WebSocketSampler.PORT, port.getText());
element.setProperty(WebSocketSampler.PROTOCOL, protocol.getText());
element.setProperty(WebSocketSampler.CONTENT_ENCODING, contentEncoding.getText());
Arguments args = (Arguments) argsPanel.createTestElement();
HTTPArgument.convertArgumentsToHTTP(args);
element.setProperty(new TestElementProperty(WebSocketSampler.ARGUMENTS, args));
element.setProperty(WebSocketSampler.SEND_MESSAGE, sendMessage.getText());
element.setProperty(WebSocketSampler.RECV_MESSAGE, recvMessage.getText());
}
开发者ID:kawasima,项目名称:jmeter-websocket,代码行数:17,代码来源:WebSocketSamplerGui.java
示例5: getSendParameterValuesAsPostBody
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
/**
* Determine if none of the parameters have a name, and if that
* is the case, it means that the parameter values should be sent
* as the entity body
*
* @return true if none of the parameters have a name specified
*/
public boolean getSendParameterValuesAsPostBody() {
if(getPostBodyRaw()) {
return true;
} else {
boolean noArgumentsHasName = true;
PropertyIterator args = getArguments().iterator();
while (args.hasNext()) {
HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
if(arg.getName() != null && arg.getName().length() > 0) {
noArgumentsHasName = false;
break;
}
}
return noArgumentsHasName;
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:24,代码来源:HTTPSamplerBase.java
示例6: initializeTableModel
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
@Override
protected void initializeTableModel() {
tableModel = new ObjectTableModel(new String[] {
ArgumentsPanel.COLUMN_RESOURCE_NAMES_0, ArgumentsPanel.COLUMN_RESOURCE_NAMES_1, ENCODE_OR_NOT, INCLUDE_EQUALS },
HTTPArgument.class,
new Functor[] {
new Functor("getName"), //$NON-NLS-1$
new Functor("getValue"), //$NON-NLS-1$
new Functor("isAlwaysEncoded"), //$NON-NLS-1$
new Functor("isUseEquals") }, //$NON-NLS-1$
new Functor[] {
new Functor("setName"), //$NON-NLS-1$
new Functor("setValue"), //$NON-NLS-1$
new Functor("setAlwaysEncoded"), //$NON-NLS-1$
new Functor("setUseEquals") }, //$NON-NLS-1$
new Class[] {String.class, String.class, Boolean.class, Boolean.class });
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:18,代码来源:HTTPArgumentsPanel.java
示例7: checkArgument
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
private void checkArgument(
HTTPArgument arg,
String expectedName,
String expectedValue,
String expectedEncodedValue,
String contentEncoding,
boolean expectedEncoded) throws IOException {
assertEquals(expectedName, arg.getName());
// System.out.println("expect " + URLEncoder.encode(expectedValue, "UTF-8"));
// System.out.println("actual " + URLEncoder.encode(arg.getValue(), "UTF-8"));
assertEquals(expectedValue, arg.getValue());
if(contentEncoding != null && contentEncoding.length() > 0) {
assertEquals(expectedEncodedValue, arg.getEncodedValue(contentEncoding));
}
else {
// Most browsers use ISO-8859-1 as default encoding, even if spec says UTF-8
assertEquals(expectedEncodedValue, arg.getEncodedValue("ISO-8859-1"));
}
assertEquals(expectedEncoded, arg.isAlwaysEncoded());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:21,代码来源:TestHttpRequestHdr.java
示例8: configure
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
private void configure(HTTPSamplerBase sampler) throws Exception {
sampler.addArgument("arg1", "val1");
ConfigTestElement config = (ConfigTestElement) new HttpDefaultsGui().createTestElement();
((Arguments) config.getProperty(HTTPSamplerBase.ARGUMENTS).getObjectValue()).addArgument(new HTTPArgument(
"config1", "configValue"));
config.setRunningVersion(true);
sampler.setRunningVersion(true);
sampler.setRunningVersion(true);
sampler.addTestElement(config);
assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
sampler.recoverRunningVersion();
config.recoverRunningVersion();
assertEquals(1, sampler.getArguments().getArgumentCount());
sampler.addTestElement(config);
assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:PackageTest.java
示例9: computePostBody
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
/**
* Compute body data from arguments
* @param arguments {@link Arguments}
* @param crlfToLF whether to convert CRLF to LF
* @return {@link String}
*/
private static String computePostBody(Arguments arguments, boolean crlfToLF) {
StringBuilder postBody = new StringBuilder();
for (JMeterProperty argument : arguments) {
HTTPArgument arg = (HTTPArgument) argument.getObjectValue();
String value = arg.getValue();
if (crlfToLF) {
value = value.replaceAll("\r\n", "\n"); // See modifyTestElement
}
postBody.append(value);
}
return postBody.toString();
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:19,代码来源:HTTP2RequestPanel.java
示例10: modify
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
private void modify(HTTPSamplerBase sampler, String value) {
if (isPathExtension()) {
if (isPathExtensionNoEquals()) {
sampler.setPath(sampler.getPath() + SEMI_COLON + getArgumentName() + value); // $NON-NLS-1$
} else {
sampler.setPath(sampler.getPath() + SEMI_COLON + getArgumentName() + "=" + value); // $NON-NLS-1$ // $NON-NLS-2$
}
} else {
sampler.getArguments().removeArgument(getArgumentName());
sampler.getArguments().addArgument(new HTTPArgument(getArgumentName(), value, !encode()));
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:13,代码来源:URLRewritingModifier.java
示例11: addNonEncodedArgument
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
/**
* Add a value that is not URL encoded, and make sure it
* appears in the GUI that it will not be encoded when
* the request is sent.
*
* @param name
* @param value
*/
private void addNonEncodedArgument(String name, String value) {
Arguments myArgs = getArguments();
// The value is not encoded
HTTPArgument arg = new HTTPArgument(name, value, false);
// Let the GUI show that it will not be encoded
arg.setAlwaysEncoded(false);
myArgs.addArgument(arg);
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:17,代码来源:MultipartUrlConfig.java
示例12: getTestElement
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
public TestElement getTestElement() {
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(value);
HTTPArgument httpArgument = new HTTPArgument();
httpArgument.setProperty(TestElement.GUI_CLASS, HTTPArgumentsPanel.class.getName().toString());
httpArgument.setProperty(TestElement.TEST_CLASS, HTTPSamplerProxy.class.getName().toString());
httpArgument.setName(name);
httpArgument.setValue(value);
httpArgument.setMetaData(getOptionalValue(metaData, "="));
httpArgument.setUseEquals(getOptionalValue(useEquals, true));
httpArgument.setAlwaysEncoded(getOptionalValue(setAlwaysEncoded, true));
return httpArgument;
}
开发者ID:lithiumtech,项目名称:mineraloil-jmeter,代码行数:15,代码来源:HTTPArgumentElement.java
示例13: getArgumentsElement
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
private Arguments getArgumentsElement(List<HTTPArgument> httpArguments) {
Arguments arguments = new Arguments();
arguments.setProperty(TestElement.GUI_CLASS, HTTPArgumentsPanel.class.getName());
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
arguments.setProperty(TestElement.ENABLED, true);
if (httpArguments != null) {
for (HTTPArgument httpArgument : httpArguments) {
arguments.addArgument(httpArgument);
}
}
return arguments;
}
开发者ID:lithiumtech,项目名称:mineraloil-jmeter,代码行数:13,代码来源:HTTPSamplerElement.java
示例14: addArgument
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
public HTTPSamplerElement addArgument(String name, String value, boolean encode) {
if (arguments == null) arguments = new ArrayList<>();
HTTPArgument argument = (HTTPArgument) HTTPArgumentElement.builder()
.name(name)
.value(value)
.setAlwaysEncoded(encode)
.build()
.getTestElement();
arguments.add(argument);
return this;
}
开发者ID:lithiumtech,项目名称:mineraloil-jmeter,代码行数:12,代码来源:HTTPSamplerElement.java
示例15: modify
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
private void modify(HTTPSamplerBase sampler, String value) {
if (isPathExtension()) {
if (isPathExtensionNoEquals()) {
sampler.setPath(sampler.getPath() + SEMI_COLON + getArgumentName() + value); // $NON-NLS-1$
} else {
sampler.setPath(sampler.getPath() + SEMI_COLON + getArgumentName() + "=" + value); // $NON-NLS-1$ // $NON-NLS-2$
}
} else {
sampler.getArguments().removeArgument(getArgumentName());
sampler.getArguments().addArgument(new HTTPArgument(getArgumentName(), value, true));
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:13,代码来源:URLRewritingModifier.java
示例16: computePostBody
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
/**
* Compute body data from arguments
* @param arguments {@link Arguments}
* @param crlfToLF whether to convert CRLF to LF
* @return {@link String}
*/
private static final String computePostBody(Arguments arguments, boolean crlfToLF) {
StringBuilder postBody = new StringBuilder();
PropertyIterator args = arguments.iterator();
while (args.hasNext()) {
HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
String value = arg.getValue();
if (crlfToLF) {
value=value.replaceAll("\r\n", "\n"); // See modifyTestElement
}
postBody.append(value);
}
return postBody.toString();
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:UrlConfigGui.java
示例17: makeNewArgument
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
@Override
protected HTTPArgument makeNewArgument() {
HTTPArgument arg = new HTTPArgument("", "");
arg.setAlwaysEncoded(false);
arg.setUseEquals(true);
return arg;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:8,代码来源:HTTPArgumentsPanel.java
示例18: getUnclonedParameters
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
private Arguments getUnclonedParameters() {
stopTableEditing();
@SuppressWarnings("unchecked") // only contains Argument (or HTTPArgument)
Iterator<HTTPArgument> modelData = (Iterator<HTTPArgument>) tableModel.iterator();
Arguments args = new Arguments();
while (modelData.hasNext()) {
HTTPArgument arg = modelData.next();
args.addArgument(arg);
}
return args;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:HTTPArgumentsPanel.java
示例19: configure
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
@Override
public void configure(TestElement el) {
super.configure(el);
if (el instanceof Arguments) {
tableModel.clearData();
HTTPArgument.convertArgumentsToHTTP((Arguments) el);
PropertyIterator iter = ((Arguments) el).getArguments().iterator();
while (iter.hasNext()) {
HTTPArgument arg = (HTTPArgument) iter.next().getObjectValue();
tableModel.addRow(arg);
}
}
checkDeleteStatus();
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:15,代码来源:HTTPArgumentsPanel.java
示例20: setupFormData
import org.apache.jmeter.protocol.http.util.HTTPArgument; //导入依赖的package包/类
/**
* Setup the form data with specified values
*
* @param httpSampler
*/
private void setupFormData(HTTPSampler httpSampler, boolean isEncoded, String titleValue, String descriptionValue) {
Arguments args = new Arguments();
HTTPArgument argument1 = new HTTPArgument("title", titleValue, isEncoded);
HTTPArgument argument2 = new HTTPArgument("description", descriptionValue, isEncoded);
args.addArgument(argument1);
args.addArgument(argument2);
httpSampler.setArguments(args);
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:14,代码来源:PostWriterTest.java
注:本文中的org.apache.jmeter.protocol.http.util.HTTPArgument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论