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 2008/07/07 01:42:14 UTC

svn commit: r674362 [5/6] - in /jakarta/jmeter/trunk/src/core/org/apache/jmeter: ./ config/ config/gui/ control/ control/gui/ engine/ engine/event/ engine/util/ exceptions/

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java Sun Jul  6 16:42:12 2008
@@ -5,15 +5,15 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations
  * under the License.
- *  
+ *
  */
 
 package org.apache.jmeter.engine;
@@ -52,37 +52,37 @@
 /**
  */
 public class StandardJMeterEngine implements JMeterEngine, JMeterThreadMonitor, Runnable, Serializable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	private static final long serialVersionUID = 231L; // Remember to change this when the class changes ...
-	
-	private transient Thread runningThread;
+    private static final long serialVersionUID = 231L; // Remember to change this when the class changes ...
 
-	private static final long WAIT_TO_DIE = 5 * 1000; // 5 seconds
+    private transient Thread runningThread;
 
-	private transient Map allThreads;
+    private static final long WAIT_TO_DIE = 5 * 1000; // 5 seconds
 
-	private volatile boolean startingGroups; // flag to show that groups are still being created
-	
-	private boolean running = false;
+    private transient Map allThreads;
 
-	private boolean serialized = false;
+    private volatile boolean startingGroups; // flag to show that groups are still being created
 
-	private volatile boolean schcdule_run = false;
+    private boolean running = false;
 
-	private HashTree test;
+    private boolean serialized = false;
 
-	private transient SearchByClass testListeners;
+    private volatile boolean schcdule_run = false;
 
-	private String host = null;
+    private HashTree test;
 
-	private transient ListenerNotifier notifier;
+    private transient SearchByClass testListeners;
 
-	// Should we exit at end of the test? (only applies to server, because host is non-null)
-	private static final boolean exitAfterTest =
-		JMeterUtils.getPropDefault("server.exitaftertest", false);  // $NON-NLS-1$
+    private String host = null;
 
-    private static final boolean startListenersLater = 
+    private transient ListenerNotifier notifier;
+
+    // Should we exit at end of the test? (only applies to server, because host is non-null)
+    private static final boolean exitAfterTest =
+        JMeterUtils.getPropDefault("server.exitaftertest", false);  // $NON-NLS-1$
+
+    private static final boolean startListenersLater =
         JMeterUtils.getPropDefault("jmeterengine.startlistenerslater", true); // $NON-NLS-1$
 
     static {
@@ -91,465 +91,465 @@
             log.info("To revert to the earlier behaviour, define jmeterengine.startlistenerslater=false");
         }
     }
