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 2006/03/26 00:04:27 UTC
svn commit: r388851 - in /jakarta/jmeter/branches/rel-2-1:
src/examples/org/apache/jmeter/examples/testbeans/example1/Example1.java
src/examples/org/apache/jmeter/examples/testbeans/example2/Example2.java
xdocs/changes.xml
Author: sebb
Date: Sat Mar 25 15:04:25 2006
New Revision: 388851
URL: http://svn.apache.org/viewcvs?rev=388851&view=rev
Log:
Fix TestBean Examples so that they work
Modified:
jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example1/Example1.java
jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example2/Example2.java
jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml
Modified: jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example1/Example1.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example1/Example1.java?rev=388851&r1=388850&r2=388851&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example1/Example1.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example1/Example1.java Sat Mar 25 15:04:25 2006
@@ -1,6 +1,5 @@
-//$Header$
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2004, 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,23 +29,28 @@
* do nothing -- nothing useful, in any case.
*/
public class Example1 extends AbstractSampler implements TestBean {
- public SampleResult sample(Entry e) {
- return new SampleResult();
- }
+ public SampleResult sample(Entry e) {
+ SampleResult res = new SampleResult();
+ res.setSampleLabel(getName());
+ res.setSamplerData(myStringProperty);
+ res.sampleStart();
+ // Do something ...
+ res.setResponseData(myStringProperty.toUpperCase().getBytes());
+ res.setDataType(SampleResult.TEXT);
+ res.sampleEnd();
+ res.setSuccessful(true);
+ return res;
+ }
+ private String myStringProperty;
+
// A String property:
public void setMyStringProperty(String s) {
+ myStringProperty=s;
};
public String getMyStringProperty() {
- return "";
+ return myStringProperty;
}
- // A String[] property:
- public void setMyStrings(String[] s) {
- };
-
- public String[] getMyStrings() {
- return null;
- }
}
Modified: jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example2/Example2.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example2/Example2.java?rev=388851&r1=388850&r2=388851&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example2/Example2.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/examples/org/apache/jmeter/examples/testbeans/example2/Example2.java Sat Mar 25 15:04:25 2006
@@ -1,6 +1,5 @@
-//$Header$
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,17 +29,30 @@
* do nothing -- nothing useful, in any case.
*/
public class Example2 extends AbstractSampler implements TestBean {
+
public SampleResult sample(Entry e) {
- return new SampleResult();
+ SampleResult res = new SampleResult();
+ res.setSampleLabel(getName());
+ res.setSamplerData(myStringProperty);
+ res.sampleStart();
+ // Do something ...
+ res.setResponseData(myStringProperty.toLowerCase().getBytes());
+ res.setDataType(SampleResult.TEXT);
+ res.sampleEnd();
+ res.setSuccessful(true);
+ return res;
}
+ private String myStringProperty;
+
// A TestBean is a Java Bean. Just define some properties and they will
- // autmagically show up in the GUI.
+ // automagically show up in the GUI.
// A String property:
public void setMyStringProperty(String s) {
+ myStringProperty=s;
};
public String getMyStringProperty() {
- return "";
+ return myStringProperty;
}
}
Modified: jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml?rev=388851&r1=388850&r2=388851&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml Sat Mar 25 15:04:25 2006
@@ -106,6 +106,7 @@
<li>Sample Result converter saves response code as "rc". Previously it saved as "rs" but read with "rc"; it will now also read with "rc".
The XSL stylesheets also now accept either "rc" or "rs"</li>
<li>Fix counter function so each counter instance is independent (previously the per-user counters were shared between instances of the function)</li>
+<li>Fix TestBean Examples so that they work</li>
</ul>
<h4>Other changes</h4>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org