jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1335210 - /jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java
Date Mon, 07 May 2012 19:30:51 GMT
Author: pmouawad
Date: Mon May  7 19:30:51 2012
New Revision: 1335210

URL: http://svn.apache.org/viewvc?rev=1335210&view=rev
Log:
Bug 53172 - OS Process Sampler - allow specification of Environment Variables
Code cleanup

Modified:
    jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java

Modified: jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java?rev=1335210&r1=1335209&r2=1335210&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java
(original)
+++ jmeter/trunk/src/protocol/native/org/apache/jmeter/protocol/system/gui/SystemSamplerGui.java
Mon May  7 19:30:51 2012
@@ -28,6 +28,7 @@ import javax.swing.BoxLayout;
 import javax.swing.JCheckBox;
 import javax.swing.JPanel;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.config.gui.ArgumentsPanel;
@@ -99,29 +100,35 @@ public class SystemSamplerGui extends Ab
 
     public void modifyTestElement(TestElement sampler) {
         super.configureTestElement(sampler);
-        sampler.setProperty(SystemSampler.CHECK_RETURN_CODE, Boolean.toString(checkReturnCode.isSelected()));
+        SystemSampler systemSampler = (SystemSampler)sampler;
+        systemSampler.setCheckReturnCode(checkReturnCode.isSelected());
         if(checkReturnCode.isSelected()) {
-            sampler.setProperty(SystemSampler.EXPECTED_RETURN_CODE, desiredReturnCode.getText());
+            if(!StringUtils.isEmpty(desiredReturnCode.getText())) {
+                systemSampler.setExpectedReturnCode(Integer.parseInt(desiredReturnCode.getText()));
+            } else {
+                systemSampler.setExpectedReturnCode(SystemSampler.DEFAULT_RETURN_CODE);
+            }
         } else {
-            sampler.setProperty(SystemSampler.EXPECTED_RETURN_CODE, "");
+            systemSampler.setExpectedReturnCode(SystemSampler.DEFAULT_RETURN_CODE);
         }
-        sampler.setProperty(SystemSampler.COMMAND, command.getText());
-        ((SystemSampler)sampler).setArguments((Arguments)argsPanel.createTestElement());
-        ((SystemSampler)sampler).setEnvironmentVariables((Arguments)envPanel.createTestElement());
-        sampler.setProperty(SystemSampler.DIRECTORY, directory.getText());
+        systemSampler.setCommand(command.getText());
+        systemSampler.setArguments((Arguments)argsPanel.createTestElement());
+        systemSampler.setEnvironmentVariables((Arguments)envPanel.createTestElement());
+        systemSampler.setDirectory(directory.getText());
     }
 
     /* Overrides AbstractJMeterGuiComponent.configure(TestElement) */
     @Override
     public void configure(TestElement el) {
         super.configure(el);
-        checkReturnCode.setSelected(el.getPropertyAsBoolean(SystemSampler.CHECK_RETURN_CODE));
-        desiredReturnCode.setText(el.getPropertyAsString(SystemSampler.EXPECTED_RETURN_CODE));
+        SystemSampler systemSampler = (SystemSampler) el;
+        checkReturnCode.setSelected(systemSampler.getCheckReturnCode());
+        desiredReturnCode.setText(Integer.toString(systemSampler.getExpectedReturnCode()));
         desiredReturnCode.setEnabled(checkReturnCode.isSelected());
-        command.setText(el.getPropertyAsString(SystemSampler.COMMAND));
-        argsPanel.configure((Arguments)el.getProperty(SystemSampler.ARGUMENTS).getObjectValue());
-        envPanel.configure((Arguments)el.getProperty(SystemSampler.ENVIRONMENT).getObjectValue());
-        directory.setText(el.getPropertyAsString(SystemSampler.DIRECTORY));
+        command.setText(systemSampler.getCommand());
+        argsPanel.configure(systemSampler.getArguments());
+        envPanel.configure(systemSampler.getEnvironmentVariables());
+        directory.setText(systemSampler.getDirectory());
     }
 
     /**



Mime
View raw message