Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use of object variable in ForEachController #1763

Closed
asfimport opened this issue Jul 24, 2006 · 2 comments
Closed

Enable use of object variable in ForEachController #1763

asfimport opened this issue Jul 24, 2006 · 2 comments

Comments

@asfimport
Copy link
Collaborator

Guillaume Lasnier (Bug 40099):
The ForEachController currently supports string input variables from the JMeter
context.
Some Sampler such as the Bean Shell sampler could require to iterate over a list
of java.lang.Object instance stored in the JMeter context via the putObject()
and getObject() methods

OS: All

@asfimport
Copy link
Collaborator Author

Guillaume Lasnier (migrated from Bugzilla):
The attached patch replaces all the JMeterVariables.get() and
JMeterVariables.put() occurences by JMeterVariables.getObject() and
JMeterVariables.putObject(). This doesn't change the previous behaviour.

Created attachment ForEachController.txt: Change access to JMeterContext variables

ForEachController.txt
Index: D:/Development/Eclipse/Workspace/jmeter/src/components/org/apache/jmeter/control/ForeachController.java
===================================================================
--- D:/Development/Eclipse/Workspace/jmeter/src/components/org/apache/jmeter/control/ForeachController.java	(revision 424313)
+++ D:/Development/Eclipse/Workspace/jmeter/src/components/org/apache/jmeter/control/ForeachController.java	(working copy)
@@ -95,9 +95,9 @@
 	public boolean isDone() {
 		JMeterContext context = getThreadContext();
 		String inputVariable = getInputVal() + getSeparator() + (loopCount + 1);
-		if (context.getVariables().get(inputVariable) != null) {
-			context.getVariables().put(getReturnVal(), context.getVariables().get(inputVariable));
-			log.debug("ForEach resultstring isDone=" + context.getVariables().get(getReturnVal()));
+		if (context.getVariables().getObject(inputVariable) != null) {
+			context.getVariables().putObject(getReturnVal(), context.getVariables().getObject(inputVariable));
+			log.debug("ForEach resultstring isDone=" + context.getVariables().getObject(getReturnVal()));
 			return false;
 		}
 		return super.isDone();
@@ -106,7 +106,7 @@
 	private boolean endOfArguments() {
 		JMeterContext context = getThreadContext();
 		String inputVariable = getInputVal() + getSeparator() + (loopCount + 1);
-		if (context.getVariables().get(inputVariable) != null) {
+		if (context.getVariables().getObject(inputVariable) != null) {
 			log.debug("ForEach resultstring eofArgs= false");
 			return false;
 		}
@@ -131,7 +131,7 @@
 	private boolean emptyList() {
 		JMeterContext context = getThreadContext();
 		String inputVariable = getInputVal() + getSeparator() + "1";
-		if (context.getVariables().get(inputVariable) != null) {
+		if (context.getVariables().getObject(inputVariable) != null) {
 			return false;
 		}
 		log.debug("No entries found - null first entry: " + inputVariable);

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Thanks - added in r552482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant