I think this is a bad idea.

It's unnecessary code to achieve what can already be done by disabling
the timer.

Please don't make changes like this before discussing them first.

On 3 September 2016 at 10:24,  <pmoua...@apache.org> wrote:
> Author: pmouawad
> Date: Sat Sep  3 09:24:08 2016
> New Revision: 1759062
>
> URL: http://svn.apache.org/viewvc?rev=1759062&view=rev
> Log:
> Bug 60082 - Validation mode : Be able to force Throughput Controller to run 
> as if it was set to 100%
> Bugzilla Id: 60082
>
> Added:
>     jmeter/trunk/src/components/org/apache/jmeter/validation/
>     
> jmeter/trunk/src/components/org/apache/jmeter/validation/ComponentTreeClonerForValidation.java
>    (with props)
> Modified:
>     jmeter/trunk/bin/jmeter.properties
>     jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java
>     jmeter/trunk/xdocs/changes.xml
>     jmeter/trunk/xdocs/usermanual/component_reference.xml
>
> Modified: jmeter/trunk/bin/jmeter.properties
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1759062&r1=1759061&r2=1759062&view=diff
> ==============================================================================
> --- jmeter/trunk/bin/jmeter.properties (original)
> +++ jmeter/trunk/bin/jmeter.properties Sat Sep  3 09:24:08 2016
> @@ -1232,7 +1232,7 @@ system.properties=system.properties
>  # It runs validation without timers, with 1 thread, 1 iteration and Startup 
> Delay set to 0
>  # You can implement your own policy that must extend 
> org.apache.jmeter.engine.TreeCloner
>  # JMeter will instantiate it and use it to create the Tree used to run 
> validation on Thread Group
> -#testplan_validation.tree_cloner_class=org.apache.jmeter.gui.action.validation.TreeClonerForValidation
> +#testplan_validation.tree_cloner_class=org.apache.jmeter.validation.ComponentTreeClonerForValidation
>
>  # Number of threads to use to validate a Thread Group
>  #testplan_validation.nb_threads_per_thread_group=1
> @@ -1242,3 +1242,7 @@ system.properties=system.properties
>
>  # Number of iterations to use to validate a Thread Group
>  #testplan_validation.number_iterations=1
> +
> +# Force throuput controllers that work in percentage mode to be a 100%
> +# Disabled by default
> +#testplan_validation.tpc_force_100_pct=false
> \ No newline at end of file
>
> Added: 
> jmeter/trunk/src/components/org/apache/jmeter/validation/ComponentTreeClonerForValidation.java
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/validation/ComponentTreeClonerForValidation.java?rev=1759062&view=auto
> ==============================================================================
> --- 
> jmeter/trunk/src/components/org/apache/jmeter/validation/ComponentTreeClonerForValidation.java
>  (added)
> +++ 
> jmeter/trunk/src/components/org/apache/jmeter/validation/ComponentTreeClonerForValidation.java
>  Sat Sep  3 09:24:08 2016
> @@ -0,0 +1,58 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * 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.validation;
> +
> +import org.apache.jmeter.control.ThroughputController;
> +import org.apache.jmeter.gui.action.validation.TreeClonerForValidation;
> +import org.apache.jmeter.util.JMeterUtils;
> +
> +/**
> + * Clones the test tree, modifying throughput controller percentage
> + * @since 3.1
> + */
> +public class ComponentTreeClonerForValidation extends 
> TreeClonerForValidation {
> +
> +    /**
> +     * For 100% on ThroughputController
> +     */
> +    protected static final boolean VALIDATION_TPC_FORCE_100_PERCENT = 
> JMeterUtils.getPropDefault("testplan_validation.tpc_force_100_pct", false); 
> //$NON-NLS-1$
> +
> +    public ComponentTreeClonerForValidation() {
> +        this(false);
> +    }
> +
> +    public ComponentTreeClonerForValidation(boolean honourNoThreadClone) {
> +        super(honourNoThreadClone);
> +    }
> +
> +    /**
> +     * @see 
> org.apache.jmeter.engine.TreeCloner#addNodeToTree(java.lang.Object)
> +     */
> +    @Override
> +    protected Object addNodeToTree(Object node) {
> +        Object clonedNode = super.addNodeToTree(node);
> +        if (VALIDATION_TPC_FORCE_100_PERCENT && clonedNode instanceof 
> ThroughputController) {
> +            ThroughputController tc = (ThroughputController) clonedNode;
> +            if(tc.getStyle() == ThroughputController.BYPERCENT) {
> +                tc.setPercentThroughput(100);
> +            }
> +        }
> +        return clonedNode;
> +    }
> +}
>
> Propchange: 
> jmeter/trunk/src/components/org/apache/jmeter/validation/ComponentTreeClonerForValidation.java
> ------------------------------------------------------------------------------
>     svn:mime-type = text/plain
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java?rev=1759062&r1=1759061&r2=1759062&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java Sat Sep  3 
> 09:24:08 2016
> @@ -71,7 +71,7 @@ public class Start extends AbstractActio
>       */
>      private static final String CLONER_FOR_VALIDATION_CLASS_NAME =
>              
> JMeterUtils.getPropDefault(VALIDATION_CLONER_CLASS_PROPERTY_NAME, 
> //$NON-NLS-1$
> -                    TreeClonerForValidation.class.getName());
> +                    
> "org.apache.jmeter.validation.ComponentTreeClonerForValidation");
>
>      static {
>          commands.add(ActionNames.ACTION_START);
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1759062&r1=1759061&r2=1759062&view=diff
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Sep  3 09:24:08 2016
> @@ -94,6 +94,7 @@ Summary
>  <ul>
>      <li><bug>59351</bug>Improve log/error/message for IncludeController. 
> Partly contributed by Antonio Gomes Rodrigues (ra0077 at gmail.com)</li>
>      <li><bug>60023</bug>ThroughputController : Make "Percent Executions" and 
> global the default values. Contributed by Ubik Load Pack (support at 
> ubikloadpack.com)</li>
> +    <li><bug>60082</bug>Validation mode : Be able to force Throughput 
> Controller to run as if it was set to 100%</li>
>  </ul>
>
>  <h3>Listeners</h3>
>
> Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1759062&r1=1759061&r2=1759062&view=diff
> ==============================================================================
> --- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
> +++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Sep  3 09:24:08 
> 2016
> @@ -6171,11 +6171,12 @@ Since JMeter 3.0, you can run a selectio
>
>  <b>Validation Mode:</b><br></br>
>  This mode enables rapid validation of a Thread Group by running it with 1 
> thread, 1 iteration, no timers and no <code>Startup delay</code> set to 0.
> -The 3 first properties can be modified by setting in user.properties:
> +Behaviour can be modified with some properties by setting in user.properties:
>  <ul>
>  <li><code>testplan_validation.nb_threads_per_thread_group</code> : Number of 
> threads to use to validate a Thread Group, by default 1</li>
>  <li><code>testplan_validation.ignore_timers</code> : Ignore timers when 
> validating the thread group of plan, by default 1</li>
>  <li><code>testplan_validation.number_iterations</code> : Number of 
> iterations to use to validate a Thread Group</li>
> +<li><code>testplan_validation.tpc_force_100_pct</code> : Wether to force 
> Throughput Controller in percentage mode to run as if percentage was 100%. 
> Defaults to false</li>
>  </ul>
>  </p>
>
>
>

Reply via email to