private JPanel getRequestPanel() { body = new JLabeledTextArea("Body"); headers = new JLabeledTextArea("Headers"); VerticalPanel panel = new VerticalPanel(); panel.add(headers, BorderLayout.NORTH); panel.add(body, BorderLayout.CENTER); return panel; }
@Override public void clearGui() { super.clearGui(); jsonPath.setText("$."); jsonValue.setText(""); jsonValidation.setSelected(false); expectNull.setSelected(false); invert.setSelected(false); isRegex.setSelected(true); inputJSON.setSelected(true); }
@Override public void stateChanged(ChangeEvent e) { jsonValue.setEnabled(jsonValidation.isSelected() && !expectNull.isSelected()); } }
/** * Initialises all of the components on this panel. */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) setLayout(new BorderLayout()); mTextArea.setRows(4); mTextArea.setLineWrap(true); mTextArea.setWrapStyleWord(true); // Register the handler for focus listening. This handler will // only notify the registered when the text changes from when // the focus is gained to when it is lost. mTextArea.addFocusListener(this); // Add the sub components this.add(mLabel, BorderLayout.NORTH); this.add(new JScrollPane(mTextArea), BorderLayout.CENTER); }
@Override public void modifyTestElement(TestElement element) { super.configureTestElement(element); if (element instanceof JSONPathAssertion) { JSONPathAssertion jpAssertion = (JSONPathAssertion) element; jpAssertion.setJsonPath(jsonPath.getText()); jpAssertion.setExpectedValue(jsonValue.getText()); jpAssertion.setJsonValidationBool(jsonValidation.isSelected()); jpAssertion.setExpectNull(expectNull.isSelected()); jpAssertion.setInvert(invert.isSelected()); } }
/** * Constructs a new component with the label displaying the passed text. * * @param pLabel * The text to display in the label. * @param docModel the document for the text area */ public JLabeledTextArea(String pLabel, Document docModel) { super(); mTextArea = new JTextArea(); mLabel = new JLabel(pLabel); init(); if (docModel != null) { mTextArea.setDocument(docModel); } }
@Override public void modifyTestElement(TestElement element) { super.configureTestElement(element); if (element instanceof JSONPathAssertion) { JSONPathAssertion jpAssertion = (JSONPathAssertion) element; jpAssertion.setJsonPath(jsonPath.getText()); jpAssertion.setExpectedValue(jsonValue.getText()); jpAssertion.setJsonValidationBool(jsonValidation.isSelected()); jpAssertion.setExpectNull(expectNull.isSelected()); jpAssertion.setInvert(invert.isSelected()); jpAssertion.setIsRegex(isRegex.isSelected()); } }
@Override public void clearGui() { super.clearGui(); jsonPath.setText("$."); jsonValue.setText(""); jsonValidation.setSelected(false); expectNull.setSelected(false); invert.setSelected(false); isRegex.setSelected(true); }
private JPanel getRequestPanel() { body = new JLabeledTextArea("Body"); headers = new JLabeledTextArea("Headers"); VerticalPanel panel = new VerticalPanel(); panel.add(headers, BorderLayout.NORTH); panel.add(body, BorderLayout.CENTER); return panel; }
@Override public void modifyTestElement(final TestElement testElement) { super.configureTestElement(testElement); final HonoCommanderSampler sampler = (HonoCommanderSampler) testElement; sampler.modifyServerOptions(honoServerOptions); sampler.setReconnectAttempts(reconnectAttempts.getText()); sampler.setTenant(tenant.getText()); sampler.setCommandTimeout(commandTimeOut.getText()); sampler.setCommand(command.getText()); sampler.setCommandPayload(commandPayload.getText()); sampler.setTriggerType(((String) triggerType.getSelectedItem())); }
@Override public void stateChanged(ChangeEvent e) { jsonValue.setEnabled(jsonValidation.isSelected() && !expectNull.isSelected()); isRegex.setEnabled(jsonValidation.isSelected() && !expectNull.isSelected()); } }
@Override public void clearGui() { super.clearGui(); jsonPath.setText("$."); jsonValue.setText(""); jsonValidation.setSelected(false); expectNull.setSelected(false); invert.setSelected(false); }
jsonValidation = new JCheckBox("Additionally assert value"); isRegex = new JCheckBox("Match as regular expression"); jsonValue = new JLabeledTextArea("Expected Value: "); expectNull = new JCheckBox("Expect null"); invert = new JCheckBox("Invert assertion (will fail if above conditions met)");
@Override public void modifyTestElement(TestElement element) { super.configureTestElement(element); if (element instanceof JSONPathAssertion) { JSONPathAssertion jpAssertion = (JSONPathAssertion) element; jpAssertion.setJsonPath(jsonPath.getText()); jpAssertion.setExpectedValue(jsonValue.getText()); jpAssertion.setJsonValidationBool(jsonValidation.isSelected()); jpAssertion.setExpectNull(expectNull.isSelected()); jpAssertion.setInvert(invert.isSelected()); jpAssertion.setIsRegex(isRegex.isSelected()); if (inputFormatGroup.getSelection() != null) { jpAssertion.setInputFormat(inputFormatGroup.getSelection().getActionCommand()); } } }
@Override public void stateChanged(ChangeEvent e) { jsonValue.setEnabled(jsonValidation.isSelected() && !expectNull.isSelected()); isRegex.setEnabled(jsonValidation.isSelected() && !expectNull.isSelected()); } }
public void clear() { this.consumerKey.setText(""); this.consumerSecret.setText(""); this.httpMethods.setText("GET"); this.hostBaseUrl.setText(""); this.headers.setText(""); this.resource.setText(""); this.port.setText("8080"); this.useKeepAlive.setSelected(true); this.automaticRedirect.setSelected(true); this.body.setText(""); }
/** * Creates a new UI that provides means to configure the Command & Control endpoint to connect to for sending * commands and receiving command responses. */ public HonoCommanderSamplerUI() { honoServerOptions = new ServerOptionsPanel("Hono connection options"); reconnectAttempts = new JLabeledTextField("Max reconnect attempts"); tenant = new JLabeledTextField("Tenant"); command = new JLabeledTextArea("Command"); commandPayload = new JLabeledTextArea("Command payload"); commandTimeOut = new JLabeledTextField("Command Timeout In Milliseconds"); triggerType = new JComboBox(new String[] { "device", "sampler" }); triggerTypeDescription = new JTextArea(); addOption(honoServerOptions); addOption(reconnectAttempts); addOption(tenant); addOption(command); addOption(commandPayload); addOption(commandTimeOut); addOption(getTriggerTypePanel()); }
/** * 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) { super.configureTestElement(s); if (s instanceof OAuthSampler) { OAuthSampler sampler = (OAuthSampler) s; sampler.setConsumerKey(consumerKey.getText()); sampler.setConsumerSecret(consumerSecret.getText()); sampler.setRequestBody(body.getText()); sampler.setMethod(httpMethods.getText()); sampler.setUseKeepAlive(useKeepAlive.isSelected()); sampler.setAutoRedirects(automaticRedirect.isSelected()); sampler.setHostBaseUrl(hostBaseUrl.getText()); sampler.setResource(resource.getText()); sampler.setPortNumber(port.getText()); sampler.setRequestHeaders(headers.getText()); } }
@Override public void clearGui() { super.clearGui(); honoServerOptions.clearGui(); reconnectAttempts.setText(""); tenant.setText(""); commandTimeOut.setText(""); command.setText(""); commandPayload.setText(""); triggerType.setSelectedIndex(0); triggerTypeDescription.setText(getDescriptionTextForSelectedTrigger()); }
public void init() { setLayout(new BorderLayout()); setBorder(makeBorder()); add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH); VerticalPanel panel = new VerticalPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); jsonPath = new JLabeledTextField("JSON Path: "); jsonValidation = new JCheckBox("Validate against expected value"); jsonValue = new JLabeledTextArea("Expected Value (regular expression): "); expectNull = new JCheckBox("Expect null"); invert = new JCheckBox("Invert assertion (will fail if above conditions met)"); jsonValidation.addChangeListener(this); expectNull.addChangeListener(this); panel.add(jsonPath); panel.add(jsonValidation); panel.add(jsonValue); panel.add(expectNull); panel.add(invert); add(panel, BorderLayout.CENTER); }