-	// Allow engine and threads to be stopped from outside a thread
-	// e.g. from beanshell server
-	// Assumes that there is only one instance of the engine
-	// at any one time so it is not guaranteed to work ...
-	private static transient Map allThreadNames;
-
-	private static StandardJMeterEngine engine;
-
-	private static Map allThreadsSave;
-
-	public static void stopEngineNow() {
-		if (engine != null) {// May be null if called from Unit test
-			engine.stopTest(true);
-		}
-	}
-
-	public static void stopEngine() {
-		if (engine != null) { // May be null if called from Unit test
-			engine.stopTest(false);
-		}
-	}
-
-	/*
-	 * Allow functions etc to register for testStopped notification
-	 */
-	private static final List testList = new ArrayList();
-
-	public static synchronized void register(TestListener tl) {
-		testList.add(tl);
-	}
-
-	public static boolean stopThread(String threadName) {
-		return stopThread(threadName, false);
-	}
-
-	public static boolean stopThreadNow(String threadName) {
-		return stopThread(threadName, true);
-	}
-
-	private static boolean stopThread(String threadName, boolean now) {
-		if (allThreadNames == null) {
-		    return false;// e.g. not yet started
-		}
-		JMeterThread thrd;
-		try {
-			thrd = (JMeterThread) allThreadNames.get(threadName);
-		} catch (Exception e) {
-			log.warn("stopThread: " + e);
-			return false;
-		}
-		if (thrd != null) {
-			thrd.stop();
-			if (now) {
-				Thread t = (Thread) allThreadsSave.get(thrd);
-				if (t != null) {
-					t.interrupt();
-				}
-			}
-			return true;
-		}
-		return false;
-	}
-
-	// End of code to allow engine to be controlled remotely
-
-	public StandardJMeterEngine() {
-		allThreads = new HashMap();
-		engine = this;
-		allThreadNames = new HashMap();
-		allThreadsSave = allThreads;
-	}
-
-	public StandardJMeterEngine(String host) {
-		this();
-		this.host = host;
-	}
-
-	public void configure(HashTree testTree) {
-		test = testTree;
-	}
-
-	public void setHost(String host) {
-		this.host = host;
-	}
-
-	protected HashTree getTestTree() {
-		return test;
-	}
-
-	protected void compileTree() {
-		PreCompiler compiler = new PreCompiler();
-		getTestTree().traverse(compiler);
-	}
-
-	// TODO: in Java1.5, perhaps we can use Thread.setUncaughtExceptionHandler() instead
-	private static class MyThreadGroup extends java.lang.ThreadGroup{
-	    public MyThreadGroup(String s) {
-	        super(s);
-	      }
-	      
-	      public void uncaughtException(Thread t, Throwable e) {
-	    	if (!(e instanceof ThreadDeath)) {
-	    		log.error("Uncaught exception: ", e);
-	    		System.err.println("Uncaught Exception " + e + ". See log file for details.");
-	    	}
-	      }
-
-	}
-	public void runTest() throws JMeterEngineException {
-		try {
-			runningThread = new Thread(new MyThreadGroup("JMeterThreadGroup"),this);
-			runningThread.start();
-		} catch (Exception err) {
-			stopTest();
-			StringWriter string = new StringWriter();
-			PrintWriter writer = new PrintWriter(string);
-			err.printStackTrace(writer);
-			throw new JMeterEngineException(string.toString());
-		}
-	}
-
-	private void removeThreadGroups(List elements) {
-		Iterator iter = elements.iterator();
-		while (iter.hasNext()) {
-			Object item = iter.next();
-			if (item instanceof ThreadGroup) {
-				iter.remove();
-			} else if (!(item instanceof TestElement)) {
-				iter.remove();
-			}
-		}
-	}
-
-	protected void notifyTestListenersOfStart() {
-		Iterator iter = testListeners.getSearchResults().iterator();
-		while (iter.hasNext()) {
-			TestListener tl = (TestListener) iter.next();
-			if (tl instanceof TestBean) {
-			    TestBeanHelper.prepare((TestElement) tl);
-			}
-			if (host == null) {
-				tl.testStarted();
-			} else {
-				tl.testStarted(host);
-			}
-		}
-	}
+    // Allow engine and threads to be stopped from outside a thread
+    // e.g. from beanshell server
+    // Assumes that there is only one instance of the engine
+    // at any one time so it is not guaranteed to work ...
+    private static transient Map allThreadNames;
+
+    private static StandardJMeterEngine engine;
+
+    private static Map allThreadsSave;
+
+    public static void stopEngineNow() {
+        if (engine != null) {// May be null if called from Unit test
+            engine.stopTest(true);
+        }
+    }
+
+    public static void stopEngine() {
+        if (engine != null) { // May be null if called from Unit test
+            engine.stopTest(false);
+        }
+    }
+
+    /*
+     * Allow functions etc to register for testStopped notification
+     */
+    private static final List testList = new ArrayList();
+
+    public static synchronized void register(TestListener tl) {
+        testList.add(tl);
+    }
+
+    public static boolean stopThread(String threadName) {
+        return stopThread(threadName, false);
+    }
+
+    public static boolean stopThreadNow(String threadName) {
+        return stopThread(threadName, true);
+    }
+
+    private static boolean stopThread(String threadName, boolean now) {
+        if (allThreadNames == null) {
+            return false;// e.g. not yet started
+        }
+        JMeterThread thrd;
+        try {
+            thrd = (JMeterThread) allThreadNames.get(threadName);
+        } catch (Exception e) {
+            log.warn("stopThread: " + e);
+            return false;
+        }
+        if (thrd != null) {
+            thrd.stop();
+            if (now) {
+                Thread t = (Thread) allThreadsSave.get(thrd);
+                if (t != null) {
+                    t.interrupt();
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    // End of code to allow engine to be controlled remotely
+
+    public StandardJMeterEngine() {
+        allThreads = new HashMap();
+        engine = this;
+        allThreadNames = new HashMap();
+        allThreadsSave = allThreads;
+    }
+
+    public StandardJMeterEngine(String host) {
+        this();
+        this.host = host;
+    }
+
+    public void configure(HashTree testTree) {
+        test = testTree;
+    }
 
-	protected void notifyTestListenersOfEnd() {
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    protected HashTree getTestTree() {
+        return test;
+    }
+
+    protected void compileTree() {
+        PreCompiler compiler = new PreCompiler();
+        getTestTree().traverse(compiler);
+    }
+
+    // TODO: in Java1.5, perhaps we can use Thread.setUncaughtExceptionHandler() instead
+    private static class MyThreadGroup extends java.lang.ThreadGroup{
+        public MyThreadGroup(String s) {
+            super(s);
+          }
+
+          public void uncaughtException(Thread t, Throwable e) {
+            if (!(e instanceof ThreadDeath)) {
+                log.error("Uncaught exception: ", e);
+                System.err.println("Uncaught Exception " + e + ". See log file for details.");
+            }
+          }
+
+    }
+    public void runTest() throws JMeterEngineException {
+        try {
+            runningThread = new Thread(new MyThreadGroup("JMeterThreadGroup"),this);
+            runningThread.start();
+        } catch (Exception err) {
+            stopTest();
+            StringWriter string = new StringWriter();
+            PrintWriter writer = new PrintWriter(string);
+            err.printStackTrace(writer);
+            throw new JMeterEngineException(string.toString());
+        }
+    }
+
+    private void removeThreadGroups(List elements) {
+        Iterator iter = elements.iterator();
+        while (iter.hasNext()) {
+            Object item = iter.next();
+            if (item instanceof ThreadGroup) {
+                iter.remove();
+            } else if (!(item instanceof TestElement)) {
+                iter.remove();
+            }
+        }
+    }
+
+    protected void notifyTestListenersOfStart() {
+        Iterator iter = testListeners.getSearchResults().iterator();
+        while (iter.hasNext()) {
+            TestListener tl = (TestListener) iter.next();
+            if (tl instanceof TestBean) {
+                TestBeanHelper.prepare((TestElement) tl);
+            }
+            if (host == null) {
+                tl.testStarted();
+            } else {
+                tl.testStarted(host);
+            }
+        }
+    }
+
+    protected void notifyTestListenersOfEnd() {
         log.info("Notifying test listeners of end of test");
-		Iterator iter = testListeners.getSearchResults().iterator();
-		while (iter.hasNext()) {
-			TestListener tl = (TestListener) iter.next();
-			if (tl instanceof TestBean) {
-			    TestBeanHelper.prepare((TestElement) tl); // TODO is this necessary? It was called by start.
-			}
-			if (host == null) {
-				tl.testEnded();
-			} else {
-				tl.testEnded(host);
-			}
-		}
-		log.info("Test has ended");
-		if (host != null) {
-			long now=System.currentTimeMillis();
-			System.out.println("Finished the test on host " + host + " @ "+new Date(now)+" ("+now+")");
-			if (exitAfterTest){
-				exit();
-			}
-		}
-	}
-
-	private ListedHashTree cloneTree(ListedHashTree tree) {
-		TreeCloner cloner = new TreeCloner(true);
-		tree.traverse(cloner);
-		return cloner.getClonedTree();
-	}
-
-	public void reset() {
-		if (running) {
-			stopTest();
-		}
-	}
+        Iterator iter = testListeners.getSearchResults().iterator();
+        while (iter.hasNext()) {
+            TestListener tl = (TestListener) iter.next();
+            if (tl instanceof TestBean) {
+                TestBeanHelper.prepare((TestElement) tl); // TODO is this necessary? It was called by start.
+            }
+            if (host == null) {
+                tl.testEnded();
+            } else {
+                tl.testEnded(host);
+            }
+        }
+        log.info("Test has ended");
+        if (host != null) {
+            long now=System.currentTimeMillis();
+            System.out.println("Finished the test on host " + host + " @ "+new Date(now)+" ("+now+")");
+            if (exitAfterTest){
+                exit();
+            }
+        }
+    }
+
+    private ListedHashTree cloneTree(ListedHashTree tree) {
+        TreeCloner cloner = new TreeCloner(true);
+        tree.traverse(cloner);
+        return cloner.getClonedTree();
+    }
 
-	public synchronized void threadFinished(JMeterThread thread) {
-		try {
+    public void reset() {
+        if (running) {
+            stopTest();
+        }
+    }
+
+    public synchronized void threadFinished(JMeterThread thread) {
+        try {
             allThreads.remove(thread);
             log.info("Ending thread " + thread.getThreadName());
             if (!serialized && !schcdule_run && !startingGroups && allThreads.size() == 0 ) {
-            	log.info("Stopping test");
-            	stopTest();
+                log.info("Stopping test");
+                stopTest();
             }
         } catch (Throwable e) {
             log.fatalError("Call to threadFinished should never throw an exception - this can deadlock JMeter",e);
         }
-	}
+    }
+
+    public synchronized void stopTest() {
+        Thread stopThread = new Thread(new StopTest());
+        stopThread.start();
+    }
 
-	public synchronized void stopTest() {
-		Thread stopThread = new Thread(new StopTest());
-		stopThread.start();
-	}
-
-	public synchronized void stopTest(boolean b) {
-		Thread stopThread = new Thread(new StopTest(b));
-		stopThread.start();
-	}
-
-	private class StopTest implements Runnable {
-		boolean now;
-
-		private StopTest() {
-			now = true;
-		}
-
-		private StopTest(boolean b) {
-			now = b;
-		}
-
-		public void run() {
-			if (running) {
-				running = false;
-				if (now) {
-					tellThreadsToStop();
-				} else {
-					stopAllThreads();
-				}
-				try {
-					Thread.sleep(10 * allThreads.size());
-				} catch (InterruptedException e) {
-				}
-				boolean stopped = verifyThreadsStopped();
-				if (stopped || now) {
-					notifyTestListenersOfEnd();
-				}
-			}
-		}
-	}
-
-	public void run() {
-		log.info("Running the test!");
-		running = true;
-
-		SearchByClass testPlan = new SearchByClass(TestPlan.class);
-		getTestTree().traverse(testPlan);
-		Object[] plan = testPlan.getSearchResults().toArray();
-		if (plan.length == 0) {
-			System.err.println("Could not find the TestPlan!");
-			log.error("Could not find the TestPlan!");
-			System.exit(1);
-		}
-		if (((TestPlan) plan[0]).isSerialized()) {
-			serialized = true;
-		}
+    public synchronized void stopTest(boolean b) {
+        Thread stopThread = new Thread(new StopTest(b));
+        stopThread.start();
+    }
+
+    private class StopTest implements Runnable {
+        boolean now;
+
+        private StopTest() {
+            now = true;
+        }
+
+        private StopTest(boolean b) {
+            now = b;
+        }
+
+        public void run() {
+            if (running) {
+                running = false;
+                if (now) {
+                    tellThreadsToStop();
+                } else {
+                    stopAllThreads();
+                }
+                try {
+                    Thread.sleep(10 * allThreads.size());
+                } catch (InterruptedException e) {
+                }
+                boolean stopped = verifyThreadsStopped();
+                if (stopped || now) {
+                    notifyTestListenersOfEnd();
+                }
+            }
+        }
+    }
+
+    public void run() {
+        log.info("Running the test!");
+        running = true;
+
+        SearchByClass testPlan = new SearchByClass(TestPlan.class);
+        getTestTree().traverse(testPlan);
+        Object[] plan = testPlan.getSearchResults().toArray();
+        if (plan.length == 0) {
+            System.err.println("Could not find the TestPlan!");
+            log.error("Could not find the TestPlan!");
+            System.exit(1);
+        }
+        if (((TestPlan) plan[0]).isSerialized()) {
+            serialized = true;
+        }
         JMeterContextService.startTest();
         try {
-        	compileTree();
-	    } catch (RuntimeException e) {
-	    	log.error("Error occurred compiling the tree:",e);
-	    	JMeterUtils.reportErrorToUser("Error occurred compiling the tree: - see log file");
-	    	return; // no point continuing
-        }
-		/**
-		 * Notification of test listeners needs to happen after function
-		 * replacement, but before setting RunningVersion to true.
-		 */
-		testListeners = new SearchByClass(TestListener.class);
-		getTestTree().traverse(testListeners);
-		
-		//	Merge in any additional test listeners
-		// currently only used by the function parser
-		testListeners.getSearchResults().addAll(testList);
-		testList.clear(); // no longer needed
-		
-		if (!startListenersLater ) { notifyTestListenersOfStart(); }
-		getTestTree().traverse(new TurnElementsOn());
+            compileTree();
+        } catch (RuntimeException e) {
+            log.error("Error occurred compiling the tree:",e);
+            JMeterUtils.reportErrorToUser("Error occurred compiling the tree: - see log file");
+            return; // no point continuing
+        }
+        /**
+         * Notification of test listeners needs to happen after function
+         * replacement, but before setting RunningVersion to true.
+         */
+        testListeners = new SearchByClass(TestListener.class);
+        getTestTree().traverse(testListeners);
+
+        // Merge in any additional test listeners
+        // currently only used by the function parser
+        testListeners.getSearchResults().addAll(testList);
+        testList.clear(); // no longer needed
+
+        if (!startListenersLater ) { notifyTestListenersOfStart(); }
+        getTestTree().traverse(new TurnElementsOn());
         if (startListenersLater) { notifyTestListenersOfStart(); }
 
-		List testLevelElements = new LinkedList(getTestTree().list(getTestTree().getArray()[0]));
-		removeThreadGroups(testLevelElements);
-		SearchByClass searcher = new SearchByClass(ThreadGroup.class);
-		getTestTree().traverse(searcher);
-		TestCompiler.initialize();
-		// for each thread group, generate threads
-		// hand each thread the sampler controller
-		// and the listeners, and the timer
-		Iterator iter = searcher.getSearchResults().iterator();
-
-		/*
-		 * Here's where the test really starts. Run a Full GC now: it's no harm
-		 * at all (just delays test start by a tiny amount) and hitting one too
-		 * early in the test can impair results for short tests.
-		 */
-		System.gc();
-
-		notifier = new ListenerNotifier();
-
-		schcdule_run = true;
-		JMeterContextService.getContext().setSamplingStarted(true);
-		int groupCount = 0;
+        List testLevelElements = new LinkedList(getTestTree().list(getTestTree().getArray()[0]));
+        removeThreadGroups(testLevelElements);
+        SearchByClass searcher = new SearchByClass(ThreadGroup.class);
+        getTestTree().traverse(searcher);
+        TestCompiler.initialize();
+        // for each thread group, generate threads
+        // hand each thread the sampler controller
+        // and the listeners, and the timer
+        Iterator iter = searcher.getSearchResults().iterator();
+
+        /*
+         * Here's where the test really starts. Run a Full GC now: it's no harm
+         * at all (just delays test start by a tiny amount) and hitting one too
+         * early in the test can impair results for short tests.
+         */
+        System.gc();
+
+        notifier = new ListenerNotifier();
+
+        schcdule_run = true;
+        JMeterContextService.getContext().setSamplingStarted(true);
+        int groupCount = 0;
         JMeterContextService.clearTotalThreads();
         startingGroups = true;
-		while (iter.hasNext()) {
-			groupCount++;
-			ThreadGroup group = (ThreadGroup) iter.next();
-			int numThreads = group.getNumThreads();
+        while (iter.hasNext()) {
+            groupCount++;
+            ThreadGroup group = (ThreadGroup) iter.next();
+            int numThreads = group.getNumThreads();
             JMeterContextService.addTotalThreads(numThreads);
-			boolean onErrorStopTest = group.getOnErrorStopTest();
-			boolean onErrorStopThread = group.getOnErrorStopThread();
-			String groupName = group.getName();
-			int rampUp = group.getRampUp();
-			float perThreadDelay = ((float) (rampUp * 1000) / (float) numThreads);
-			log.info("Starting " + numThreads + " threads for group " + groupName + ". Ramp up = " + rampUp + ".");
-
-			if (onErrorStopTest) {
-				log.info("Test will stop on error");
-			} else if (onErrorStopThread) {
-				log.info("Thread will stop on error");
-			} else {
-				log.info("Continue on error");
-			}
+            boolean onErrorStopTest = group.getOnErrorStopTest();
+            boolean onErrorStopThread = group.getOnErrorStopThread();
+            String groupName = group.getName();
+            int rampUp = group.getRampUp();
+            float perThreadDelay = ((float) (rampUp * 1000) / (float) numThreads);
+            log.info("Starting " + numThreads + " threads for group " + groupName + ". Ramp up = " + rampUp + ".");
+
+            if (onErrorStopTest) {
+                log.info("Test will stop on error");
+            } else if (onErrorStopThread) {
+                log.info("Thread will stop on error");
+            } else {
+                log.info("Continue on error");
+            }
 
             ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
             threadGroupTree.add(group, testLevelElements);
-			for (int i = 0; running && i < numThreads; i++) {
+            for (int i = 0; running && i < numThreads; i++) {
                 final JMeterThread jmeterThread = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
                 jmeterThread.setThreadNum(i);
-				jmeterThread.setThreadGroup(group);
-				jmeterThread.setInitialContext(JMeterContextService.getContext());
-				jmeterThread.setInitialDelay((int) (perThreadDelay * i));
-				jmeterThread.setThreadName(groupName + " " + (groupCount) + "-" + (i + 1));
-
-				scheduleThread(jmeterThread, group);
-
-				// Set up variables for stop handling
-				jmeterThread.setEngine(this);
-				jmeterThread.setOnErrorStopTest(onErrorStopTest);
-				jmeterThread.setOnErrorStopThread(onErrorStopThread);
-
-				Thread newThread = new Thread(jmeterThread);
-				newThread.setName(jmeterThread.getThreadName());
-				allThreads.put(jmeterThread, newThread);
-				if (serialized && !iter.hasNext() && i == numThreads - 1) // last thread
-				{
-					serialized = false;
-				}
-				newThread.start();
-			}
-			schcdule_run = false;
-			if (serialized) {
-				while (running && allThreads.size() > 0) {
-					try {
-						Thread.sleep(1000);
-					} catch (InterruptedException e) {
-					}
-				}
-			}
-		}
+                jmeterThread.setThreadGroup(group);
+                jmeterThread.setInitialContext(JMeterContextService.getContext());
+                jmeterThread.setInitialDelay((int) (perThreadDelay * i));
+                jmeterThread.setThreadName(groupName + " " + (groupCount) + "-" + (i + 1));
+
+                scheduleThread(jmeterThread, group);
+
+                // Set up variables for stop handling
+                jmeterThread.setEngine(this);
+                jmeterThread.setOnErrorStopTest(onErrorStopTest);
+                jmeterThread.setOnErrorStopThread(onErrorStopThread);
+
+                Thread newThread = new Thread(jmeterThread);
+                newThread.setName(jmeterThread.getThreadName());
+                allThreads.put(jmeterThread, newThread);
+                if (serialized && !iter.hasNext() && i == numThreads - 1) // last thread
+                {
+                    serialized = false;
+                }
+                newThread.start();
+            }
+            schcdule_run = false;
+            if (serialized) {
+                while (running && allThreads.size() > 0) {
+                    try {
+                        Thread.sleep(1000);
+                    } catch (InterruptedException e) {
+                    }
+                }
+            }
+        }
         startingGroups = false;
-	}
+    }
+
+    /**
+     * This will schedule the time for the JMeterThread.
+     *
+     * @param thread
+     * @param group
+     */
+    private void scheduleThread(JMeterThread thread, ThreadGroup group) {
+        // if true the Scheduler is enabled
+        if (group.getScheduler()) {
+            long now = System.currentTimeMillis();
+            // set the start time for the Thread
+            if (group.getDelay() > 0) {// Duration is in seconds
+                thread.setStartTime(group.getDelay() * 1000 + now);
+            } else {
+                long start = group.getStartTime();
+                if (start < now) {
+                    start = now; // Force a sensible start time
+                }
+                thread.setStartTime(start);
+            }
+
+            // set the endtime for the Thread
+            if (group.getDuration() > 0) {// Duration is in seconds
+                thread.setEndTime(group.getDuration() * 1000 + (thread.getStartTime()));
+            } else {
+                thread.setEndTime(group.getEndTime());
+            }
+
+            // Enables the scheduler
+            thread.setScheduled(true);
+        }
+    }
+
+    private boolean verifyThreadsStopped() {
+        boolean stoppedAll = true;
+        Iterator iter = new HashSet(allThreads.keySet()).iterator();
+        while (iter.hasNext()) {
+            Thread t = (Thread) allThreads.get(iter.next());
+            if (t != null && t.isAlive()) {
+                try {
+                    t.join(WAIT_TO_DIE);
+                } catch (InterruptedException e) {
+                }
+                if (t.isAlive()) {
+                    stoppedAll = false;
+                    log.info("Thread won't die: " + t.getName());
+                }
+            }
+        }
+        return stoppedAll;
+    }
 
-	/**
-	 * This will schedule the time for the JMeterThread.
-	 * 
-	 * @param thread
-	 * @param group
-	 */
-	private void scheduleThread(JMeterThread thread, ThreadGroup group) {
-		// if true the Scheduler is enabled
-		if (group.getScheduler()) {
-			long now = System.currentTimeMillis();
-			// set the start time for the Thread
-			if (group.getDelay() > 0) {// Duration is in seconds
-				thread.setStartTime(group.getDelay() * 1000 + now);
-			} else {
-				long start = group.getStartTime();
-				if (start < now) {
-				    start = now; // Force a sensible start time
-				}
-				thread.setStartTime(start);
-			}
-
-			// set the endtime for the Thread
-			if (group.getDuration() > 0) {// Duration is in seconds
-				thread.setEndTime(group.getDuration() * 1000 + (thread.getStartTime()));
-			} else {
-				thread.setEndTime(group.getEndTime());
-			}
-
-			// Enables the scheduler
-			thread.setScheduled(true);
-		}
-	}
-
-	private boolean verifyThreadsStopped() {
-		boolean stoppedAll = true;
-		Iterator iter = new HashSet(allThreads.keySet()).iterator();
-		while (iter.hasNext()) {
-			Thread t = (Thread) allThreads.get(iter.next());
-			if (t != null && t.isAlive()) {
-				try {
-					t.join(WAIT_TO_DIE);
-				} catch (InterruptedException e) {
-				}
-				if (t.isAlive()) {
-					stoppedAll = false;
-					log.info("Thread won't die: " + t.getName());
-				}
-			}
-		}
-		return stoppedAll;
-	}
-
-	private void tellThreadsToStop() {
-		Iterator iter = new HashSet(allThreads.keySet()).iterator();
-		while (iter.hasNext()) {
-			JMeterThread item = (JMeterThread) iter.next();
-			item.stop();
-			Thread t = (Thread) allThreads.get(item);
-			if (t != null) {
-				t.interrupt();
-			} else {
-				log.warn("Lost thread: " + item.getThreadName());
-				allThreads.remove(item);
-			}
-		}
-	}
-
-	public void askThreadsToStop() {
-		engine.stopTest(false);
-	}
-
-	private void stopAllThreads() {
-		Iterator iter = new HashSet(allThreads.keySet()).iterator();
-		while (iter.hasNext()) {
-			JMeterThread item = (JMeterThread) iter.next();
-			item.stop();
-		}
-	}
-
-	// Remote exit
-	public void exit() {
-		// Needs to be run in a separate thread to allow RMI call to return OK
-		Thread t = new Thread() {
-			public void run() {
-				// log.info("Pausing");
-				try {
-					Thread.sleep(1000);
-				} catch (InterruptedException e) {
-				}
-				log.info("Bye");
-				System.exit(0);
-			}
-		};
-		log.info("Starting Closedown");
-		t.start();
-	}
-
-	public void setProperties(Properties p) {
-		log.info("Applying properties "+p);
-		JMeterUtils.getJMeterProperties().putAll(p);
-	}
+    private void tellThreadsToStop() {
+        Iterator iter = new HashSet(allThreads.keySet()).iterator();
+        while (iter.hasNext()) {
+            JMeterThread item = (JMeterThread) iter.next();
+            item.stop();
+            Thread t = (Thread) allThreads.get(item);
+            if (t != null) {
+                t.interrupt();
+            } else {
+                log.warn("Lost thread: " + item.getThreadName());
+                allThreads.remove(item);
+            }
+        }
+    }
+
+    public void askThreadsToStop() {
+        engine.stopTest(false);
+    }
+
+    private void stopAllThreads() {
+        Iterator iter = new HashSet(allThreads.keySet()).iterator();
+        while (iter.hasNext()) {
+            JMeterThread item = (JMeterThread) iter.next();
+            item.stop();
+        }
+    }
+
+    // Remote exit
+    public void exit() {
+        // Needs to be run in a separate thread to allow RMI call to return OK
+        Thread t = new Thread() {
+            public void run() {
+                // log.info("Pausing");
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                }
+                log.info("Bye");
+                System.exit(0);
+            }
+        };
+        log.info("Starting Closedown");
+        t.start();
+    }
+
+    public void setProperties(Properties p) {
+        log.info("Applying properties "+p);
+        JMeterUtils.getJMeterProperties().putAll(p);
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TreeCloner.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TreeCloner.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TreeCloner.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TreeCloner.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine;
@@ -28,40 +28,40 @@
 
 public class TreeCloner implements HashTreeTraverser {
 
-	private ListedHashTree newTree;
+    private ListedHashTree newTree;
 
-	private LinkedList objects = new LinkedList();
+    private LinkedList objects = new LinkedList();
 
-	private boolean forThread = true;
+    private boolean forThread = true;
 
-	public TreeCloner() {
-		this(true);
-	}
-
-	public TreeCloner(boolean forThread) {
-		newTree = new ListedHashTree();
-		this.forThread = forThread;
-	}
-
-	public void addNode(Object node, HashTree subTree) {
-		if ((!forThread || !(node instanceof NoThreadClone)) && (node instanceof TestElement)) {
-			node = ((TestElement) node).clone();
-			newTree.add(objects, node);
-		} else {
-			newTree.add(objects, node);
-		}
-		objects.addLast(node);
-	}
-
-	public void subtractNode() {
-		objects.removeLast();
-	}
-
-	public ListedHashTree getClonedTree() {
-		return newTree;
-	}
+    public TreeCloner() {
+        this(true);
+    }
+
+    public TreeCloner(boolean forThread) {
+        newTree = new ListedHashTree();
+        this.forThread = forThread;
+    }
+
+    public void addNode(Object node, HashTree subTree) {
+        if ((!forThread || !(node instanceof NoThreadClone)) && (node instanceof TestElement)) {
+            node = ((TestElement) node).clone();
+            newTree.add(objects, node);
+        } else {
+            newTree.add(objects, node);
+        }
+        objects.addLast(node);
+    }
+
+    public void subtractNode() {
+        objects.removeLast();
+    }
+
+    public ListedHashTree getClonedTree() {
+        return newTree;
+    }
 
-	public void processPath() {
-	}
+    public void processPath() {
+    }
 
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TurnElementsOn.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TurnElementsOn.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TurnElementsOn.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/TurnElementsOn.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine;
@@ -25,39 +25,39 @@
 
 /**
  * @author mstover
- * 
+ *
  * To change the template for this generated type comment go to Window -
  * Preferences - Java - Code Generation - Code and Comments
  */
 public class TurnElementsOn implements HashTreeTraverser {
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jorphan.collections.HashTreeTraverser#addNode(java.lang.Object,
-	 *      org.apache.jorphan.collections.HashTree)
-	 */
-	public void addNode(Object node, HashTree subTree) {
-		if (node instanceof TestElement && !(node instanceof TestPlan)) {
-			((TestElement) node).setRunningVersion(true);
-		}
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jorphan.collections.HashTreeTraverser#subtractNode()
-	 */
-	public void subtractNode() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jorphan.collections.HashTreeTraverser#processPath()
-	 */
-	public void processPath() {
-	}
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jorphan.collections.HashTreeTraverser#addNode(java.lang.Object,
+     *      org.apache.jorphan.collections.HashTree)
+     */
+    public void addNode(Object node, HashTree subTree) {
+        if (node instanceof TestElement && !(node instanceof TestPlan)) {
+            ((TestElement) node).setRunningVersion(true);
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jorphan.collections.HashTreeTraverser#subtractNode()
+     */
+    public void subtractNode() {
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jorphan.collections.HashTreeTraverser#processPath()
+     */
+    public void processPath() {
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationEvent.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationEvent.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationEvent.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationEvent.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine.event;
@@ -25,31 +25,31 @@
  * source of the event.
  */
 public class LoopIterationEvent {
-	private final int iteration;
+    private final int iteration;
 
-	private final TestElement source;
+    private final TestElement source;
 
-	public LoopIterationEvent(TestElement source, int iter) {
-		iteration = iter;
-		this.source = source;
-	}
-
-	/**
-	 * Returns the iteration.
-	 * 
-	 * @return int
-	 */
-	public int getIteration() {
-		return iteration;
-	}
-
-	/**
-	 * Returns the source.
-	 * 
-	 * @return TestElement
-	 */
-	public TestElement getSource() {
-		return source;
-	}
+    public LoopIterationEvent(TestElement source, int iter) {
+        iteration = iter;
+        this.source = source;
+    }
+
+    /**
+     * Returns the iteration.
+     *
+     * @return int
+     */
+    public int getIteration() {
+        return iteration;
+    }
+
+    /**
+     * Returns the source.
+     *
+     * @return TestElement
+     */
+    public TestElement getSource() {
+        return source;
+    }
 
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationListener.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationListener.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationListener.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/event/LoopIterationListener.java Sun Jul  6 16:42:12 2008
@@ -13,11 +13,11 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine.event;
 
 public interface LoopIterationListener {
-	public void iterationStart(LoopIterationEvent iterEvent);
+    public void iterationStart(LoopIterationEvent iterEvent);
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/AbstractTransformer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/AbstractTransformer.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/AbstractTransformer.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/AbstractTransformer.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 /*
@@ -25,23 +25,23 @@
 
 abstract class AbstractTransformer implements ValueTransformer {
 
-	protected CompoundVariable masterFunction;
+    protected CompoundVariable masterFunction;
 
-	protected Map variables;
+    protected Map variables;
 
-	public void setMasterFunction(CompoundVariable variable) {
-		masterFunction = variable;
-	}
+    public void setMasterFunction(CompoundVariable variable) {
+        masterFunction = variable;
+    }
 
-	protected CompoundVariable getMasterFunction() {
-		return masterFunction;
-	}
+    protected CompoundVariable getMasterFunction() {
+        return masterFunction;
+    }
 
-	public Map getVariables() {
-		return variables;
-	}
+    public Map getVariables() {
+        return variables;
+    }
 
-	public void setVariables(Map map) {
-		variables = map;
-	}
+    public void setVariables(Map map) {
+        variables = map;
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/CompoundVariable.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine.util;
@@ -38,173 +38,173 @@
 
 /**
  * CompoundFunction.
- * 
+ *
  */
 public class CompoundVariable implements Function {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	private String rawParameters;
+    private String rawParameters;
 
-	private static final FunctionParser functionParser = new FunctionParser();
+    private static final FunctionParser functionParser = new FunctionParser();
 
-	private static final Map functions = new HashMap();
+    private static final Map functions = new HashMap();
 
-	private boolean hasFunction, isDynamic;
-
-	private String permanentResults = ""; // $NON-NLS-1$
-
-	private LinkedList compiledComponents = new LinkedList();
-
-	static {
-		try {
-			final String contain = // Classnames must contain this string [.functions.]
-				JMeterUtils.getProperty("classfinder.functions.contain"); // $NON-NLS-1$ 
-			final String notContain = // Classnames must not contain this string [.gui.]
-				JMeterUtils.getProperty("classfinder.functions.notContain"); // $NON-NLS-1$
-			if (contain!=null){
-				log.info("Note: Function class names must contain the string: '"+contain+"'");
-			}
-			if (notContain!=null){
-				log.info("Note: Function class names must not contain the string: '"+notContain+"'");
-			}
-			List classes = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
-					new Class[] { Function.class }, true, contain, notContain);
-			Iterator iter = classes.iterator();
-			while (iter.hasNext()) {
-				// TODO skip class init - e.g. update findClassesThatExtend() to return classes instead of strings
-				Function tempFunc = (Function) Class.forName((String) iter.next()).newInstance();
-				String referenceKey = tempFunc.getReferenceKey();
+    private boolean hasFunction, isDynamic;
+
+    private String permanentResults = ""; // $NON-NLS-1$
+
+    private LinkedList compiledComponents = new LinkedList();
+
+    static {
+        try {
+            final String contain = // Classnames must contain this string [.functions.]
+                JMeterUtils.getProperty("classfinder.functions.contain"); // $NON-NLS-1$
+            final String notContain = // Classnames must not contain this string [.gui.]
+                JMeterUtils.getProperty("classfinder.functions.notContain"); // $NON-NLS-1$
+            if (contain!=null){
+                log.info("Note: Function class names must contain the string: '"+contain+"'");
+            }
+            if (notContain!=null){
+                log.info("Note: Function class names must not contain the string: '"+notContain+"'");
+            }
+            List classes = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(),
+                    new Class[] { Function.class }, true, contain, notContain);
+            Iterator iter = classes.iterator();
+            while (iter.hasNext()) {
+                // TODO skip class init - e.g. update findClassesThatExtend() to return classes instead of strings
+                Function tempFunc = (Function) Class.forName((String) iter.next()).newInstance();
+                String referenceKey = tempFunc.getReferenceKey();
                 functions.put(referenceKey, tempFunc.getClass());
                 // Add alias for original StringFromFile name (had only one underscore)
                 if (referenceKey.equals("__StringFromFile")){//$NON-NLS-1$
                     functions.put("_StringFromFile", tempFunc.getClass());//$NON-NLS-1$
                 }
-			}
-		} catch (Exception err) {
-			log.error("", err);
-		}
-	}
-
-	public CompoundVariable() {
-		super();
-		isDynamic = true;
-		hasFunction = false;
-	}
-
-	public CompoundVariable(String parameters) {
-		this();
-		try {
-			setParameters(parameters);
-		} catch (InvalidVariableException e) {
-		}
-	}
-
-	public String execute() {
-		if (isDynamic) {
-			JMeterContext context = JMeterContextService.getContext();
-			SampleResult previousResult = context.getPreviousResult();
-			Sampler currentSampler = context.getCurrentSampler();
-			return execute(previousResult, currentSampler);
-		}
-		return permanentResults; // $NON-NLS-1$
-	}
-
-	/**
-	 * Allows the retrieval of the original String prior to it being compiled.
-	 * 
-	 * @return String
-	 */
-	public String getRawParameters() {
-		return rawParameters;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see Function#execute(SampleResult, Sampler)
-	 */
-	public String execute(SampleResult previousResult, Sampler currentSampler) {
-		if (compiledComponents == null || compiledComponents.size() == 0) {
-			return ""; // $NON-NLS-1$
-		}
-		boolean testDynamic = false;
-		StringBuffer results = new StringBuffer();
-		Iterator iter = compiledComponents.iterator();
-		while (iter.hasNext()) {
-			Object item = iter.next();
-			if (item instanceof Function) {
-				testDynamic = true;
-				try {
-					results.append(((Function) item).execute(previousResult, currentSampler));
-				} catch (InvalidVariableException e) {
-				}
-			} else if (item instanceof SimpleVariable) {
-				testDynamic = true;
-				results.append(((SimpleVariable) item).toString());
-			} else {
-				results.append(item);
-			}
-		}
-		if (!testDynamic) {
-			isDynamic = false;
-			permanentResults = results.toString();
-		}
-		return results.toString();
-	}
-
-	public CompoundVariable getFunction() {
-		CompoundVariable func = new CompoundVariable();
-		func.compiledComponents = (LinkedList) compiledComponents.clone();
-		func.rawParameters = rawParameters;
-		return func;
-	}
-
-	public List getArgumentDesc() {
-		return new LinkedList();
-	}
-
-	public void clear() {
-		hasFunction = false;
-		compiledComponents.clear();
-	}
-
-	public void setParameters(String parameters) throws InvalidVariableException {
-		this.rawParameters = parameters;
-		if (parameters == null || parameters.length() == 0) {
-			return;
-		}
-
-		compiledComponents = functionParser.compileString(parameters);
-		if (compiledComponents.size() > 1 || !(compiledComponents.get(0) instanceof String)) {
-			hasFunction = true;
-		}
-	}
-
-	static Object getNamedFunction(String functionName) throws InvalidVariableException {
-		if (functions.containsKey(functionName)) {
-			try {
-				return ((Class) functions.get(functionName)).newInstance();
-			} catch (Exception e) {
-				log.error("", e); // $NON-NLS-1$
-				throw new InvalidVariableException();
-			}
-		}
-		return new SimpleVariable(functionName);
-	}
-
-	public boolean hasFunction() {
-		return hasFunction;
-	}
-
-	// Dummy methods needed by Function interface
-	
-	/**
-	 * @see Function#getReferenceKey()
-	 */
-	public String getReferenceKey() {
-		return ""; // $NON-NLS-1$
-	}
+            }
+        } catch (Exception err) {
+            log.error("", err);
+        }
+    }
+
+    public CompoundVariable() {
+        super();
+        isDynamic = true;
+        hasFunction = false;
+    }
+
+    public CompoundVariable(String parameters) {
+        this();
+        try {
+            setParameters(parameters);
+        } catch (InvalidVariableException e) {
+        }
+    }
+
+    public String execute() {
+        if (isDynamic) {
+            JMeterContext context = JMeterContextService.getContext();
+            SampleResult previousResult = context.getPreviousResult();
+            Sampler currentSampler = context.getCurrentSampler();
+            return execute(previousResult, currentSampler);
+        }
+        return permanentResults; // $NON-NLS-1$
+    }
+
+    /**
+     * Allows the retrieval of the original String prior to it being compiled.
+     *
+     * @return String
+     */
+    public String getRawParameters() {
+        return rawParameters;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see Function#execute(SampleResult, Sampler)
+     */
+    public String execute(SampleResult previousResult, Sampler currentSampler) {
+        if (compiledComponents == null || compiledComponents.size() == 0) {
+            return ""; // $NON-NLS-1$
+        }
+        boolean testDynamic = false;
+        StringBuffer results = new StringBuffer();
+        Iterator iter = compiledComponents.iterator();
+        while (iter.hasNext()) {
+            Object item = iter.next();
+            if (item instanceof Function) {
+                testDynamic = true;
+                try {
+                    results.append(((Function) item).execute(previousResult, currentSampler));
+                } catch (InvalidVariableException e) {
+                }
+            } else if (item instanceof SimpleVariable) {
+                testDynamic = true;
+                results.append(((SimpleVariable) item).toString());
+            } else {
+                results.append(item);
+            }
+        }
+        if (!testDynamic) {
+            isDynamic = false;
+            permanentResults = results.toString();
+        }
+        return results.toString();
+    }
+
+    public CompoundVariable getFunction() {
+        CompoundVariable func = new CompoundVariable();
+        func.compiledComponents = (LinkedList) compiledComponents.clone();
+        func.rawParameters = rawParameters;
+        return func;
+    }
+
+    public List getArgumentDesc() {
+        return new LinkedList();
+    }
+
+    public void clear() {
+        hasFunction = false;
+        compiledComponents.clear();
+    }
+
+    public void setParameters(String parameters) throws InvalidVariableException {
+        this.rawParameters = parameters;
+        if (parameters == null || parameters.length() == 0) {
+            return;
+        }
+
+        compiledComponents = functionParser.compileString(parameters);
+        if (compiledComponents.size() > 1 || !(compiledComponents.get(0) instanceof String)) {
+            hasFunction = true;
+        }
+    }
+
+    static Object getNamedFunction(String functionName) throws InvalidVariableException {
+        if (functions.containsKey(functionName)) {
+            try {
+                return ((Class) functions.get(functionName)).newInstance();
+            } catch (Exception e) {
+                log.error("", e); // $NON-NLS-1$
+                throw new InvalidVariableException();
+            }
+        }
+        return new SimpleVariable(functionName);
+    }
+
+    public boolean hasFunction() {
+        return hasFunction;
+    }
+
+    // Dummy methods needed by Function interface
+
+    /**
+     * @see Function#getReferenceKey()
+     */
+    public String getReferenceKey() {
+        return ""; // $NON-NLS-1$
+    }
 
-	public void setParameters(Collection parameters) throws InvalidVariableException {
-	}
+    public void setParameters(Collection parameters) throws InvalidVariableException {
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/DisabledComponentRemover.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/DisabledComponentRemover.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/DisabledComponentRemover.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/DisabledComponentRemover.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine.util;
@@ -32,39 +32,39 @@
 public class DisabledComponentRemover implements HashTreeTraverser {
 
     /*
-     * TODO - does this class work? and is it needed? 
+     * TODO - does this class work? and is it needed?
      * It is only called by Start, and then only after
      * having called convertTree - which removes the disabled elements anyway.
      * When tried in IncludeController, it failed to work.
     */
 
     private static final Logger log = LoggingManager.getLoggerForClass();
-    
-	HashTree tree;
 
-	LinkedList stack = new LinkedList();
+    HashTree tree;
 
-	public DisabledComponentRemover(HashTree tree) {
-		this.tree = tree;
-	}
+    LinkedList stack = new LinkedList();
 
-	public void addNode(Object node, HashTree subTree) {
-		stack.addLast(node);
-	}
+    public DisabledComponentRemover(HashTree tree) {
+        this.tree = tree;
+    }
 
-	public void subtractNode() {
-		Object removeLast = stack.removeLast();
+    public void addNode(Object node, HashTree subTree) {
+        stack.addLast(node);
+    }
+
+    public void subtractNode() {
+        Object removeLast = stack.removeLast();
         if (!(removeLast instanceof TestElement)) {
             log.warn("Expected class TestElement, found "+removeLast.getClass().getName());
             return;
         }
         TestElement lastNode = (TestElement) removeLast;
-		if (!lastNode.getPropertyAsBoolean(TestElement.ENABLED)) {
+        if (!lastNode.getPropertyAsBoolean(TestElement.ENABLED)) {
             log.info("*** Removing *** "+lastNode);// TODO not sure this is ever called
-			tree.getTree(stack).remove(lastNode);
-		}
-	}
+            tree.getTree(stack).remove(lastNode);
+        }
+    }
 
-	public void processPath() {
-	}
+    public void processPath() {
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/FunctionParser.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 /*
@@ -33,198 +33,198 @@
 import org.apache.log.Logger;
 
 /**
- * Parses function / variable references of the form 
- * ${functionName[([var[,var...]])]} 
- * and 
+ * Parses function / variable references of the form
+ * ${functionName[([var[,var...]])]}
+ * and
  * ${variableName}
  */
 class FunctionParser {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	/**
-	 * Compile a general string into a list of elements for a CompoundVariable.
-	 * 
-	 * Calls {@link #makeFunction(StringReader)} if it detects an unescaped "${".
-	 * 
-	 * @param value string containing the function / variable references (if any)
-	 * 
-	 * @return list of strings or Objects representing functions
-	 */
-	LinkedList compileString(String value) throws InvalidVariableException {
-		StringReader reader = new StringReader(value);
-		LinkedList result = new LinkedList();
-		StringBuffer buffer = new StringBuffer();
-		char previous = ' '; // TODO - why use space?
-		char[] current = new char[1];
-		try {
-			while (reader.read(current) == 1) {
-				if (current[0] == '\\') {
-					previous = current[0];
-					if (reader.read(current) == 0) {
-						break;
-					}
-					if (current[0] != '$' && current[0] != ',' && current[0] != '\\') {
-						buffer.append(previous); // i.e. '\\'
-					}
-					previous = ' ';
-					buffer.append(current[0]);
-					continue;
-				} else if (current[0] == '{' && previous == '$') {// found "${"
-					buffer.deleteCharAt(buffer.length() - 1);
-					if (buffer.length() > 0) {// save leading text
-						result.add(buffer.toString());
-						buffer.setLength(0);
-					}
-					result.add(makeFunction(reader));
-					previous = ' ';
-				} else {
-					buffer.append(current[0]);
-					previous = current[0];
-				}
-			}
-			if (buffer.length() > 0) {
-				result.add(buffer.toString());
-			}
-		} catch (IOException e) {
-			log.error("Error parsing function: " + value, e);
-			result.clear();
-			result.add(value);
-		}
-		if (result.size() == 0) {
-			result.add("");
-		}
-		return result;
-	}
-
-	/**
-	 * Compile a string into a function or SimpleVariable.
-	 * 
-	 * Called by {@link #compileString(String)} when that has detected "${".
-	 * 
-	 * Calls {@link CompoundVariable#getNamedFunction(String)} if it detects: 
-	 * '(' - start of parameter list
-	 * '}' - end of function call
-	 *  
-	 * @param reader points to input after the "${"
-	 * @return the function or variable object (or a String)
-	 */
-	Object makeFunction(StringReader reader) throws InvalidVariableException {
-		char[] current = new char[1];
-		char previous = ' '; // TODO - why use space?
-		StringBuffer buffer = new StringBuffer();
-		Object function;
-		try {
-			while (reader.read(current) == 1) {
-				if (current[0] == '\\') {
-					if (reader.read(current) == 0) {
-						break;
-					}
-					previous = ' ';
-					buffer.append(current[0]);
-					continue;
-				} else if (current[0] == '(' && previous != ' ') {
+    /**
+     * Compile a general string into a list of elements for a CompoundVariable.
+     *
+     * Calls {@link #makeFunction(StringReader)} if it detects an unescaped "${".
+     *
+     * @param value string containing the function / variable references (if any)
+     *
+     * @return list of strings or Objects representing functions
+     */
+    LinkedList compileString(String value) throws InvalidVariableException {
+        StringReader reader = new StringReader(value);
+        LinkedList result = new LinkedList();
+        StringBuffer buffer = new StringBuffer();
+        char previous = ' '; // TODO - why use space?
+        char[] current = new char[1];
+        try {
+            while (reader.read(current) == 1) {
+                if (current[0] == '\\') {
+                    previous = current[0];
+                    if (reader.read(current) == 0) {
+                        break;
+                    }
+                    if (current[0] != '$' && current[0] != ',' && current[0] != '\\') {
+                        buffer.append(previous); // i.e. '\\'
+                    }
+                    previous = ' ';
+                    buffer.append(current[0]);
+                    continue;
+                } else if (current[0] == '{' && previous == '$') {// found "${"
+                    buffer.deleteCharAt(buffer.length() - 1);
+                    if (buffer.length() > 0) {// save leading text
+                        result.add(buffer.toString());
+                        buffer.setLength(0);
+                    }
+                    result.add(makeFunction(reader));
+                    previous = ' ';
+                } else {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                }
+            }
+            if (buffer.length() > 0) {
+                result.add(buffer.toString());
+            }
+        } catch (IOException e) {
+            log.error("Error parsing function: " + value, e);
+            result.clear();
+            result.add(value);
+        }
+        if (result.size() == 0) {
+            result.add("");
+        }
+        return result;
+    }
+
+    /**
+     * Compile a string into a function or SimpleVariable.
+     *
+     * Called by {@link #compileString(String)} when that has detected "${".
+     *
+     * Calls {@link CompoundVariable#getNamedFunction(String)} if it detects:
+     * '(' - start of parameter list
+     * '}' - end of function call
+     *
+     * @param reader points to input after the "${"
+     * @return the function or variable object (or a String)
+     */
+    Object makeFunction(StringReader reader) throws InvalidVariableException {
+        char[] current = new char[1];
+        char previous = ' '; // TODO - why use space?
+        StringBuffer buffer = new StringBuffer();
+        Object function;
+        try {
+            while (reader.read(current) == 1) {
+                if (current[0] == '\\') {
+                    if (reader.read(current) == 0) {
+                        break;
+                    }
+                    previous = ' ';
+                    buffer.append(current[0]);
+                    continue;
+                } else if (current[0] == '(' && previous != ' ') {
                     String funcName = buffer.toString();
-					function = CompoundVariable.getNamedFunction(funcName);
-					buffer.setLength(0);
-					if (function instanceof Function) {
-						((Function) function).setParameters(parseParams(reader));
-						if (reader.read(current) == 0 || current[0] != '}') {
+                    function = CompoundVariable.getNamedFunction(funcName);
+                    buffer.setLength(0);
+                    if (function instanceof Function) {
+                        ((Function) function).setParameters(parseParams(reader));
+                        if (reader.read(current) == 0 || current[0] != '}') {
                             reader.reset();// set to start of string
                             char []cb = new char[100];
                             reader.read(cb);// return deliberately ignored
-							throw new InvalidVariableException
+                            throw new InvalidVariableException
                             ("Expected } after "+funcName+" function call in "+new String(cb));
-						}
-						if (function instanceof TestListener) {
-							StandardJMeterEngine.register((TestListener) function);
-						}
-						return function;
-					}
-					continue;
-				} else if (current[0] == '}') {// variable, or function with no parameter list
-					function = CompoundVariable.getNamedFunction(buffer.toString());
-					if (function instanceof Function){// ensure that setParameters() is called.
-						((Function) function).setParameters(new LinkedList());
-					}
-					buffer.setLength(0);
-					return function;
-				} else {
-					buffer.append(current[0]);
-					previous = current[0];
-				}
-			}
-		} catch (IOException e) {
-			log.error("Error parsing function: " + buffer.toString(), e);
-			return null;
-		}
-		log.warn("Probably an invalid function string: " + buffer.toString());
-		return buffer.toString();
-	}
-
-	/**
-	 * Compile a String into a list of parameters, each made into a
-	 * CompoundVariable.
-	 */
-	LinkedList parseParams(StringReader reader) throws InvalidVariableException {
-		LinkedList result = new LinkedList();
-		StringBuffer buffer = new StringBuffer();
-		char[] current = new char[1];
-		char previous = ' ';
-		int functionRecursion = 0;
-		int parenRecursion = 0;
-		try {
-			while (reader.read(current) == 1) {
-				if (current[0] == '\\') {
-					buffer.append(current[0]);
-					if (reader.read(current) == 0) {
-						break;
-					}
-					previous = ' ';
-					buffer.append(current[0]);
-					continue;
-				} else if (current[0] == ',' && functionRecursion == 0) {
-					CompoundVariable param = new CompoundVariable();
-					param.setParameters(buffer.toString());
-					buffer.setLength(0);
-					result.add(param);
-				} else if (current[0] == ')' && functionRecursion == 0 && parenRecursion == 0) {
-					// Detect functionName() so this does not generate empty string as the parameter
-					if (buffer.length() == 0 && result.isEmpty()){
-						return result;
-					}
-					CompoundVariable param = new CompoundVariable();
-					param.setParameters(buffer.toString());
-					buffer.setLength(0);
-					result.add(param);
-					return result;
-				} else if (current[0] == '{' && previous == '$') {
-					buffer.append(current[0]);
-					previous = current[0];
-					functionRecursion++;
-				} else if (current[0] == '}' && functionRecursion > 0) {
-					buffer.append(current[0]);
-					previous = current[0];
-					functionRecursion--;
-				} else if (current[0] == ')' && functionRecursion == 0 && parenRecursion > 0) {
-					buffer.append(current[0]);
-					previous = current[0];
-					parenRecursion--;
-				} else if (current[0] == '(' && functionRecursion == 0) {
-					buffer.append(current[0]);
-					previous = current[0];
-					parenRecursion++;
-				} else {
-					buffer.append(current[0]);
-					previous = current[0];
-				}
-			}
-		} catch (IOException e) {
-			log.error("Error parsing function: " + buffer.toString(), e);
-		}
-		log.warn("Probably an invalid function string: " + buffer.toString());
-		CompoundVariable var = new CompoundVariable();
-		var.setParameters(buffer.toString());
-		result.add(var);
-		return result;
-	}
+                        }
+                        if (function instanceof TestListener) {
+                            StandardJMeterEngine.register((TestListener) function);
+                        }
+                        return function;
+                    }
+                    continue;
+                } else if (current[0] == '}') {// variable, or function with no parameter list
+                    function = CompoundVariable.getNamedFunction(buffer.toString());
+                    if (function instanceof Function){// ensure that setParameters() is called.
+                        ((Function) function).setParameters(new LinkedList());
+                    }
+                    buffer.setLength(0);
+                    return function;
+                } else {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                }
+            }
+        } catch (IOException e) {
+            log.error("Error parsing function: " + buffer.toString(), e);
+            return null;
+        }
+        log.warn("Probably an invalid function string: " + buffer.toString());
+        return buffer.toString();
+    }
+
+    /**
+     * Compile a String into a list of parameters, each made into a
+     * CompoundVariable.
+     */
+    LinkedList parseParams(StringReader reader) throws InvalidVariableException {
+        LinkedList result = new LinkedList();
+        StringBuffer buffer = new StringBuffer();
+        char[] current = new char[1];
+        char previous = ' ';
+        int functionRecursion = 0;
+        int parenRecursion = 0;
+        try {
+            while (reader.read(current) == 1) {
+                if (current[0] == '\\') {
+                    buffer.append(current[0]);
+                    if (reader.read(current) == 0) {
+                        break;
+                    }
+                    previous = ' ';
+                    buffer.append(current[0]);
+                    continue;
+                } else if (current[0] == ',' && functionRecursion == 0) {
+                    CompoundVariable param = new CompoundVariable();
+                    param.setParameters(buffer.toString());
+                    buffer.setLength(0);
+                    result.add(param);
+                } else if (current[0] == ')' && functionRecursion == 0 && parenRecursion == 0) {
+                    // Detect functionName() so this does not generate empty string as the parameter
+                    if (buffer.length() == 0 && result.isEmpty()){
+                        return result;
+                    }
+                    CompoundVariable param = new CompoundVariable();
+                    param.setParameters(buffer.toString());
+                    buffer.setLength(0);
+                    result.add(param);
+                    return result;
+                } else if (current[0] == '{' && previous == '$') {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                    functionRecursion++;
+                } else if (current[0] == '}' && functionRecursion > 0) {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                    functionRecursion--;
+                } else if (current[0] == ')' && functionRecursion == 0 && parenRecursion > 0) {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                    parenRecursion--;
+                } else if (current[0] == '(' && functionRecursion == 0) {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                    parenRecursion++;
+                } else {
+                    buffer.append(current[0]);
+                    previous = current[0];
+                }
+            }
+        } catch (IOException e) {
+            log.error("Error parsing function: " + buffer.toString(), e);
+        }
+        log.warn("Probably an invalid function string: " + buffer.toString());
+        CompoundVariable var = new CompoundVariable();
+        var.setParameters(buffer.toString());
+        result.add(var);
+        return result;
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceFunctionsWithStrings.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceFunctionsWithStrings.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceFunctionsWithStrings.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceFunctionsWithStrings.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 /*
@@ -42,57 +42,57 @@
 /**
  * Transforms strings into variable references (in spite of the name, which
  * suggests the opposite!)
- * 
+ *
  */
 public class ReplaceFunctionsWithStrings extends AbstractTransformer {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	// Functions are wrapped in ${ and }
-	private static final String FUNCTION_REF_PREFIX = "${"; //$NON-NLS-1$
+    // Functions are wrapped in ${ and }
+    private static final String FUNCTION_REF_PREFIX = "${"; //$NON-NLS-1$
 
-	private static final String FUNCTION_REF_SUFFIX = "}"; //$NON-NLS-1$
+    private static final String FUNCTION_REF_SUFFIX = "}"; //$NON-NLS-1$
 
-	private boolean regexMatch;// Should we match using regexes?
+    private boolean regexMatch;// Should we match using regexes?
 
-	public ReplaceFunctionsWithStrings(CompoundVariable masterFunction, Map variables) {
-		this(masterFunction, variables, false);
-	}
-
-	public ReplaceFunctionsWithStrings(CompoundVariable masterFunction, Map variables, boolean regexMatch) {
-		super();
-		setMasterFunction(masterFunction);
-		setVariables(variables);
-		this.regexMatch = regexMatch;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see ValueTransformer#transformValue(JMeterProperty)
-	 */
-	public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
-		PatternMatcher pm = JMeterUtils.getMatcher();
-		Pattern pattern = null;
-		PatternCompiler compiler = new Perl5Compiler();
-		Iterator iter = getVariables().keySet().iterator();
-		String input = prop.getStringValue();
-		while (iter.hasNext()) {
-			String key = (String) iter.next();
-			String value = (String) getVariables().get(key);
-			if (regexMatch) {
-				try {
-					pattern = compiler.compile(value);
-					input = Util.substitute(pm, pattern, 
-							new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX), 
-							input, Util.SUBSTITUTE_ALL);
-				} catch (MalformedPatternException e) {
-					log.warn("Malformed pattern " + value);
-				}
-			} else {
-				input = StringUtilities.substitute(input, value, FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX);
-			}
-		}
-		StringProperty newProp = new StringProperty(prop.getName(), input);
-		return newProp;
-	}
+    public ReplaceFunctionsWithStrings(CompoundVariable masterFunction, Map variables) {
+        this(masterFunction, variables, false);
+    }
+
+    public ReplaceFunctionsWithStrings(CompoundVariable masterFunction, Map variables, boolean regexMatch) {
+        super();
+        setMasterFunction(masterFunction);
+        setVariables(variables);
+        this.regexMatch = regexMatch;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see ValueTransformer#transformValue(JMeterProperty)
+     */
+    public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
+        PatternMatcher pm = JMeterUtils.getMatcher();
+        Pattern pattern = null;
+        PatternCompiler compiler = new Perl5Compiler();
+        Iterator iter = getVariables().keySet().iterator();
+        String input = prop.getStringValue();
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            String value = (String) getVariables().get(key);
+            if (regexMatch) {
+                try {
+                    pattern = compiler.compile(value);
+                    input = Util.substitute(pm, pattern,
+                            new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX),
+                            input, Util.SUBSTITUTE_ALL);
+                } catch (MalformedPatternException e) {
+                    log.warn("Malformed pattern " + value);
+                }
+            } else {
+                input = StringUtilities.substitute(input, value, FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX);
+            }
+        }
+        StringProperty newProp = new StringProperty(prop.getName(), input);
+        return newProp;
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceStringWithFunctions.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceStringWithFunctions.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceStringWithFunctions.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/ReplaceStringWithFunctions.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 /*
@@ -28,25 +28,25 @@
 import org.apache.jmeter.testelement.property.JMeterProperty;
 
 public class ReplaceStringWithFunctions extends AbstractTransformer {
-	public ReplaceStringWithFunctions(CompoundVariable masterFunction, Map variables) {
-		super();
-		setMasterFunction(masterFunction);
-		setVariables(variables);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see ValueTransformer#transformValue(JMeterProperty)
-	 */
-	public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
-		JMeterProperty newValue = prop;
-		getMasterFunction().clear();
-		getMasterFunction().setParameters(prop.getStringValue());
-		if (getMasterFunction().hasFunction()) {
-			newValue = new FunctionProperty(prop.getName(), getMasterFunction().getFunction());
-		}
-		return newValue;
-	}
+    public ReplaceStringWithFunctions(CompoundVariable masterFunction, Map variables) {
+        super();
+        setMasterFunction(masterFunction);
+        setVariables(variables);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see ValueTransformer#transformValue(JMeterProperty)
+     */
+    public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
+        JMeterProperty newValue = prop;
+        getMasterFunction().clear();
+        getMasterFunction().setParameters(prop.getStringValue());
+        if (getMasterFunction().hasFunction()) {
+            newValue = new FunctionProperty(prop.getName(), getMasterFunction().getFunction());
+        }
+        return newValue;
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/SimpleVariable.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/SimpleVariable.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/SimpleVariable.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/SimpleVariable.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.engine.util;
@@ -24,45 +24,45 @@
 
 public class SimpleVariable {
 
-	private String name;
+    private String name;
 
-	public SimpleVariable(String name) {
-		this.name = name;
-	}
-
-	public SimpleVariable() {
-		this.name = ""; //$NON-NLS-1$
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * @see org.apache.jmeter.functions.Function#execute
-	 */
-	public String toString() {
-		String ret = null;
-		JMeterVariables vars = getVariables();
-
-		if (vars != null) {
-			ret = vars.get(name);
-		}
-
-		if (ret == null) {
-			return "${" + name + "}";
-		}
-
-		return ret;
-	}
-
-	private JMeterVariables getVariables() {
-		JMeterContext context = JMeterContextService.getContext();
-		return context.getVariables();
-	}
+    public SimpleVariable(String name) {
+        this.name = name;
+    }
+
+    public SimpleVariable() {
+        this.name = ""; //$NON-NLS-1$
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @see org.apache.jmeter.functions.Function#execute
+     */
+    public String toString() {
+        String ret = null;
+        JMeterVariables vars = getVariables();
+
+        if (vars != null) {
+            ret = vars.get(name);
+        }
+
+        if (ret == null) {
+            return "${" + name + "}";
+        }
+
+        return ret;
+    }
+
+    private JMeterVariables getVariables() {
+        JMeterContext context = JMeterContextService.getContext();
+        return context.getVariables();
+    }
 
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/UndoVariableReplacement.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/UndoVariableReplacement.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/UndoVariableReplacement.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/util/UndoVariableReplacement.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 /*
@@ -30,27 +30,27 @@
 import org.apache.jmeter.util.StringUtilities;
 
 public class UndoVariableReplacement extends AbstractTransformer {
-	public UndoVariableReplacement(CompoundVariable masterFunction, Map variables) {
-		super();
-		setMasterFunction(masterFunction);
-		setVariables(variables);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see ValueTransformer#transformValue(JMeterProperty)
-	 */
-	public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
-		Iterator iter = getVariables().keySet().iterator();
-		String input = prop.getStringValue();
-		while (iter.hasNext()) {
-			String key = (String) iter.next();
-			String value = (String) getVariables().get(key);
-			input = StringUtilities.substitute(input, "${" + key + "}", value);
-		}
-		StringProperty newProp = new StringProperty(prop.getName(), input);
-		return newProp;
-	}
+    public UndoVariableReplacement(CompoundVariable masterFunction, Map variables) {
+        super();
+        setMasterFunction(masterFunction);
+        setVariables(variables);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see ValueTransformer#transformValue(JMeterProperty)
+     */
+    public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
+        Iterator iter = getVariables().keySet().iterator();
+        String input = prop.getStringValue();
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            String value = (String) getVariables().get(key);
+            input = StringUtilities.substitute(input, "${" + key + "}", value);
+        }
+        StringProperty newProp = new StringProperty(prop.getName(), input);
+        return newProp;
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org