You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/10/30 15:45:37 UTC
svn commit: r590093 - in /jakarta/jmeter/trunk:
src/components/org/apache/jmeter/sampler/TestAction.java
src/components/org/apache/jmeter/sampler/gui/TestActionGui.java
src/core/org/apache/jmeter/resources/messages.properties xdocs/changes.xml
Author: sebb
Date: Tue Oct 30 07:45:25 2007
New Revision: 590093
URL: http://svn.apache.org/viewvc?rev=590093&view=rev
Log:
Bug 43727 - Test Action does not support variables or functions
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
jakarta/jmeter/trunk/xdocs/changes.xml
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java?rev=590093&r1=590092&r2=590093&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/TestAction.java Tue Oct 30 07:45:25 2007
@@ -21,8 +21,11 @@
import org.apache.jmeter.samplers.Entry;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.property.IntegerProperty;
+import org.apache.jmeter.testelement.property.StringProperty;
import org.apache.jmeter.threads.JMeterContext;
import org.apache.jmeter.threads.JMeterContextService;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
/**
* Dummy Sampler used to pause or stop a thread or the test;
@@ -30,6 +33,9 @@
*
*/
public class TestAction extends AbstractSampler {
+
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
// Actions
public final static int STOP = 0;
public final static int PAUSE = 1;
@@ -46,9 +52,6 @@
public TestAction() {
super();
- setTarget(THREAD);
- setAction(PAUSE);
- setDuration(0);
}
/*
@@ -62,7 +65,7 @@
int target = getTarget();
int action = getAction();
if (action == PAUSE) {
- pause(getDuration());
+ pause(getDurationAsString());
} else if (action == STOP) {
if (target == THREAD) {
context.getThread().stop();
@@ -79,7 +82,14 @@
return null; // This means no sample is saved
}
- private void pause(int milis) {
+ private void pause(String mili_s) {
+ int milis;
+ try {
+ milis=Integer.parseInt(mili_s);
+ } catch (NumberFormatException e){
+ log.warn("Could not create number from "+mili_s);
+ milis=0;
+ }
try {
Thread.sleep(milis);
} catch (InterruptedException e) {
@@ -102,11 +112,11 @@
return getPropertyAsInt(ACTION);
}
- public void setDuration(int duration) {
- setProperty(new IntegerProperty(DURATION, duration));
+ public void setDuration(String duration) {
+ setProperty(new StringProperty(DURATION, duration));
}
- public int getDuration() {
- return getPropertyAsInt(DURATION);
+ public String getDurationAsString() {
+ return getPropertyAsString(DURATION);
}
}
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java?rev=590093&r1=590092&r2=590093&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/sampler/gui/TestActionGui.java Tue Oct 30 07:45:25 2007
@@ -55,7 +55,7 @@
private int action;
- private int duration;
+ private String durationString;
// String in the panel
private static final String targetLabel = JMeterUtils.getResString("test_action_target"); // $NON-NLS-1$
@@ -76,6 +76,7 @@
super();
target = TestAction.THREAD;
action = TestAction.PAUSE;
+ durationString = ""; // $NON-NLS-1$
init();
}
@@ -99,8 +100,8 @@
else
stopButton.setSelected(true);
- duration = ta.getDuration();
- durationField.setText(Integer.toString(duration));
+ durationString = ta.getDurationAsString();
+ durationField.setText(durationString);
}
/**
@@ -122,7 +123,7 @@
TestAction ta = (TestAction) element;
ta.setAction(action);
ta.setTarget(target);
- ta.setDuration(duration);
+ ta.setDuration(durationString);
}
/**
@@ -132,12 +133,12 @@
super.clearGui();
targetBox.setSelectedIndex(0);
+ durationString = ""; //$NON-NLS-1$
durationField.setText(""); //$NON-NLS-1$
pauseButton.setSelected(true);
stopButton.setSelected(false);
action = TestAction.PAUSE;
target = TestAction.THREAD;
- duration = 0;
}
@@ -196,17 +197,11 @@
// Duration
HorizontalPanel durationPanel = new HorizontalPanel();
- durationField = new JTextField(5);
- durationField.setText(Integer.toString(duration));
+ durationField = new JTextField(15);
+ durationField.setText("");
durationField.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
- try {
- duration = Integer.parseInt(durationField.getText());
- } catch (NumberFormatException nfe) {
- duration = 0;
- // alert
- // durationField.grabFocus();
- }
+ durationString = durationField.getText();
}
public void focusGained(FocusEvent e) {
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=590093&r1=590092&r2=590093&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Tue Oct 30 07:45:25 2007
@@ -731,7 +731,7 @@
template_field=Template\:
test=Test
test_action_action=Action
-test_action_duration=Duration
+test_action_duration=Duration (milliseconds)
test_action_pause=Pause
test_action_stop=Stop
test_action_target=Target
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=590093&r1=590092&r2=590093&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue Oct 30 07:45:25 2007
@@ -84,6 +84,7 @@
<li>Bug 43485 - Ability to specify keep-alive on SOAP/XML-RPC request</li>
<li>Bug 43678 - Handle META tag http-equiv charset</li>
<li>Bug 42555 - [I18N] Proposed corrections for the french translation</li>
+<li>Bug 43727 - Test Action does not support variables or functions</li>
</ul>
<h4>Non-functional Improvements</h4>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org