Author: sebb Date: Fri Sep 19 17:44:52 2008 New Revision: 697309 URL: http://svn.apache.org/viewvc?rev=697309&view=rev Log: Move PreProcessor handling from TestCompiler to JMeterThread class, which already handles PostProcessors.
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java jakarta/jmeter/trunk/xdocs/changes.xml Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=697309&r1=697308&r2=697309&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java Fri Sep 19 17:44:52 2008 @@ -34,11 +34,13 @@ import org.apache.jmeter.engine.event.LoopIterationListener; import org.apache.jmeter.gui.GuiPackage; import org.apache.jmeter.processor.PostProcessor; +import org.apache.jmeter.processor.PreProcessor; import org.apache.jmeter.samplers.SampleEvent; import org.apache.jmeter.samplers.SampleListener; import org.apache.jmeter.samplers.SampleResult; import org.apache.jmeter.samplers.Sampler; import org.apache.jmeter.testbeans.TestBeanHelper; +import org.apache.jmeter.testelement.AbstractTestElement; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.TestListener; import org.apache.jmeter.testelement.ThreadListener; @@ -323,6 +325,7 @@ if(current != null) { // Get the sampler ready to sample SamplePackage pack = compiler.configureSampler(current); + runPreProcessors(pack.getPreProcessors()); // Hack: save the package for any transaction controllers threadVars.putObject(PACKAGE_OBJECT, pack); @@ -563,6 +566,18 @@ } } + private void runPreProcessors(List preProcessors) { + Iterator iter = preProcessors.iterator(); + while (iter.hasNext()) { + PreProcessor ex = (PreProcessor) iter.next(); + if (log.isDebugEnabled()) { + log.debug("Running preprocessor: " + ((AbstractTestElement) ex).getName()); + } + TestBeanHelper.prepare((TestElement) ex); + ex.process(); + } + } + private void delay(List timers) { long sum = 0; Iterator iter = timers.iterator(); Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java?rev=697309&r1=697308&r2=697309&view=diff ============================================================================== --- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java (original) +++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java Fri Sep 19 17:44:52 2008 @@ -38,7 +38,6 @@ import org.apache.jmeter.samplers.SampleListener; import org.apache.jmeter.samplers.Sampler; import org.apache.jmeter.testbeans.TestBeanHelper; -import org.apache.jmeter.testelement.AbstractTestElement; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.timers.Timer; import org.apache.jorphan.collections.HashTree; @@ -49,17 +48,17 @@ public class TestCompiler implements HashTreeTraverser { private static final Logger log = LoggingManager.getLoggerForClass(); - private LinkedList stack = new LinkedList(); + private final LinkedList stack = new LinkedList(); - private Map samplerConfigMap = new HashMap(); + private final Map samplerConfigMap = new HashMap(); - private Map transactionControllerConfigMap = new HashMap(); + private final Map transactionControllerConfigMap = new HashMap(); - private HashTree testTree; + private final HashTree testTree; /* - * This set keeps track of which ObjectPairs have been seen Its purpose is - * not entirely clear (please document if you know!) but it is needed,.. + * This set keeps track of which ObjectPairs have been seen. + * Its purpose is not entirely clear (please document if you know!) but it is needed,.. */ private static final Set pairing = new HashSet(); @@ -84,7 +83,6 @@ SamplePackage pack = (SamplePackage) samplerConfigMap.get(sampler); pack.setSampler(sampler); configureWithConfigElements(sampler, pack.getConfigs()); - runPreProcessors(pack.getPreProcessors()); return pack; } @@ -95,18 +93,6 @@ return pack; } - private void runPreProcessors(List preProcessors) { - Iterator iter = preProcessors.iterator(); - while (iter.hasNext()) { - PreProcessor ex = (PreProcessor) iter.next(); - if (log.isDebugEnabled()) { - log.debug("Running preprocessor: " + ((AbstractTestElement) ex).getName()); - } - TestBeanHelper.prepare((TestElement) ex); - ex.process(); - } - } - public void done(SamplePackage pack) { pack.recoverRunningVersion(); } Modified: jakarta/jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=697309&r1=697308&r2=697309&view=diff ============================================================================== --- jakarta/jmeter/trunk/xdocs/changes.xml (original) +++ jakarta/jmeter/trunk/xdocs/changes.xml Fri Sep 19 17:44:52 2008 @@ -80,6 +80,11 @@ They do not affect test plans or test behaviour. </p> <p> +The PreProcessors are now invoked directly by the JMeterThread class, +rather than by the TestCompiler#configureSampler() method. (JMeterThread handles the PostProcessors). +This does not affect test plans or behaviour, but could perhaps affect 3rd party add-ons (very unlikely). +</p> +<p> Moved the Scoping Rules sub-section from Section 3. "Building a Test Plan" to Section 4. "Elements of a test plan" </p> @@ -120,6 +125,7 @@ <li>Introduce AbstractListenerGui class to make it easier to create Listeners with no visual output</li> <li>Assertions run after PostProcessors; change order of pop-up menus accordingly</li> <li>Remove unnecessary clone() methods from function classes</li> +<li>Moved PreProcessor invocation to JMeterThread class</li> </ul> </section> </body> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]