jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1827519 - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui: ProxyControlGui.java RecorderDialog.java
Date Thu, 22 Mar 2018 18:16:07 GMT
Author: pmouawad
Date: Thu Mar 22 18:16:07 2018
New Revision: 1827519

URL: http://svn.apache.org/viewvc?rev=1827519&view=rev
Log:
Bug 62212 - Recorder : Improve UX by providing a popup above all windows to be able to change
Transaction names and pauses while using Browser
Fix some bugs 
Improve a bit architecture
Bugzilla Id: 62212

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/RecorderDialog.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java?rev=1827519&r1=1827518&r2=1827519&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
Thu Mar 22 18:16:07 2018
@@ -425,12 +425,14 @@ public class ProxyControlGui extends Log
             restart.setEnabled(false);
             recorderDialog.setVisible(false);
         } else if (command.equals(ACTION_START)) {
-            startProxy();
-            recorderDialog.setVisible(true);
+            if(startProxy()) {
+                recorderDialog.setVisible(true);
+            }
         } else if (command.equals(ACTION_RESTART)) {
             model.stopProxy();
-            startProxy();
-            recorderDialog.setVisible(true);
+            if(startProxy()) {
+                recorderDialog.setVisible(true);
+            }
         } else if (command.equals(ENABLE_RESTART)){
             enableRestart();
         } else if (command.equals(ADD_EXCLUDE)) {
@@ -553,7 +555,7 @@ public class ProxyControlGui extends Log
         }
     }
 
-    private void startProxy() {
+    private boolean startProxy() {
         ValueReplacer replacer = GuiPackage.getInstance().getReplacer();
         modifyTestElement(model);
         TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper)targetNodesModel.getSelectedItem();
@@ -564,7 +566,7 @@ public class ProxyControlGui extends Log
                         JMeterUtils.getResString("proxy_cl_wrong_target_cl"), // $NON-NLS-1$
                         JMeterUtils.getResString("error_title"), // $NON-NLS-1$
                         JOptionPane.ERROR_MESSAGE);
-                return;
+                return false;
             }
         }
         // Proxy can take some while to start up; show a waiting cursor
@@ -602,21 +604,25 @@ public class ProxyControlGui extends Log
                     + JMeterUtils.getResString("proxy_daemon_msg_created_in_bin"), // $NON-NLS-1$
                     JOptionPane.INFORMATION_MESSAGE);
             }
+            return true;
         } catch (InvalidVariableException e) {
             JOptionPane.showMessageDialog(this,
                     JMeterUtils.getResString("invalid_variables")+": "+e.getMessage(), //
$NON-NLS-1$ $NON-NLS-2$
                     JMeterUtils.getResString("error_title"), // $NON-NLS-1$
                     JOptionPane.ERROR_MESSAGE);
+            return false;
         } catch (BindException e) {
             JOptionPane.showMessageDialog(this,
                     JMeterUtils.getResString("proxy_daemon_bind_error")+": "+e.getMessage(),
// $NON-NLS-1$ $NON-NLS-2$
                     JMeterUtils.getResString("error_title"), // $NON-NLS-1$
                     JOptionPane.ERROR_MESSAGE);
+            return false;
         } catch (IOException e) {
             JOptionPane.showMessageDialog(this,
                     JMeterUtils.getResString("proxy_daemon_error")+": "+e.getMessage(), //
$NON-NLS-1$ $NON-NLS-2$
                     JMeterUtils.getResString("error_title"), // $NON-NLS-1$
                     JOptionPane.ERROR_MESSAGE);
+            return false;
         } finally {
             setCursor(cursor);
         }
@@ -1171,8 +1177,31 @@ public class ProxyControlGui extends Log
         MenuFactory.addFileMenu(pop);
         return pop;
     }
-    
-    ProxyControl getRecorderModel() {
-        return model;
+
+    int getHTTPSampleNamingMode() {
+        return httpSampleNamingMode.getSelectedIndex();
+    }
+
+    String getProxyPauseHTTPSample() {
+        return proxyPauseHTTPSample.getText();
+    }
+
+    public String getPrefixHTTPSampleName() {
+        return prefixHTTPSampleName.getText();
+    }
+
+    void setHTTPSampleNamingMode(int selectedIndex) {
+        httpSampleNamingMode.setSelectedIndex(selectedIndex);
+        model.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex());
+    }
+
+    void setProxyPauseHTTPSample(String text) {
+        proxyPauseHTTPSample.setText(text);
+        model.setProxyPauseHTTPSample(text);
+    }
+
+    void setPrefixHTTPSampleName(String text) {
+        prefixHTTPSampleName.setText(text);
+        model.setPrefixHTTPSampleName(text);
     }
 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/RecorderDialog.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/RecorderDialog.java?rev=1827519&r1=1827518&r2=1827519&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/RecorderDialog.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/RecorderDialog.java
Thu Mar 22 18:16:07 2018
@@ -163,8 +163,9 @@ public class RecorderDialog extends JDia
     public void setVisible(boolean b) {
         super.setVisible(b);
         prefixHTTPSampleName.requestFocusInWindow();
-        httpSampleNamingMode.setSelectedIndex(recorderGui.getRecorderModel().getHTTPSampleNamingMode());
-        proxyPauseHTTPSample.setText(recorderGui.getRecorderModel().getProxyPauseHTTPSample());
+        prefixHTTPSampleName.setText(recorderGui.getPrefixHTTPSampleName());
+        httpSampleNamingMode.setSelectedIndex(recorderGui.getHTTPSampleNamingMode());
+        proxyPauseHTTPSample.setText(recorderGui.getProxyPauseHTTPSample());
         setAlwaysOnTop(b);
     }
 
@@ -173,7 +174,7 @@ public class RecorderDialog extends JDia
         if (e.getSource() instanceof JComboBox) {
             JComboBox combo = (JComboBox) e.getSource();
             if(ProxyControlGui.HTTP_SAMPLER_NAMING_MODE.equals(combo.getName())){
-                recorderGui.getRecorderModel().setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex());
+                recorderGui.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex());
             }
         }
         else {
@@ -198,7 +199,7 @@ public class RecorderDialog extends JDia
     public void keyReleased(KeyEvent e) {
         String fieldName = e.getComponent().getName();
         if(fieldName.equals(ProxyControlGui.PREFIX_HTTP_SAMPLER_NAME)) {
-            recorderGui.getRecorderModel().setPrefixHTTPSampleName(prefixHTTPSampleName.getText());
+            recorderGui.setPrefixHTTPSampleName(prefixHTTPSampleName.getText());
         } else if(fieldName.equals(ProxyControlGui.PROXY_PAUSE_HTTP_SAMPLER)) {
             try {
                 Long.parseLong(proxyPauseHTTPSample.getText());
@@ -212,7 +213,7 @@ public class RecorderDialog extends JDia
                     proxyPauseHTTPSample.setText(proxyPauseHTTPSample.getText().substring(0,
length - 1));
                 }
             }
-            recorderGui.getRecorderModel().setProxyPauseHTTPSample(proxyPauseHTTPSample.getText());
+            recorderGui.setProxyPauseHTTPSample(proxyPauseHTTPSample.getText());
             recorderGui.enableRestart();
         }
     }



Mime
View raw message