diff --git a/JMeterWebSocketSampler-1.0.2-SNAPSHOT.jar.zip b/JMeterWebSocketSampler-1.0.2-SNAPSHOT.jar.zip new file mode 100644 index 0000000..5ebf173 Binary files /dev/null and b/JMeterWebSocketSampler-1.0.2-SNAPSHOT.jar.zip differ diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationConfig.form b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationConfig.form deleted file mode 100644 index 2b1aa77..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationConfig.form +++ /dev/null @@ -1,337 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationConfig.java b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationConfig.java deleted file mode 100644 index 645d183..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationConfig.java +++ /dev/null @@ -1,448 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package JMeter.plugins.functional.controler.websocketapp; - -import JMeter.plugins.functional.samplers.websocket.*; -import java.awt.Color; -import org.apache.jmeter.config.gui.ArgumentsPanel; -import org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel; -import org.apache.jorphan.logging.LoggingManager; -import org.apache.log.Logger; - -/** - * - * @author Maciej Zaleski - */ -public class WebSocketApplicationConfig extends javax.swing.JPanel { - private static final Logger log = LoggingManager.getLoggerForClass(); - private HTTPArgumentsPanel attributePanel; - - /** - * Creates new form WebSocketSamplerPanel - */ - public WebSocketApplicationConfig() { - initComponents(); - - attributePanel = new HTTPArgumentsPanel(); - querystringAttributesPanel.add(attributePanel); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jPanel1 = new javax.swing.JPanel(); - jLabel1 = new javax.swing.JLabel(); - serverAddressTextField = new javax.swing.JTextField(); - jLabel2 = new javax.swing.JLabel(); - serverPortTextField = new javax.swing.JTextField(); - jPanel2 = new javax.swing.JPanel(); - jLabel3 = new javax.swing.JLabel(); - connectionTimeoutTextField = new javax.swing.JTextField(); - jPanel3 = new javax.swing.JPanel(); - jLabel4 = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); - protocolTextField = new javax.swing.JTextField(); - contentEncodingTextField = new javax.swing.JTextField(); - ignoreSslErrorsCheckBox = new javax.swing.JCheckBox(); - jLabel15 = new javax.swing.JLabel(); - implementationComboBox = new javax.swing.JComboBox(); - jPanel6 = new javax.swing.JPanel(); - jLabel10 = new javax.swing.JLabel(); - proxyAddressTextField = new javax.swing.JTextField(); - jLabel11 = new javax.swing.JLabel(); - proxyPortTextField = new javax.swing.JTextField(); - jLabel12 = new javax.swing.JLabel(); - proxyUsernameTextField = new javax.swing.JTextField(); - jLabel13 = new javax.swing.JLabel(); - proxyPasswordTextField = new javax.swing.JTextField(); - - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Web Server")); - - jLabel1.setText("Server Name or IP:"); - - jLabel2.setText("Port Number:"); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(serverAddressTextField) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabel2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(serverPortTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(serverAddressTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel2) - .addComponent(serverPortTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Timeout (milliseconds)")); - - jLabel3.setText("Connection:"); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(connectionTimeoutTextField) - .addContainerGap()) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel3) - .addComponent(connectionTimeoutTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("WebSocket Settings")); - - jLabel4.setText("Protocol [ws/wss]:"); - - jLabel6.setText("Content encoding:"); - - protocolTextField.setToolTipText(""); - - ignoreSslErrorsCheckBox.setText("Ignore SSL certificate errors"); - - jLabel15.setText("Implementation:"); - - implementationComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "RFC6455 (v13)" })); - - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() - .addComponent(jLabel15) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(implementationComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(protocolTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabel6) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(contentEncodingTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel3Layout.createSequentialGroup() - .addComponent(ignoreSslErrorsCheckBox) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4) - .addComponent(protocolTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel6) - .addComponent(contentEncodingTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel15) - .addComponent(implementationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(ignoreSslErrorsCheckBox)) - ); - - jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Proxy Server (currently not supported by Jetty)")); - - jLabel10.setText("Server Name or IP:"); - - jLabel11.setText("Port Number:"); - - jLabel12.setText("Username:"); - - jLabel13.setText("Password:"); - - javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); - jPanel6.setLayout(jPanel6Layout); - jPanel6Layout.setHorizontalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel10) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(proxyAddressTextField) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabel11) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(proxyPortTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(jLabel12) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(proxyUsernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(jLabel13) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(proxyPasswordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - jPanel6Layout.setVerticalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(proxyUsernameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel12)) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel11) - .addComponent(proxyPortTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel10) - .addComponent(proxyAddressTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel13) - .addComponent(proxyPasswordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JTextField connectionTimeoutTextField; - private javax.swing.JTextField contentEncodingTextField; - private javax.swing.JCheckBox ignoreSslErrorsCheckBox; - private javax.swing.JComboBox implementationComboBox; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel10; - private javax.swing.JLabel jLabel11; - private javax.swing.JLabel jLabel12; - private javax.swing.JLabel jLabel13; - private javax.swing.JLabel jLabel15; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel6; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel6; - private javax.swing.JTextField protocolTextField; - private javax.swing.JTextField proxyAddressTextField; - private javax.swing.JTextField proxyPasswordTextField; - private javax.swing.JTextField proxyPortTextField; - private javax.swing.JTextField proxyUsernameTextField; - private javax.swing.JTextField serverAddressTextField; - private javax.swing.JTextField serverPortTextField; - // End of variables declaration//GEN-END:variables - - public void initFields() { - } - - public void setCloseConncectionPattern(String closeConncectionPattern) { - closeConncectionPatternTextField.setText(closeConncectionPattern); - } - - public String getCloseConncectionPattern() { - return closeConncectionPatternTextField.getText(); - } - - public void setConnectionId(String connectionId) { - connectionIdTextField.setText(connectionId); - } - - public String getConnectionId() { - return connectionIdTextField.getText(); - } - - public void setContentEncoding(String contentEncoding) { - contentEncodingTextField.setText(contentEncoding); - } - - public String getContentEncoding() { - return contentEncodingTextField.getText(); - } - - public void setContextPath(String contextPath) { - contextPathTextField.setText(contextPath); - } - - public String getContextPath() { - return contextPathTextField.getText(); - } - - public void setProtocol(String protocol) { - protocolTextField.setText(protocol); - } - - public String getProtocol() { - return protocolTextField.getText(); - } - - public void setProxyAddress(String proxyAddress) { - proxyAddressTextField.setText(proxyAddress); - } - - public String getProxyAddress() { - return proxyAddressTextField.getText(); - } - - public void setProxyPassword(String proxyPassword) { - proxyPasswordTextField.setText(proxyPassword); - } - - public String getProxyPassword() { - return proxyPasswordTextField.getText(); - } - - public void setProxyPort(String proxyPort) { - proxyPortTextField.setText(proxyPort); - } - - public String getProxyPort() { - return proxyPortTextField.getText(); - } - - public void setProxyUsername(String proxyUsername) { - proxyUsernameTextField.setText(proxyUsername); - } - - public String getProxyUsername() { - return proxyUsernameTextField.getText(); - } - - public void setResponsePattern(String responsePattern) { - responsePatternTextField.setText(responsePattern); - } - - public String getResponsePattern() { - return responsePatternTextField.getText(); - } - - public void setResponseTimeout(String responseTimeout) { - responseTimeoutTextField.setText(responseTimeout); - } - - public String getResponseTimeout() { - return responseTimeoutTextField.getText(); - } - - public void setConnectionTimeout(String connectionTimeout) { - connectionTimeoutTextField.setText(connectionTimeout); - } - - public String getConnectionTimeout() { - return connectionTimeoutTextField.getText(); - } - - public void setServerAddress(String serverAddress) { - serverAddressTextField.setText(serverAddress); - } - - public String getServerAddress() { - return serverAddressTextField.getText(); - } - - public void setServerPort(String serverPort) { - serverPortTextField.setText(serverPort); - } - - public String getServerPort() { - return serverPortTextField.getText(); - } - - public void setRequestPayload(String requestPayload) { - requestPayloadEditorPane.setText(requestPayload); - } - - public String getRequestPayload() { - return requestPayloadEditorPane.getText(); - } - - public void setStreamingConnection(Boolean streamingConnection) { - streamingConnectionCheckBox.setSelected(streamingConnection); - } - - public Boolean isStreamingConnection() { - return streamingConnectionCheckBox.isSelected(); - } - - public void setIgnoreSslErrors(Boolean ignoreSslErrors) { - ignoreSslErrorsCheckBox.setSelected(ignoreSslErrors); - } - - public Boolean isIgnoreSslErrors() { - return ignoreSslErrorsCheckBox.isSelected(); - } - - public void setImplementation(String implementation) { - implementationComboBox.setSelectedItem(implementation); - } - - public String getImplementation() { - return (String) implementationComboBox.getSelectedItem(); - } - - public void setMessageBacklog(String messageBacklog) { - messageBacklogTextField.setText(messageBacklog); - } - - public String getMessageBacklog() { - return messageBacklogTextField.getText(); - } - - /** - * @return the attributePanel - */ - public ArgumentsPanel getAttributePanel() { - return attributePanel; - } -} diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationRequest.form b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationRequest.form deleted file mode 100644 index fa5ea0a..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationRequest.form +++ /dev/null @@ -1,201 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - <Editor/> - <Renderer/> - </Column> - <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> - <Title/> - <Editor/> - <Renderer/> - </Column> - <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> - <Title/> - <Editor/> - <Renderer/> - </Column> - <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> - <Title/> - <Editor/> - <Renderer/> - </Column> - </TableColumnModel> - </Property> - <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> - <TableHeader reorderingAllowed="true" resizingAllowed="true"/> - </Property> - </Properties> - </Component> - </SubComponents> - </Container> - </SubComponents> - </Container> - </SubComponents> -</Form> diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationRequest.java b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationRequest.java deleted file mode 100644 index 1deb0ea..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationRequest.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package JMeter.plugins.functional.controler.websocketapp; - -import JMeter.plugins.functional.samplers.websocket.*; -import java.awt.Color; -import org.apache.jmeter.config.gui.ArgumentsPanel; -import org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel; -import org.apache.jorphan.logging.LoggingManager; -import org.apache.log.Logger; - -/** - * - * @author Maciej Zaleski - */ -public class WebSocketApplicationRequest extends javax.swing.JPanel { - private static final Logger log = LoggingManager.getLoggerForClass(); - private HTTPArgumentsPanel attributePanel; - - /** - * Creates new form WebSocketSamplerPanel - */ - public WebSocketApplicationRequest() { - initComponents(); - - attributePanel = new HTTPArgumentsPanel(); - querystringAttributesPanel.add(attributePanel); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - - jPanel4 = new javax.swing.JPanel(); - jScrollPane1 = new javax.swing.JScrollPane(); - requestPayloadEditorPane = new javax.swing.JEditorPane(); - jPanel1 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - jScrollPane2 = new javax.swing.JScrollPane(); - jTable1 = new javax.swing.JTable(); - - jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Client Request")); - - jScrollPane1.setViewportView(requestPayloadEditorPane); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 135, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 493, Short.MAX_VALUE) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Response handlers")); - - jTable1.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {"Successfull", "Quote received", "trade", new Boolean(true)}, - {"Market closed", "Quote failed", "quote", new Boolean(true)}, - {"System unavailable", "Quote failed", "quote", new Boolean(true)} - }, - new String [] { - "Handler name", "Response handler", "Application state", "Enabled" - } - ) { - Class[] types = new Class [] { - java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Boolean.class - }; - - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } - }); - jScrollPane2.setViewportView(jTable1); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane2)) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGap(19, 19, 19) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE) - .addContainerGap()) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - ); - }// </editor-fold>//GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel4; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JScrollPane jScrollPane2; - private javax.swing.JTable jTable1; - private javax.swing.JEditorPane requestPayloadEditorPane; - // End of variables declaration//GEN-END:variables - - public void initFields() { - } - - public void setCloseConncectionPattern(String closeConncectionPattern) { - closeConncectionPatternTextField.setText(closeConncectionPattern); - } - - public String getCloseConncectionPattern() { - return closeConncectionPatternTextField.getText(); - } - - public void setConnectionId(String connectionId) { - connectionIdTextField.setText(connectionId); - } - - public String getConnectionId() { - return connectionIdTextField.getText(); - } - - public void setContentEncoding(String contentEncoding) { - contentEncodingTextField.setText(contentEncoding); - } - - public String getContentEncoding() { - return contentEncodingTextField.getText(); - } - - public void setContextPath(String contextPath) { - contextPathTextField.setText(contextPath); - } - - public String getContextPath() { - return contextPathTextField.getText(); - } - - public void setProtocol(String protocol) { - protocolTextField.setText(protocol); - } - - public String getProtocol() { - return protocolTextField.getText(); - } - - public void setProxyAddress(String proxyAddress) { - proxyAddressTextField.setText(proxyAddress); - } - - public String getProxyAddress() { - return proxyAddressTextField.getText(); - } - - public void setProxyPassword(String proxyPassword) { - proxyPasswordTextField.setText(proxyPassword); - } - - public String getProxyPassword() { - return proxyPasswordTextField.getText(); - } - - public void setProxyPort(String proxyPort) { - proxyPortTextField.setText(proxyPort); - } - - public String getProxyPort() { - return proxyPortTextField.getText(); - } - - public void setProxyUsername(String proxyUsername) { - proxyUsernameTextField.setText(proxyUsername); - } - - public String getProxyUsername() { - return proxyUsernameTextField.getText(); - } - - public void setResponsePattern(String responsePattern) { - responsePatternTextField.setText(responsePattern); - } - - public String getResponsePattern() { - return responsePatternTextField.getText(); - } - - public void setResponseTimeout(String responseTimeout) { - responseTimeoutTextField.setText(responseTimeout); - } - - public String getResponseTimeout() { - return responseTimeoutTextField.getText(); - } - - public void setConnectionTimeout(String connectionTimeout) { - connectionTimeoutTextField.setText(connectionTimeout); - } - - public String getConnectionTimeout() { - return connectionTimeoutTextField.getText(); - } - - public void setServerAddress(String serverAddress) { - serverAddressTextField.setText(serverAddress); - } - - public String getServerAddress() { - return serverAddressTextField.getText(); - } - - public void setServerPort(String serverPort) { - serverPortTextField.setText(serverPort); - } - - public String getServerPort() { - return serverPortTextField.getText(); - } - - public void setRequestPayload(String requestPayload) { - requestPayloadEditorPane.setText(requestPayload); - } - - public String getRequestPayload() { - return requestPayloadEditorPane.getText(); - } - - public void setStreamingConnection(Boolean streamingConnection) { - streamingConnectionCheckBox.setSelected(streamingConnection); - } - - public Boolean isStreamingConnection() { - return streamingConnectionCheckBox.isSelected(); - } - - public void setIgnoreSslErrors(Boolean ignoreSslErrors) { - ignoreSslErrorsCheckBox.setSelected(ignoreSslErrors); - } - - public Boolean isIgnoreSslErrors() { - return ignoreSslErrorsCheckBox.isSelected(); - } - - public void setImplementation(String implementation) { - implementationComboBox.setSelectedItem(implementation); - } - - public String getImplementation() { - return (String) implementationComboBox.getSelectedItem(); - } - - public void setMessageBacklog(String messageBacklog) { - messageBacklogTextField.setText(messageBacklog); - } - - public String getMessageBacklog() { - return messageBacklogTextField.getText(); - } - - /** - * @return the attributePanel - */ - public ArgumentsPanel getAttributePanel() { - return attributePanel; - } -} diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationResponse.form b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationResponse.form deleted file mode 100644 index 25cf601..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationResponse.form +++ /dev/null @@ -1,150 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> - <AuxValues> - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - </AuxValues> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jPanel5" max="32767" attributes="0"/> - <Component id="jPanel4" alignment="0" max="32767" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jPanel5" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jPanel4" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Container class="javax.swing.JPanel" name="jPanel5"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="Server message"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jLabel7" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="responsePatternTextField" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="responsePatternTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel7"> - <Properties> - <Property name="text" type="java.lang.String" value="Response pattern:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="responsePatternTextField"> - </Component> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel4"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="Client response"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jScrollPane1" pref="493" max="32767" attributes="0"/> - <Component id="jPanel1" max="32767" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="1" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jPanel1" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane1" min="-2" pref="88" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Container class="javax.swing.JScrollPane" name="jScrollPane1"> - <AuxValues> - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> - </AuxValues> - - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> - <SubComponents> - <Component class="javax.swing.JEditorPane" name="requestPayloadEditorPane"> - </Component> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel1"> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="130" max="32767" attributes="0"/> - </Group> - </DimensionLayout> - </Layout> - </Container> - </SubComponents> - </Container> - </SubComponents> -</Form> diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationResponse.java b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationResponse.java deleted file mode 100644 index d8a3226..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketApplicationResponse.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package JMeter.plugins.functional.controler.websocketapp; - -import JMeter.plugins.functional.samplers.websocket.*; -import java.awt.Color; -import org.apache.jmeter.config.gui.ArgumentsPanel; -import org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel; -import org.apache.jorphan.logging.LoggingManager; -import org.apache.log.Logger; - -/** - * - * @author Maciej Zaleski - */ -public class WebSocketApplicationResponse extends javax.swing.JPanel { - private static final Logger log = LoggingManager.getLoggerForClass(); - private HTTPArgumentsPanel attributePanel; - - /** - * Creates new form WebSocketSamplerPanel - */ - public WebSocketApplicationResponse() { - initComponents(); - - attributePanel = new HTTPArgumentsPanel(); - querystringAttributesPanel.add(attributePanel); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - - jPanel5 = new javax.swing.JPanel(); - jLabel7 = new javax.swing.JLabel(); - responsePatternTextField = new javax.swing.JTextField(); - jPanel4 = new javax.swing.JPanel(); - jScrollPane1 = new javax.swing.JScrollPane(); - requestPayloadEditorPane = new javax.swing.JEditorPane(); - jPanel1 = new javax.swing.JPanel(); - - jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Server message")); - - jLabel7.setText("Response pattern:"); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel7) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(responsePatternTextField) - .addContainerGap()) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent(responsePatternTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Client response")); - - jScrollPane1.setViewportView(requestPayloadEditorPane); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 130, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 493, Short.MAX_VALUE) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - ); - }// </editor-fold>//GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel jLabel7; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JEditorPane requestPayloadEditorPane; - private javax.swing.JTextField responsePatternTextField; - // End of variables declaration//GEN-END:variables - - public void initFields() { - } - - public void setCloseConncectionPattern(String closeConncectionPattern) { - closeConncectionPatternTextField.setText(closeConncectionPattern); - } - - public String getCloseConncectionPattern() { - return closeConncectionPatternTextField.getText(); - } - - public void setConnectionId(String connectionId) { - connectionIdTextField.setText(connectionId); - } - - public String getConnectionId() { - return connectionIdTextField.getText(); - } - - public void setContentEncoding(String contentEncoding) { - contentEncodingTextField.setText(contentEncoding); - } - - public String getContentEncoding() { - return contentEncodingTextField.getText(); - } - - public void setContextPath(String contextPath) { - contextPathTextField.setText(contextPath); - } - - public String getContextPath() { - return contextPathTextField.getText(); - } - - public void setProtocol(String protocol) { - protocolTextField.setText(protocol); - } - - public String getProtocol() { - return protocolTextField.getText(); - } - - public void setProxyAddress(String proxyAddress) { - proxyAddressTextField.setText(proxyAddress); - } - - public String getProxyAddress() { - return proxyAddressTextField.getText(); - } - - public void setProxyPassword(String proxyPassword) { - proxyPasswordTextField.setText(proxyPassword); - } - - public String getProxyPassword() { - return proxyPasswordTextField.getText(); - } - - public void setProxyPort(String proxyPort) { - proxyPortTextField.setText(proxyPort); - } - - public String getProxyPort() { - return proxyPortTextField.getText(); - } - - public void setProxyUsername(String proxyUsername) { - proxyUsernameTextField.setText(proxyUsername); - } - - public String getProxyUsername() { - return proxyUsernameTextField.getText(); - } - - public void setResponsePattern(String responsePattern) { - responsePatternTextField.setText(responsePattern); - } - - public String getResponsePattern() { - return responsePatternTextField.getText(); - } - - public void setResponseTimeout(String responseTimeout) { - responseTimeoutTextField.setText(responseTimeout); - } - - public String getResponseTimeout() { - return responseTimeoutTextField.getText(); - } - - public void setConnectionTimeout(String connectionTimeout) { - connectionTimeoutTextField.setText(connectionTimeout); - } - - public String getConnectionTimeout() { - return connectionTimeoutTextField.getText(); - } - - public void setServerAddress(String serverAddress) { - serverAddressTextField.setText(serverAddress); - } - - public String getServerAddress() { - return serverAddressTextField.getText(); - } - - public void setServerPort(String serverPort) { - serverPortTextField.setText(serverPort); - } - - public String getServerPort() { - return serverPortTextField.getText(); - } - - public void setRequestPayload(String requestPayload) { - requestPayloadEditorPane.setText(requestPayload); - } - - public String getRequestPayload() { - return requestPayloadEditorPane.getText(); - } - - public void setStreamingConnection(Boolean streamingConnection) { - streamingConnectionCheckBox.setSelected(streamingConnection); - } - - public Boolean isStreamingConnection() { - return streamingConnectionCheckBox.isSelected(); - } - - public void setIgnoreSslErrors(Boolean ignoreSslErrors) { - ignoreSslErrorsCheckBox.setSelected(ignoreSslErrors); - } - - public Boolean isIgnoreSslErrors() { - return ignoreSslErrorsCheckBox.isSelected(); - } - - public void setImplementation(String implementation) { - implementationComboBox.setSelectedItem(implementation); - } - - public String getImplementation() { - return (String) implementationComboBox.getSelectedItem(); - } - - public void setMessageBacklog(String messageBacklog) { - messageBacklogTextField.setText(messageBacklog); - } - - public String getMessageBacklog() { - return messageBacklogTextField.getText(); - } - - /** - * @return the attributePanel - */ - public ArgumentsPanel getAttributePanel() { - return attributePanel; - } -} diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketSampler.java b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketSampler.java deleted file mode 100644 index 7a8b429..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketSampler.java +++ /dev/null @@ -1,468 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package JMeter.plugins.functional.controler.websocketapp; - -import JMeter.plugins.functional.samplers.websocket.*; -import java.io.IOException; -import org.apache.commons.lang3.StringUtils; -import org.apache.jmeter.config.Argument; -import org.apache.jmeter.config.Arguments; -import org.apache.jmeter.protocol.http.util.EncoderCache; -import org.apache.jmeter.protocol.http.util.HTTPArgument; -import org.apache.jmeter.protocol.http.util.HTTPConstants; -import org.apache.jmeter.samplers.AbstractSampler; -import org.apache.jmeter.samplers.Entry; -import org.apache.jmeter.samplers.SampleResult; -import org.apache.jmeter.testelement.TestElement; -import org.apache.jmeter.testelement.property.*; -import org.apache.jorphan.logging.LoggingManager; -import org.apache.jorphan.util.JOrphanUtils; -import org.apache.log.Logger; - - -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import org.apache.jmeter.testelement.TestStateListener; -import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; -import org.eclipse.jetty.websocket.client.WebSocketClient; - -/** - * - * @author Maciej Zaleski - */ -public class WebSocketSampler extends AbstractSampler implements TestStateListener { - private static final Logger log = LoggingManager.getLoggerForClass(); - - private static final String ARG_VAL_SEP = "="; // $NON-NLS-1$ - private static final String QRY_SEP = "&"; // $NON-NLS-1$ - private static final String WS_PREFIX = "ws://"; // $NON-NLS-1$ - private static final String WSS_PREFIX = "wss://"; // $NON-NLS-1$ - private static final String DEFAULT_PROTOCOL = "ws"; - - private static Map<String, ServiceSocket> connectionList; - - public WebSocketSampler() { - super(); - setName("WebSocket sampler"); - } - - private ServiceSocket getConnectionSocket() throws URISyntaxException, Exception { - URI uri = getUri(); - - String connectionId = getThreadName() + getConnectionId(); - ServiceSocket socket; - WebSocketClient webSocketClient; - if (isStreamingConnection()) { - if (connectionList.containsKey(connectionId)) { - socket = connectionList.get(connectionId); - socket.initialize(); - return socket; - } else { - socket = new ServiceSocket(this); - connectionList.put(connectionId, socket); - } - } else { - socket = new ServiceSocket(this); - } - - SslContextFactory sslContexFactory = new SslContextFactory(); - sslContexFactory.setTrustAll(isIgnoreSslErrors()); - webSocketClient = new WebSocketClient(sslContexFactory); - - webSocketClient.start(); - ClientUpgradeRequest request = new ClientUpgradeRequest(); - webSocketClient.connect(socket, uri, request); - - int connectionTimeout = Integer.parseInt(getConnectionTimeout()); - socket.awaitOpen(connectionTimeout, TimeUnit.MILLISECONDS); - - return socket; - } - - @Override - public SampleResult sample(Entry entry) { - ServiceSocket socket = null; - SampleResult sampleResult = new SampleResult(); - sampleResult.setSampleLabel(getName()); - sampleResult.setDataEncoding(getContentEncoding()); - - StringBuilder errorList = new StringBuilder(); - errorList.append("\n\n[Problems]\n"); - - boolean isOK = false; - - String payloadMessage = getRequestPayload(); - sampleResult.setSamplerData(payloadMessage); - sampleResult.sampleStart(); - - try { - socket = getConnectionSocket(); - if (socket == null) { - sampleResult.setResponseCode("500"); - sampleResult.setSuccessful(false); - sampleResult.sampleEnd(); - sampleResult.setResponseMessage(errorList.toString()); - errorList.append(" - Connection couldn't be opened").append("\n"); - return sampleResult; - } - - if (!payloadMessage.isEmpty()) { - socket.sendMessage(payloadMessage); - } - - int responseTimeout = Integer.parseInt(getResponseTimeout()); - socket.awaitClose(responseTimeout, TimeUnit.MILLISECONDS); - - - if (socket.getResponseMessage() == null || socket.getResponseMessage().isEmpty()) { - sampleResult.setResponseCode("204"); - } - - if (socket.getError() != 0) { - isOK = false; - sampleResult.setResponseCode(socket.getError().toString()); - } else { - sampleResult.setResponseCodeOK(); - isOK = true; - } - - sampleResult.setResponseData(socket.getResponseMessage(), getContentEncoding()); - - } catch (URISyntaxException e) { - errorList.append(" - Invalid URI syntax: ").append(e.getMessage()).append("\n").append(StringUtils.join(e.getStackTrace(), "\n")).append("\n"); - } catch (IOException e) { - errorList.append(" - IO Exception: ").append(e.getMessage()).append("\n").append(StringUtils.join(e.getStackTrace(), "\n")).append("\n"); - } catch (NumberFormatException e) { - errorList.append(" - Cannot parse number: ").append(e.getMessage()).append("\n").append(StringUtils.join(e.getStackTrace(), "\n")).append("\n"); - } catch (InterruptedException e) { - errorList.append(" - Execution interrupted: ").append(e.getMessage()).append("\n").append(StringUtils.join(e.getStackTrace(), "\n")).append("\n"); - } catch (Exception e) { - errorList.append(" - Unexpected error: ").append(e.getMessage()).append("\n").append(StringUtils.join(e.getStackTrace(), "\n")).append("\n"); - } - - sampleResult.sampleEnd(); - sampleResult.setSuccessful(isOK); - - String logMessage = (socket != null) ? socket.getLogMessage() : ""; - sampleResult.setResponseMessage(logMessage + errorList); - return sampleResult; - } - - @Override - public void setName(String name) { - if (name != null) { - setProperty(TestElement.NAME, name); - } - } - - @Override - public String getName() { - return getPropertyAsString(TestElement.NAME); - } - - @Override - public void setComment(String comment) { - setProperty(new StringProperty(TestElement.COMMENTS, comment)); - } - - @Override - public String getComment() { - return getProperty(TestElement.COMMENTS).getStringValue(); - } - - public URI getUri() throws URISyntaxException { - String path = this.getContextPath(); - // Hack to allow entire URL to be provided in host field - if (path.startsWith(WS_PREFIX) - || path.startsWith(WSS_PREFIX)) { - return new URI(path); - } - String domain = getServerAddress(); - String protocol = getProtocol(); - // HTTP URLs must be absolute, allow file to be relative - if (!path.startsWith("/")) { // $NON-NLS-1$ - path = "/" + path; // $NON-NLS-1$ - } - - String queryString = getQueryString(getContentEncoding()); - if (isProtocolDefaultPort()) { - return new URI(protocol, null, domain, -1, path, queryString, null); - } - return new URI(protocol, null, domain, Integer.parseInt(getServerPort()), path, queryString, null); - } - - /** - * Tell whether the default port for the specified protocol is used - * - * @return true if the default port number for the protocol is used, false - * otherwise - */ - public boolean isProtocolDefaultPort() { - final int port = Integer.parseInt(getServerPort()); - final String protocol = getProtocol(); - return ("ws".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTP_PORT) - || ("wss".equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTPS_PORT); - } - - public String getServerPort() { - final String port_s = getPropertyAsString("serverPort", "0"); - Integer port; - String protocol = getProtocol(); - - try { - port = Integer.parseInt(port_s); - } catch (Exception ex) { - port = 0; - } - - if (port == 0) { - if ("wss".equalsIgnoreCase(protocol)) { - return String.valueOf(HTTPConstants.DEFAULT_HTTPS_PORT); - } else if ("ws".equalsIgnoreCase(protocol)) { - return String.valueOf(HTTPConstants.DEFAULT_HTTP_PORT); - } - } - return port.toString(); - } - - public void setServerPort(String port) { - setProperty("serverPort", port); - } - - public String getResponseTimeout() { - return getPropertyAsString("responseTimeout", "20000"); - } - - public void setResponseTimeout(String responseTimeout) { - setProperty("responseTimeout", responseTimeout); - } - - - public String getConnectionTimeout() { - return getPropertyAsString("connectionTimeout", "5000"); - } - - public void setConnectionTimeout(String connectionTimeout) { - setProperty("connectionTimeout", connectionTimeout); - } - - public void setProtocol(String protocol) { - setProperty("protocol", protocol); - } - - public String getProtocol() { - String protocol = getPropertyAsString("protocol"); - if (protocol == null || protocol.isEmpty()) { - return DEFAULT_PROTOCOL; - } - return protocol; - } - - public void setServerAddress(String serverAddress) { - setProperty("serverAddress", serverAddress); - } - - public String getServerAddress() { - return getPropertyAsString("serverAddress"); - } - - - public void setImplementation(String implementation) { - setProperty("implementation", implementation); - } - - public String getImplementation() { - return getPropertyAsString("implementation"); - } - - public void setContextPath(String contextPath) { - setProperty("contextPath", contextPath); - } - - public String getContextPath() { - return getPropertyAsString("contextPath"); - } - - public void setContentEncoding(String contentEncoding) { - setProperty("contentEncoding", contentEncoding); - } - - public String getContentEncoding() { - return getPropertyAsString("contentEncoding", "UTF-8"); - } - - public void setRequestPayload(String requestPayload) { - setProperty("requestPayload", requestPayload); - } - - public String getRequestPayload() { - return getPropertyAsString("requestPayload"); - } - - public void setIgnoreSslErrors(Boolean ignoreSslErrors) { - setProperty("ignoreSslErrors", ignoreSslErrors); - } - - public Boolean isIgnoreSslErrors() { - return getPropertyAsBoolean("ignoreSslErrors"); - } - - public void setStreamingConnection(Boolean streamingConnection) { - setProperty("streamingConnection", streamingConnection); - } - - public Boolean isStreamingConnection() { - return getPropertyAsBoolean("streamingConnection"); - } - - public void setConnectionId(String connectionId) { - setProperty("connectionId", connectionId); - } - - public String getConnectionId() { - return getPropertyAsString("connectionId"); - } - - public void setResponsePattern(String responsePattern) { - setProperty("responsePattern", responsePattern); - } - - public String getResponsePattern() { - return getPropertyAsString("responsePattern"); - } - - public void setCloseConncectionPattern(String closeConncectionPattern) { - setProperty("closeConncectionPattern", closeConncectionPattern); - } - - public String getCloseConncectionPattern() { - return getPropertyAsString("closeConncectionPattern"); - } - - public void setProxyAddress(String proxyAddress) { - setProperty("proxyAddress", proxyAddress); - } - - public String getProxyAddress() { - return getPropertyAsString("proxyAddress"); - } - - public void setProxyPassword(String proxyPassword) { - setProperty("proxyPassword", proxyPassword); - } - - public String getProxyPassword() { - return getPropertyAsString("proxyPassword"); - } - - public void setProxyPort(String proxyPort) { - setProperty("proxyPort", proxyPort); - } - - public String getProxyPort() { - return getPropertyAsString("proxyPort"); - } - - public void setProxyUsername(String proxyUsername) { - setProperty("proxyUsername", proxyUsername); - } - - public String getProxyUsername() { - return getPropertyAsString("proxyUsername"); - } - - public void setMessageBacklog(String messageBacklog) { - setProperty("messageBacklog", messageBacklog); - } - - public String getMessageBacklog() { - return getPropertyAsString("messageBacklog", "3"); - } - - - - public String getQueryString(String contentEncoding) { - // Check if the sampler has a specified content encoding - if (JOrphanUtils.isBlank(contentEncoding)) { - // We use the encoding which should be used according to the HTTP spec, which is UTF-8 - contentEncoding = EncoderCache.URL_ARGUMENT_ENCODING; - } - StringBuilder buf = new StringBuilder(); - PropertyIterator iter = getQueryStringParameters().iterator(); - boolean first = true; - while (iter.hasNext()) { - HTTPArgument item = null; - Object objectValue = iter.next().getObjectValue(); - try { - item = (HTTPArgument) objectValue; - } catch (ClassCastException e) { - item = new HTTPArgument((Argument) objectValue); - } - final String encodedName = item.getEncodedName(); - if (encodedName.length() == 0) { - continue; // Skip parameters with a blank name (allows use of optional variables in parameter lists) - } - if (!first) { - buf.append(QRY_SEP); - } else { - first = false; - } - buf.append(encodedName); - if (item.getMetaData() == null) { - buf.append(ARG_VAL_SEP); - } else { - buf.append(item.getMetaData()); - } - - // Encode the parameter value in the specified content encoding - try { - buf.append(item.getEncodedValue(contentEncoding)); - } catch (UnsupportedEncodingException e) { - log.warn("Unable to encode parameter in encoding " + contentEncoding + ", parameter value not included in query string"); - } - } - return buf.toString(); - } - - public void setQueryStringParameters(Arguments queryStringParameters) { - setProperty(new TestElementProperty("queryStringParameters", queryStringParameters)); - } - - public Arguments getQueryStringParameters() { - Arguments args = (Arguments) getProperty("queryStringParameters").getObjectValue(); - return args; - } - - - @Override - public void testStarted() { - testStarted("unknown"); - } - - @Override - public void testStarted(String host) { - connectionList = new ConcurrentHashMap<String, ServiceSocket>(); - } - - @Override - public void testEnded() { - testEnded("unknown"); - } - - @Override - public void testEnded(String host) { - for (ServiceSocket socket : connectionList.values()) { - socket.close(); - } - } - - - -} diff --git a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketSamplerGui.java b/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketSamplerGui.java deleted file mode 100644 index e3801f9..0000000 --- a/src/main/java/JMeter/plugins/controler/websocketapp/WebSocketSamplerGui.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package JMeter.plugins.functional.controler.websocketapp; - -import java.awt.BorderLayout; -import org.apache.jmeter.config.Arguments; -import org.apache.jmeter.config.gui.ArgumentsPanel; -import org.apache.jmeter.control.gui.AbstractControllerGui; -import org.apache.jmeter.testelement.TestElement; -import org.apache.jorphan.logging.LoggingManager; -import org.apache.log.Logger; - -/** - * - * @author Maciej Zaleski - */ -public class WebSocketSamplerGui extends AbstractControllerGui { - - private WebSocketApplicationConfig webSocketSamplerPanel; - private static final Logger log = LoggingManager.getLoggerForClass(); - - public WebSocketSamplerGui() { - super(); - init(); - initFields(); - - setLayout(new BorderLayout(0, 5)); - setBorder(makeBorder()); - - add(makeTitlePanel(), BorderLayout.NORTH); - add(webSocketSamplerPanel, BorderLayout.CENTER); - } - - @Override - public String getStaticLabel() { - return "WebSocket Sampler"; - } - - @Override - public String getLabelResource() { - throw new IllegalStateException("This shouldn't be called"); //$NON-NLS-1$ - } - - @Override - public void configure(TestElement element) { - super.configure(element); - if (element instanceof WebSocketSampler) { - WebSocketSampler webSocketSamplerTestElement = (WebSocketSampler) element; - webSocketSamplerPanel.setServerAddress(webSocketSamplerTestElement.getServerAddress()); - webSocketSamplerPanel.setServerPort(webSocketSamplerTestElement.getServerPort()); - webSocketSamplerPanel.setImplementation(webSocketSamplerTestElement.getImplementation()); - webSocketSamplerPanel.setProtocol(webSocketSamplerTestElement.getProtocol()); - webSocketSamplerPanel.setContextPath(webSocketSamplerTestElement.getContextPath()); - webSocketSamplerPanel.setContentEncoding(webSocketSamplerTestElement.getContentEncoding()); - webSocketSamplerPanel.setRequestPayload(webSocketSamplerTestElement.getRequestPayload()); - webSocketSamplerPanel.setResponseTimeout(webSocketSamplerTestElement.getResponseTimeout()); - webSocketSamplerPanel.setConnectionTimeout(webSocketSamplerTestElement.getConnectionTimeout()); - webSocketSamplerPanel.setIgnoreSslErrors(webSocketSamplerTestElement.isIgnoreSslErrors()); - webSocketSamplerPanel.setStreamingConnection(webSocketSamplerTestElement.isStreamingConnection()); - webSocketSamplerPanel.setConnectionId(webSocketSamplerTestElement.getConnectionId()); - webSocketSamplerPanel.setResponsePattern(webSocketSamplerTestElement.getResponsePattern()); - webSocketSamplerPanel.setCloseConncectionPattern(webSocketSamplerTestElement.getCloseConncectionPattern()); - webSocketSamplerPanel.setProxyAddress(webSocketSamplerTestElement.getProxyAddress()); - webSocketSamplerPanel.setProxyPassword(webSocketSamplerTestElement.getProxyPassword()); - webSocketSamplerPanel.setProxyPort(webSocketSamplerTestElement.getProxyPort()); - webSocketSamplerPanel.setProxyUsername(webSocketSamplerTestElement.getProxyUsername()); - webSocketSamplerPanel.setMessageBacklog(webSocketSamplerTestElement.getMessageBacklog()); - - Arguments queryStringParameters = webSocketSamplerTestElement.getQueryStringParameters(); - if (queryStringParameters != null) { - webSocketSamplerPanel.getAttributePanel().configure(queryStringParameters); - } - } - } - - @Override - public TestElement createTestElement() { - WebSocketSampler preproc = new WebSocketSampler(); - configureTestElement(preproc); - return preproc; - } - - @Override - public void modifyTestElement(TestElement te) { - configureTestElement(te); - if (te instanceof WebSocketSampler) { - WebSocketSampler webSocketSamplerTestElement = (WebSocketSampler) te; - webSocketSamplerTestElement.setServerAddress(webSocketSamplerPanel.getServerAddress()); - webSocketSamplerTestElement.setServerPort(webSocketSamplerPanel.getServerPort()); - webSocketSamplerTestElement.setImplementation(webSocketSamplerPanel.getImplementation()); - webSocketSamplerTestElement.setProtocol(webSocketSamplerPanel.getProtocol()); - webSocketSamplerTestElement.setContextPath(webSocketSamplerPanel.getContextPath()); - webSocketSamplerTestElement.setContentEncoding(webSocketSamplerPanel.getContentEncoding()); - webSocketSamplerTestElement.setRequestPayload(webSocketSamplerPanel.getRequestPayload()); - webSocketSamplerTestElement.setConnectionTimeout(webSocketSamplerPanel.getConnectionTimeout()); - webSocketSamplerTestElement.setResponseTimeout(webSocketSamplerPanel.getResponseTimeout()); - webSocketSamplerTestElement.setIgnoreSslErrors(webSocketSamplerPanel.isIgnoreSslErrors()); - webSocketSamplerTestElement.setStreamingConnection(webSocketSamplerPanel.isStreamingConnection()); - webSocketSamplerTestElement.setConnectionId(webSocketSamplerPanel.getConnectionId()); - webSocketSamplerTestElement.setResponsePattern(webSocketSamplerPanel.getResponsePattern()); - webSocketSamplerTestElement.setCloseConncectionPattern(webSocketSamplerPanel.getCloseConncectionPattern()); - webSocketSamplerTestElement.setProxyAddress(webSocketSamplerPanel.getProxyAddress()); - webSocketSamplerTestElement.setProxyPassword(webSocketSamplerPanel.getProxyPassword()); - webSocketSamplerTestElement.setProxyPort(webSocketSamplerPanel.getProxyPort()); - webSocketSamplerTestElement.setProxyUsername(webSocketSamplerPanel.getProxyUsername()); - webSocketSamplerTestElement.setMessageBacklog(webSocketSamplerPanel.getMessageBacklog()); - - ArgumentsPanel queryStringParameters = webSocketSamplerPanel.getAttributePanel(); - if (queryStringParameters != null) { - webSocketSamplerTestElement.setQueryStringParameters((Arguments)queryStringParameters.createTestElement()); - } - } - } - - @Override - public void clearGui() { - super.clearGui(); - initFields(); - } - - private void init() { - webSocketSamplerPanel = new WebSocketApplicationConfig(); - } - - private void initFields() { - webSocketSamplerPanel.initFields(); - } -} diff --git a/src/main/java/JMeter/plugins/functional/samplers/websocket/ServiceSocket.java b/src/main/java/JMeter/plugins/functional/samplers/websocket/ServiceSocket.java index e168afb..0f4491e 100644 --- a/src/main/java/JMeter/plugins/functional/samplers/websocket/ServiceSocket.java +++ b/src/main/java/JMeter/plugins/functional/samplers/websocket/ServiceSocket.java @@ -6,7 +6,6 @@ import java.io.IOException; import java.util.Deque; -import java.util.Iterator; import java.util.LinkedList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -29,29 +28,24 @@ @WebSocket(maxTextMessageSize = 256 * 1024 * 1024) public class ServiceSocket { - protected final WebSocketSampler parent; + protected WebSocketSampler sampler; protected WebSocketClient client; private static final Logger log = LoggingManager.getLoggerForClass(); - protected Deque<String> responeBacklog = new LinkedList<String>(); + protected Deque<String> responeBacklog = new LinkedList<>(); protected Integer error = 0; protected StringBuffer logMessage = new StringBuffer(); protected CountDownLatch openLatch = new CountDownLatch(1); protected CountDownLatch closeLatch = new CountDownLatch(1); protected Session session = null; - protected String responsePattern; - protected String disconnectPattern; protected int messageCounter = 1; protected Pattern responseExpression; protected Pattern disconnectExpression; protected boolean connected = false; - public ServiceSocket(WebSocketSampler parent, WebSocketClient client) { - this.parent = parent; + public ServiceSocket(WebSocketSampler sampler, WebSocketClient client) { + this.sampler = sampler; this.client = client; - //Evaluate response matching patterns in case thay contain JMeter variables (i.e. ${var}) - responsePattern = new CompoundVariable(parent.getResponsePattern()).execute(); - disconnectPattern = new CompoundVariable(parent.getCloseConncectionPattern()).execute(); logMessage.append("\n\n[Execution Flow]\n"); logMessage.append(" - Opening new connection\n"); initializePatterns(); @@ -59,22 +53,20 @@ public ServiceSocket(WebSocketSampler parent, WebSocketClient client) { @OnWebSocketMessage public void onMessage(String msg) { - synchronized (parent) { - log.debug("Received message: " + msg); - String length = " (" + msg.length() + " bytes)"; - logMessage.append(" - Received message #").append(messageCounter).append(length); - addResponseMessage("[Message " + (messageCounter++) + "]\n" + msg + "\n\n"); - - if (responseExpression == null || responseExpression.matcher(msg).find()) { - logMessage.append("; matched response pattern").append("\n"); - closeLatch.countDown(); - } else if (!disconnectPattern.isEmpty() && disconnectExpression.matcher(msg).find()) { - logMessage.append("; matched connection close pattern").append("\n"); - closeLatch.countDown(); - close(StatusCode.NORMAL, "JMeter closed session."); - } else { - logMessage.append("; didn't match any pattern").append("\n"); - } + log.debug("Received message: " + msg); + String length = " (" + msg.length() + " bytes)"; + logMessage.append(" - Received message #").append(messageCounter).append(length); + addResponseMessage("[Message " + (messageCounter++) + "]\n" + msg + "\n\n"); + + if (responseExpression == null || responseExpression.matcher(msg).find()) { + logMessage.append("; matched response pattern").append("\n"); + closeLatch.countDown(); + } else if (disconnectExpression != null && disconnectExpression.matcher(msg).find()) { + logMessage.append("; matched connection close pattern").append("\n"); + closeLatch.countDown(); + close(StatusCode.NORMAL, "JMeter closed session."); + } else { + logMessage.append("; didn't match any pattern").append("\n"); } } @@ -111,19 +103,22 @@ public String getResponseMessage() { String responseMessage = ""; //Iterate through response messages saved in the responeBacklog cache - Iterator<String> iterator = responeBacklog.iterator(); - while (iterator.hasNext()) { - responseMessage += iterator.next(); + for (String aResponseBacklog : responeBacklog) { + responseMessage += aResponseBacklog; } return responseMessage; } + public void clearBacklog() { + responeBacklog.clear(); + } + public boolean awaitClose(int duration, TimeUnit unit) throws InterruptedException { logMessage.append(" - Waiting for messages for ").append(duration).append(" ").append(unit.toString()).append("\n"); boolean res = this.closeLatch.await(duration, unit); - if (!parent.isStreamingConnection()) { + if (!sampler.isStreamingConnection()) { close(StatusCode.NORMAL, "JMeter closed session."); } else { logMessage.append(" - Leaving streaming connection open").append("\n"); @@ -196,14 +191,14 @@ public String getLogMessage() { return logMessage.toString(); } - public void log(String message) { - logMessage.append(message); - } - protected void initializePatterns() { + //Evaluate response matching patterns in case thay contain JMeter variables (i.e. ${var}) + String responsePattern = new CompoundVariable(sampler.getResponsePattern()).execute(); + String disconnectPattern = new CompoundVariable(sampler.getCloseConncectionPattern()).execute(); + try { logMessage.append(" - Using response message pattern \"").append(responsePattern).append("\"\n"); - responseExpression = (responsePattern != null || !responsePattern.isEmpty()) ? Pattern.compile(responsePattern) : null; + responseExpression = (responsePattern != null && !responsePattern.isEmpty()) ? Pattern.compile(responsePattern) : null; } catch (Exception ex) { logMessage.append(" - Invalid response message regular expression pattern: ").append(ex.getLocalizedMessage()).append("\n"); log.error("Invalid response message regular expression pattern: " + ex.getLocalizedMessage()); @@ -212,7 +207,7 @@ protected void initializePatterns() { try { logMessage.append(" - Using disconnect pattern \"").append(disconnectPattern).append("\"\n"); - disconnectExpression = (disconnectPattern != null || !disconnectPattern.isEmpty()) ? Pattern.compile(disconnectPattern) : null; + disconnectExpression = (disconnectPattern != null && !disconnectPattern.isEmpty()) ? Pattern.compile(disconnectPattern) : null; } catch (Exception ex) { logMessage.append(" - Invalid disconnect regular expression pattern: ").append(ex.getLocalizedMessage()).append("\n"); log.error("Invalid disconnect regular regular expression pattern: " + ex.getLocalizedMessage()); @@ -228,19 +223,23 @@ public boolean isConnected() { return connected; } - public void initialize() { + public void initialize(WebSocketSampler sampler) { + this.sampler = sampler; + logMessage = new StringBuffer(); logMessage.append("\n\n[Execution Flow]\n"); logMessage.append(" - Reusing exising connection\n"); error = 0; + initializePatterns(); + this.closeLatch = new CountDownLatch(1); } private void addResponseMessage(String message) { int messageBacklog; try { - messageBacklog = Integer.parseInt(parent.getMessageBacklog()); + messageBacklog = Integer.parseInt(sampler.getMessageBacklog()); } catch (Exception ex) { logMessage.append(" - Message backlog value not set; using default ").append(WebSocketSampler.MESSAGE_BACKLOG_COUNT).append("\n"); messageBacklog = WebSocketSampler.MESSAGE_BACKLOG_COUNT; diff --git a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSampler.java b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSampler.java index 5cdc1de..7e76adf 100644 --- a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSampler.java +++ b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSampler.java @@ -8,6 +8,10 @@ import org.apache.commons.lang3.StringUtils; import org.apache.jmeter.config.Argument; import org.apache.jmeter.config.Arguments; +import org.apache.jmeter.protocol.http.control.CookieHandler; +import org.apache.jmeter.protocol.http.control.CookieManager; +import org.apache.jmeter.protocol.http.control.Header; +import org.apache.jmeter.protocol.http.control.HeaderManager; import org.apache.jmeter.protocol.http.util.EncoderCache; import org.apache.jmeter.protocol.http.util.HTTPArgument; import org.apache.jmeter.protocol.http.util.HTTPConstants; @@ -17,17 +21,24 @@ import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.property.*; import org.apache.jorphan.logging.LoggingManager; +import org.apache.jorphan.reflect.ClassTools; +import org.apache.jorphan.util.JMeterException; import org.apache.jorphan.util.JOrphanUtils; import org.apache.log.Logger; import java.io.UnsupportedEncodingException; +import java.net.HttpCookie; import java.net.URI; import java.net.URISyntaxException; +import java.net.URL; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.jmeter.testelement.TestStateListener; +import org.eclipse.jetty.util.HttpCookieStore; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -50,13 +61,18 @@ public class WebSocketSampler extends AbstractSampler implements TestStateListen private static final String DEFAULT_PROTOCOL = "ws"; private static Map<String, ServiceSocket> connectionList; + private static ExecutorService executor = Executors.newCachedThreadPool(); + + private HeaderManager headerManager; + private CookieManager cookieManager; + private CookieHandler cookieHandler; public WebSocketSampler() { super(); setName("WebSocket sampler"); } - private ServiceSocket getConnectionSocket() throws URISyntaxException, Exception { + private ServiceSocket getConnectionSocket() throws Exception { URI uri = getUri(); String connectionId = getThreadName() + getConnectionId(); @@ -65,12 +81,12 @@ private ServiceSocket getConnectionSocket() throws URISyntaxException, Exception //Create WebSocket client SslContextFactory sslContexFactory = new SslContextFactory(); sslContexFactory.setTrustAll(isIgnoreSslErrors()); - WebSocketClient webSocketClient = new WebSocketClient(sslContexFactory); + WebSocketClient webSocketClient = new WebSocketClient(sslContexFactory, executor); if (isStreamingConnection()) { if (connectionList.containsKey(connectionId)) { socket = connectionList.get(connectionId); - socket.initialize(); + socket.initialize(this); return socket; } else { socket = new ServiceSocket(this, webSocketClient); @@ -81,8 +97,29 @@ private ServiceSocket getConnectionSocket() throws URISyntaxException, Exception } //Start WebSocket client thread and upgrage HTTP connection + if (cookieManager != null) { + HttpCookieStore cookieStore = new HttpCookieStore(); + for (int i = 0; i < cookieManager.getCookieCount(); i++) { + HttpCookie cookie = new HttpCookie(cookieManager.get(i).getName(), cookieManager.get(i).getValue()); + cookie.setVersion(cookieManager.get(i).getVersion()); + cookieStore.add( + new URI(null, + cookieManager.get(i).getDomain(), + cookieManager.get(i).getPath(), + null), + cookie + ); + } + webSocketClient.setCookieStore(cookieStore); + } webSocketClient.start(); ClientUpgradeRequest request = new ClientUpgradeRequest(); + if (headerManager != null) { + for (int i = 0; i < headerManager.size(); i++) { + Header header = headerManager.get(i); + request.setHeader(header.getName(), header.getValue()); + } + } webSocketClient.connect(socket, uri, request); //Get connection timeout or use the default value @@ -95,7 +132,19 @@ private ServiceSocket getConnectionSocket() throws URISyntaxException, Exception } socket.awaitOpen(connectionTimeout, TimeUnit.MILLISECONDS); - + + if (cookieManager != null && cookieHandler != null) { + String setCookieHeader = socket.getSession().getUpgradeResponse().getHeader("set-cookie"); + if (setCookieHeader != null) { + cookieHandler.addCookieFromHeader(cookieManager, true, setCookieHeader, new URL( + uri.getScheme() == null || uri.getScheme().equalsIgnoreCase("ws") ? "HTTP" : "HTTPS", + uri.getHost(), + uri.getPort(), + uri.getQuery() != null ? uri.getPath() + "?" + uri.getQuery() : uri.getPath() + )); + } + } + return socket; } @@ -166,7 +215,10 @@ public SampleResult sample(Entry entry) { //set sampler response sampleResult.setResponseData(socket.getResponseMessage(), getContentEncoding()); - + + if (getClearBacklog()) + socket.clearBacklog(); + } catch (URISyntaxException e) { errorList.append(" - Invalid URI syntax: ").append(e.getMessage()).append("\n").append(StringUtils.join(e.getStackTrace(), "\n")).append("\n"); } catch (IOException e) { @@ -418,8 +470,14 @@ public String getMessageBacklog() { return getPropertyAsString("messageBacklog", "3"); } - - + public void setClearBacklog(Boolean clearBacklog) { + setProperty("clearBacklog", clearBacklog); + } + + public Boolean getClearBacklog() { + return getPropertyAsBoolean("clearBacklog", false); + } + public String getQueryString(String contentEncoding) { // Check if the sampler has a specified content encoding if (JOrphanUtils.isBlank(contentEncoding)) { @@ -430,7 +488,7 @@ public String getQueryString(String contentEncoding) { PropertyIterator iter = getQueryStringParameters().iterator(); boolean first = true; while (iter.hasNext()) { - HTTPArgument item = null; + HTTPArgument item; Object objectValue = iter.next().getObjectValue(); try { item = (HTTPArgument) objectValue; @@ -468,8 +526,7 @@ public void setQueryStringParameters(Arguments queryStringParameters) { } public Arguments getQueryStringParameters() { - Arguments args = (Arguments) getProperty("queryStringParameters").getObjectValue(); - return args; + return (Arguments) getProperty("queryStringParameters").getObjectValue(); } @@ -480,7 +537,7 @@ public void testStarted() { @Override public void testStarted(String host) { - connectionList = new ConcurrentHashMap<String, ServiceSocket>(); + connectionList = new ConcurrentHashMap<>(); } @Override @@ -495,6 +552,19 @@ public void testEnded(String host) { } } - - + @Override + public void addTestElement(TestElement el) { + if (el instanceof HeaderManager) { + headerManager = (HeaderManager) el; + } else if (el instanceof CookieManager) { + cookieManager = (CookieManager) el; + try { + cookieHandler = (CookieHandler) ClassTools.construct(cookieManager.getImplementation(), cookieManager.getPolicy()); + } catch (JMeterException e) { + log.error("Failed to construct cookie handler ", e); + } + } else { + super.addTestElement(el); + } + } } diff --git a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerGui.java b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerGui.java index 0b6933b..3a6fdc1 100644 --- a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerGui.java +++ b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerGui.java @@ -67,6 +67,7 @@ public void configure(TestElement element) { webSocketSamplerPanel.setProxyPort(webSocketSamplerTestElement.getProxyPort()); webSocketSamplerPanel.setProxyUsername(webSocketSamplerTestElement.getProxyUsername()); webSocketSamplerPanel.setMessageBacklog(webSocketSamplerTestElement.getMessageBacklog()); + webSocketSamplerPanel.setClearBacklog(webSocketSamplerTestElement.getClearBacklog()); Arguments queryStringParameters = webSocketSamplerTestElement.getQueryStringParameters(); if (queryStringParameters != null) { @@ -106,6 +107,7 @@ public void modifyTestElement(TestElement te) { webSocketSamplerTestElement.setProxyPort(webSocketSamplerPanel.getProxyPort()); webSocketSamplerTestElement.setProxyUsername(webSocketSamplerPanel.getProxyUsername()); webSocketSamplerTestElement.setMessageBacklog(webSocketSamplerPanel.getMessageBacklog()); + webSocketSamplerTestElement.setClearBacklog(webSocketSamplerPanel.getClearBacklog()); ArgumentsPanel queryStringParameters = webSocketSamplerPanel.getAttributePanel(); if (queryStringParameters != null) { diff --git a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.form b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.form deleted file mode 100644 index 2ed45b8..0000000 --- a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.form +++ /dev/null @@ -1,521 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> - <AuxValues> - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - </AuxValues> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jPanel3" max="32767" attributes="0"/> - <Component id="jPanel5" max="32767" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <Component id="jPanel1" max="32767" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jPanel2" max="32767" attributes="0"/> - </Group> - <Component id="jPanel6" max="32767" attributes="0"/> - </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jPanel2" min="-2" max="-2" attributes="0"/> - <Component id="jPanel1" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Component id="jPanel3" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jPanel5" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jPanel6" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Container class="javax.swing.JPanel" name="jPanel1"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="Web Server"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jLabel1" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="serverAddressTextField" max="32767" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jLabel2" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="serverPortTextField" min="-2" pref="43" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="serverAddressTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="serverPortTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel1"> - <Properties> - <Property name="text" type="java.lang.String" value="Server Name or IP:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="serverAddressTextField"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel2"> - <Properties> - <Property name="text" type="java.lang.String" value="Port Number:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="serverPortTextField"> - </Component> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel2"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="Timeout (milliseconds)"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jLabel3" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="connectionTimeoutTextField" max="32767" attributes="0"/> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Component id="jLabel17" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="responseTimeoutTextField" max="32767" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="connectionTimeoutTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel17" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="responseTimeoutTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel3"> - <Properties> - <Property name="text" type="java.lang.String" value="Connection:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="connectionTimeoutTextField"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel17"> - <Properties> - <Property name="text" type="java.lang.String" value="Response:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="responseTimeoutTextField"> - </Component> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel3"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="WebSocket Request"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="querystringAttributesPanel" max="32767" attributes="0"/> - <Component id="jScrollPane1" max="32767" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <Component id="jLabel15" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="implementationComboBox" pref="0" max="32767" attributes="0"/> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Component id="jLabel4" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="protocolTextField" min="-2" pref="40" max="-2" attributes="0"/> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Component id="jLabel6" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="contentEncodingTextField" min="-2" pref="40" max="-2" attributes="0"/> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Component id="jLabel8" min="-2" max="-2" attributes="0"/> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Component id="connectionIdTextField" max="32767" attributes="0"/> - </Group> - <Group type="102" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabel14" min="-2" max="-2" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <Component id="ignoreSslErrorsCheckBox" min="-2" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="streamingConnectionCheckBox" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <Component id="jLabel5" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="contextPathTextField" max="32767" attributes="0"/> - </Group> - </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="10" max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="protocolTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="contentEncodingTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="connectionIdTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel15" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="implementationComboBox" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="contextPathTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="ignoreSslErrorsCheckBox" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="streamingConnectionCheckBox" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="querystringAttributesPanel" pref="102" max="32767" attributes="0"/> - <EmptySpace min="-2" pref="8" max="-2" attributes="0"/> - <Component id="jLabel14" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="118" max="32767" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel4"> - <Properties> - <Property name="text" type="java.lang.String" value="Protocol [ws/wss]:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel5"> - <Properties> - <Property name="text" type="java.lang.String" value="Path:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel6"> - <Properties> - <Property name="text" type="java.lang.String" value="Content encoding:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="contextPathTextField"> - </Component> - <Component class="javax.swing.JTextField" name="protocolTextField"> - <Properties> - <Property name="toolTipText" type="java.lang.String" value=""/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="contentEncodingTextField"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel8"> - <Properties> - <Property name="text" type="java.lang.String" value="Connection Id:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="connectionIdTextField"> - </Component> - <Container class="javax.swing.JPanel" name="querystringAttributesPanel"> - - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> - </Container> - <Component class="javax.swing.JCheckBox" name="ignoreSslErrorsCheckBox"> - <Properties> - <Property name="text" type="java.lang.String" value="Ignore SSL certificate errors"/> - </Properties> - </Component> - <Container class="javax.swing.JScrollPane" name="jScrollPane1"> - <AuxValues> - <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> - </AuxValues> - - <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> - <SubComponents> - <Component class="javax.swing.JEditorPane" name="requestPayloadEditorPane"> - </Component> - </SubComponents> - </Container> - <Component class="javax.swing.JLabel" name="jLabel14"> - <Properties> - <Property name="text" type="java.lang.String" value="Request data"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel15"> - <Properties> - <Property name="text" type="java.lang.String" value="Implementation:"/> - </Properties> - </Component> - <Component class="javax.swing.JComboBox" name="implementationComboBox"> - <Properties> - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> - <StringArray count="1"> - <StringItem index="0" value="RFC6455 (v13)"/> - </StringArray> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JCheckBox" name="streamingConnectionCheckBox"> - <Properties> - <Property name="text" type="java.lang.String" value="Streaming connection"/> - </Properties> - </Component> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel5"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="WebSocket Response"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Component id="jLabel7" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="responsePatternTextField" max="32767" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="jLabel16" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="messageBacklogTextField" min="-2" pref="40" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="1" attributes="0"> - <Component id="jLabel9" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="closeConncectionPatternTextField" max="32767" attributes="0"/> - </Group> - </Group> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="103" alignment="0" groupAlignment="3" attributes="0"> - <Component id="jLabel16" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="messageBacklogTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="responsePatternTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="closeConncectionPatternTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel7"> - <Properties> - <Property name="text" type="java.lang.String" value="Response pattern:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="responsePatternTextField"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel9"> - <Properties> - <Property name="text" type="java.lang.String" value="Close connection pattern:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="closeConncectionPatternTextField"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel16"> - <Properties> - <Property name="text" type="java.lang.String" value="Message backlog:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="messageBacklogTextField"> - </Component> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel6"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> - <TitledBorder title="Proxy Server (currently not supported by Jetty)"/> - </Border> - </Property> - </Properties> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jLabel10" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="proxyAddressTextField" max="32767" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jLabel11" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="proxyPortTextField" min="-2" pref="39" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="jLabel12" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="proxyUsernameTextField" min="-2" pref="64" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> - <Component id="jLabel13" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="proxyPasswordTextField" min="-2" pref="64" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="103" alignment="0" groupAlignment="3" attributes="0"> - <Component id="proxyUsernameTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="proxyPortTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="proxyAddressTextField" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="proxyPasswordTextField" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel10"> - <Properties> - <Property name="text" type="java.lang.String" value="Server Name or IP:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="proxyAddressTextField"> - <Properties> - <Property name="enabled" type="boolean" value="false"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel11"> - <Properties> - <Property name="text" type="java.lang.String" value="Port Number:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="proxyPortTextField"> - <Properties> - <Property name="enabled" type="boolean" value="false"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel12"> - <Properties> - <Property name="text" type="java.lang.String" value="Username:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="proxyUsernameTextField"> - <Properties> - <Property name="enabled" type="boolean" value="false"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel13"> - <Properties> - <Property name="text" type="java.lang.String" value="Password:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="proxyPasswordTextField"> - <Properties> - <Property name="enabled" type="boolean" value="false"/> - </Properties> - </Component> - </SubComponents> - </Container> - </SubComponents> -</Form> diff --git a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.java b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.java index 4185aa6..b2b5c35 100644 --- a/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.java +++ b/src/main/java/JMeter/plugins/functional/samplers/websocket/WebSocketSamplerPanel.java @@ -71,6 +71,7 @@ private void initComponents() { closeConncectionPatternTextField = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); messageBacklogTextField = new javax.swing.JTextField(); + clearBacklogCheckBox = new javax.swing.JCheckBox(); jPanel6 = new javax.swing.JPanel(); jLabel10 = new javax.swing.JLabel(); proxyAddressTextField = new javax.swing.JTextField(); @@ -250,6 +251,8 @@ private void initComponents() { jLabel16.setText("Message backlog:"); + clearBacklogCheckBox.setText("Clear backlog"); + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( @@ -264,7 +267,9 @@ private void initComponents() { .addGap(18, 18, 18) .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(messageBacklogTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(messageBacklogTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(clearBacklogCheckBox)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -276,6 +281,8 @@ private void initComponents() { .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(clearBacklogCheckBox)) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16) .addComponent(messageBacklogTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) @@ -413,6 +420,7 @@ private void initComponents() { private javax.swing.JPanel jPanel6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField messageBacklogTextField; + private javax.swing.JCheckBox clearBacklogCheckBox; private javax.swing.JTextField protocolTextField; private javax.swing.JTextField proxyAddressTextField; private javax.swing.JTextField proxyPasswordTextField; @@ -580,7 +588,15 @@ public void setMessageBacklog(String messageBacklog) { public String getMessageBacklog() { return messageBacklogTextField.getText(); - } + } + + public void setClearBacklog(Boolean clearBacklog) { + clearBacklogCheckBox.setSelected(clearBacklog); + } + + public Boolean getClearBacklog() { + return clearBacklogCheckBox.isSelected(); + } /** * @return the attributePanel