Java Code Examples for org.apache.jmeter.testelement.TestElement#setProperty()

The following examples show how to use org.apache.jmeter.testelement.TestElement#setProperty() . 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: 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 2
Source File: TreeClonerTG.java    From jmeter-debugger with Apache License 2.0 5 votes vote down vote up
private TestElement getAlteredElement(TestElement cloned) {
    boolean isWrappable = !(cloned instanceof TransactionController) && !(cloned instanceof TestFragmentController) && !(cloned instanceof ReplaceableController);

    TestElement userObject = cloned;
    if (!isWrappable) {
        log.debug("Forcing unwrapped: " + cloned);
    } else if (cloned instanceof AbstractThreadGroup) {
        userObject = new DebuggingThreadGroup();
        userObject.setProperty(TestElement.GUI_CLASS, DebuggingThreadGroupGui.class.getCanonicalName());
    } else if (cloned instanceof Controller) {
        userObject = getController(cloned);
    } else if (cloned instanceof PreProcessor) {
        userObject = new PreProcessorDebug();
    } else if (cloned instanceof Timer) {
        userObject = new TimerDebug();
    } else if (cloned instanceof Sampler) {
        userObject = new SamplerDebug();
    } else if (cloned instanceof PostProcessor) {
        userObject = new PostProcessorDebug();
    } else if (cloned instanceof Assertion) {
        userObject = new AssertionDebug();
    } else if (cloned instanceof SampleListener) {
        userObject = new SampleListenerDebug();
    } else {
        log.debug("Keeping element unwrapped: " + cloned);
    }
    return userObject;
}
 
Example 3
Source File: MessageSamplerGui.java    From BotServiceStressToolkit with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void modifyTestElement(TestElement te) {
	te.clear();
	configureTestElement(te);

	te.setProperty(MessageSampler.NUM_OF_EXPECTED_RESPONSES,
			Integer.parseInt(numOfResponsesExpectedTextField.getText()));
	te.setProperty(MessageSampler.MESSAGE_TEXT, messageTextTextArea.getText());
	te.setProperty(MessageSampler.MESSAGE_TEXT_FORMAT, messageTextFormatTextField.getText());
	te.setProperty(MessageSampler.LOCALE, localeTextField.getText());
}
 
Example 4
Source File: MergeResultsGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testConfigure() {
    System.out.println("configure");
    TestElement el = new ResultCollector();
    el.setProperty(new StringProperty(MergeResultsGui.FILENAME,
            "fusionRes.csv"));
    MergeResultsGui instance = new MergeResultsGui();
    instance.modifyTestElement(el);
    instance.configure(el);
}
 
Example 5
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 5 votes vote down vote up
/**
 * set attachmentArgs
 * @param methodArgs the attachmentArgs to set
 */
public static final void setAttachmentArgs(List<MethodArgument> methodArgs, TestElement element) {
    int size = methodArgs == null ? 0 : methodArgs.size();
    element.setProperty(new IntegerProperty(FIELD_DUBBO_ATTACHMENT_ARGS_SIZE, size));
    if (size > 0) {
        for (int i = 1; i <= methodArgs.size(); i++) {
            element.setProperty(new StringProperty(FIELD_DUBBO_ATTACHMENT_ARGS + "_KEY" + i, methodArgs.get(i-1).getParamType()));
            element.setProperty(new StringProperty(FIELD_DUBBO_ATTACHMENT_ARGS + "_VALUE" + i, methodArgs.get(i-1).getParamValue()));
        }
    }
}
 
Example 6
Source File: SynthesisReportGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 * Test of configure method, of class SynthesisReportGui.
 */
@Test
public void testConfigure_NotEmptyFields() {
    System.out.println("configure");
    TestElement c = new CorrectedResultCollector();
    SynthesisReportGui instance = new SynthesisReportGui();
    c.setProperty(CorrectedResultCollector.START_OFFSET, "180");
    c.setProperty(CorrectedResultCollector.END_OFFSET, "360");
    instance.configure(c);
}
 
