org.apache.jmeter.protocol.http.util.HTTPArgument Java Examples

The following examples show how to use org.apache.jmeter.protocol.http.util.HTTPArgument. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JmxRawBodyBuilder.java    From postman2jmx with MIT License 6 votes vote down vote up
@Override
public HTTPSamplerProxy buildJmxBody(PostmanItem postmanItem)  {

    HTTPSamplerProxy httpSamplerProxy = JmxHTTPSamplerProxy.newInstance(postmanItem);

    if ("post".equalsIgnoreCase(httpSamplerProxy.getMethod())) {
        httpSamplerProxy.setPostBodyRaw(true);
        Arguments arguments = new Arguments();
        PostmanRawBody raw = postmanItem.getRequest().getBody().getRaw();

        if (raw.getValue() != null && !raw.getValue().isEmpty()) {
            HTTPArgument argument = new HTTPArgument();
            argument.setEnabled(true);
            argument.setAlwaysEncoded(false);
            argument.setMetaData("=");
            argument.setValue(raw.getValue());
            arguments.addArgument(argument);
        }
        httpSamplerProxy.setArguments(arguments);
    }

    return httpSamplerProxy;
}
 
Example #2
Source File: WebSocketSamplerGui.java    From jmeter-websocket with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #3
Source File: WebSocketSampler.java    From jmeter-websocket with Apache License 2.0 4 votes vote down vote up
public void addNonEncodedArgument(String name, String value, String metadata) {
    HTTPArgument arg = new HTTPArgument(name, value, metadata, false);
    arg.setAlwaysEncoded(false);
    this.getArguments().addArgument(arg);
}
 
Example #4
Source File: WebSocketSampler.java    From jmeter-websocket with Apache License 2.0 4 votes vote down vote up
public void addArgument(String name, String value) {
    this.getArguments().addArgument(new HTTPArgument(name, value));
}
 
Example #5
Source File: WebSocketSampler.java    From jmeter-websocket with Apache License 2.0 4 votes vote down vote up
public void addArgument(String name, String value, String metadata) {
    this.getArguments().addArgument(new HTTPArgument(name, value, metadata));
}