Bug 60654 - Validation Feature : Be able to ignore BackendListener

Based on https://github.com/apache/jmeter/pull/258 from Maxime Chassagneux
Bugzilla Id: 60654

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1780469 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: c5a10517ac
This commit is contained in:
Philippe Mouawad 2017-01-26 20:17:54 +00:00
parent f4adb15a4d
commit 0b69ec164a
6 changed files with 31 additions and 3 deletions

View File

@ -1290,6 +1290,9 @@ system.properties=system.properties
# Number of threads to use to validate a Thread Group
#testplan_validation.nb_threads_per_thread_group=1
# Ignore BackendListener when validating the thread group of plan
#testplan_validation.ignore_backends=true
# Ignore timers when validating the thread group of plan
#testplan_validation.ignore_timers=true

View File

@ -48,7 +48,8 @@ import org.apache.log.Logger;
* @since 2.13
*/
public class BackendListener extends AbstractTestElement
implements Serializable, SampleListener, TestStateListener, NoThreadClone, Remoteable {
implements Backend, Serializable, SampleListener,
TestStateListener, NoThreadClone, Remoteable {
/**
*

View File

@ -24,6 +24,7 @@ import org.apache.jmeter.threads.AbstractThreadGroup;
import org.apache.jmeter.threads.ThreadGroup;
import org.apache.jmeter.timers.Timer;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.visualizers.backend.Backend;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
@ -39,11 +40,17 @@ public class TreeClonerForValidation extends TreeCloner {
* Number of Threads to configure when running a Thread Group during a validation
*/
protected static final int VALIDATION_NUMBER_OF_THREADS = JMeterUtils.getPropDefault("testplan_validation.nb_threads_per_thread_group", 1); //$NON-NLS-1$
/**
* Ignore or not timers during a Thread Group validation
*/
protected static final boolean VALIDATION_IGNORE_TIMERS = JMeterUtils.getPropDefault("testplan_validation.ignore_timers", true); //$NON-NLS-1$
/**
* Ignore or not Backend during a Thread Group validation
*/
protected static final boolean VALIDATION_IGNORE_BACKENDS = JMeterUtils.getPropDefault("testplan_validation.ignore_backends", true); //$NON-NLS-1$
/**
* Number of iterations to run during a Thread Group validation
*/
@ -70,8 +77,9 @@ public class TreeClonerForValidation extends TreeCloner {
*/
@Override
protected Object addNodeToTree(Object node) {
if(VALIDATION_IGNORE_TIMERS && node instanceof Timer) {
return node; // don't add the timer
if((VALIDATION_IGNORE_TIMERS && node instanceof Timer) ||
(VALIDATION_IGNORE_BACKENDS && node instanceof Backend)) {
return node; // don't add timer or backend
} else {
Object clonedNode = super.addNodeToTree(node);
if(clonedNode instanceof org.apache.jmeter.threads.ThreadGroup) {

View File

@ -0,0 +1,11 @@
package org.apache.jmeter.visualizers.backend;
import java.io.Serializable;
/**
* Identifies Backend components
* @since 3.2
*/
public interface Backend extends Serializable {
// NOOP
}

View File

@ -161,6 +161,7 @@ JMeter now requires Java 8. Ensure you use most up to date version.
<li><bug>60595</bug>Add a SplashScreen at the start of JMeter GUI. Contributed by Maxime Chassagneux (maxime.chassagneux at gmail.com).</li>
<li><bug>55258</bug>Drop "Close" icon from toolbar and add "New" to menu. Partly based on contribution from Sanduni Kanishka (https://github.com/SanduniKanishka)</li>
<li><bug>59995</bug>Allow user to change font size with 2 new menu items and use <code>jmeter.hidpi.scale.factor</code> for scaling fonts. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
<li><bug>60654</bug>Validation Feature : Be able to ignore BackendListener. Contributed by Maxime Chassagneux (maxime.chassagneux at gmail.com).</li>
</ul>
<ch_section>Non-functional changes</ch_section>

View File

@ -1781,6 +1781,10 @@ log_level.org.apache.http.client=DEBUG
Ignore timers when validating the thread group of plan.<br/>
Defaults to: <code>true</code>
</property>
<property name="testplan_validation.ignore_backends">
Ignore BackendListener when validating the thread group of plan.<br/>
Defaults to: <code>true</code>
</property>
<property name="testplan_validation.number_iterations">
Number of iterations to use to validate a Thread Group.<br/>
Defaults to: <code>1</code>