Example 7
Source File: BotServiceSecurityConfigDefaultsGui.java    From BotServiceStressToolkit with MIT License 5 votes vote down vote up
/**
 * 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 config) {
	config.clear();
	configureTestElement(config);

	log.debug("modifyTestElement(%s)", config.toString());

	if (config instanceof BotServiceSecurityConfig) {
		config.setProperty(BotServiceSecurityConfig.APP_ID, appIdTextField.getText());
		config.setProperty(BotServiceSecurityConfig.CLIENT_SECRET, new String(clientSecretTextField.getPassword()));
	}
}
 
Example 8
Source File: MergeResultsGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testConfigure_NullProperty() {
    System.out.println("configure");
    TestElement el = new ResultCollector();
    el.setProperty(new StringProperty(MergeResultsGui.FILENAME,
            "fusionRes.csv"));
    MergeResultsGui instance = new MergeResultsGui();
    instance.configure(el);
}
 
Example 9
Source File: AggregateReportGui.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@Override
public void modifyTestElement(TestElement c) {
    super.modifyTestElement(c);
    c.setProperty(USE_GROUP_NAME, useGroupName.isSelected(), false);
    c.setProperty(SAVE_HEADERS, saveHeaders.isSelected(), true);
}
 
Example 10
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set connections
 * @param connections the connections to set
 */
public static final void setConnections(String connections, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_CONNECTIONS, StringUtils.trimAllWhitespace(connections)));
}
 
Example 11
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set Registry Protocol
 * @param registryProtocol the protocol to set
 */
public static final void setRegistryProtocol(String registryProtocol, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_REGISTRY_PROTOCOL, StringUtils.trimAllWhitespace(registryProtocol)));
}
 
Example 12
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set cluster
 * @param cluster the cluster to set
 */
public static final void setCluster(String cluster, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_CLUSTER, StringUtils.trimAllWhitespace(cluster)));
}
 
Example 13
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set version
 * @param version the version to set
 */
public static final void setVersion(String version, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_VERSION, StringUtils.trimAllWhitespace(version)));
}
 
Example 14
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set timeout
 * @param timeout the timeout to set
 */
public static final void setTimeout(String timeout, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_TIMEOUT, StringUtils.trimAllWhitespace(timeout)));
}
 
Example 15
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set address
 * @param address the address to set
 */
public static final void setAddress(String address, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_ADDRESS, StringUtils.trimAllWhitespace(address)));
}
 
Example 16
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set RPC protocol
 * @param rpcProtocol the protocol to set
 */
public static final void setRpcProtocol(String rpcProtocol, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_RPC_PROTOCOL, StringUtils.trimAllWhitespace(rpcProtocol)));
}
 
Example 17
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set ConfigCenter namespace
 * @param address the address to set
 */
public static final void setConfigCenterAddress(String address, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_CONFIG_CENTER_ADDRESS, StringUtils.trimAllWhitespace(address)));
}
 
Example 18
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set async
 * @param async the async to set
 */
public static final void setAsync(String async, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_ASYNC, StringUtils.trimAllWhitespace(async)));
}
 
Example 19
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set ConfigCenter namespace
 * @param namespace the namespace to set
 */
public static final void setConfigCenterNamespace(String namespace, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_CONFIG_CENTER_NAMESPACE, StringUtils.trimAllWhitespace(namespace)));
}
 
Example 20
Source File: Constants.java    From jmeter-plugins-for-apache-dubbo with Apache License 2.0 2 votes vote down vote up
/**
 * set Registry timeout
 * @param timeout the group to set
 */
public static final void setRegistryTimeout(String timeout, TestElement element) {
    element.setProperty(new StringProperty(FIELD_DUBBO_REGISTRY_TIMEOUT, StringUtils.trimAllWhitespace(timeout)));
}