jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [jmeter] FSchumacher commented on a change in pull request #571: Add prefix or suffix sampler numbering for HTTP Test Script Recorder
Date Sun, 16 Aug 2020 10:43:31 GMT

FSchumacher commented on a change in pull request #571:
URL: https://github.com/apache/jmeter/pull/571#discussion_r471095198



##########
File path: src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
##########
@@ -355,6 +406,48 @@ public void setHTTPSampleNamingMode(int httpNamingMode) {
         setProperty(new IntegerProperty(HTTP_SAMPLER_NAMING_MODE, httpNamingMode));
     }
 
+    public void setHttpSampleNumberingMode(int httpSampleNumberingMode) {
+        
+        if (httpSampleNumberingMode == HttpSamplerNumberingMode.PREFIX.getIntValue()) {
+        	sNumberingMode = HttpSamplerNumberingMode.PREFIX.getStringMode();
+        	JMeterUtils.setProperty("proxy.number.mode", "prefix");
+        	JMeterUtils.setProperty("proxy.number.requests", "true");
+        } else if (httpSampleNumberingMode ==  HttpSamplerNumberingMode.SUFFIX.getIntValue())
{
+            // choose suffix numbering
+        	sNumberingMode =  HttpSamplerNumberingMode.SUFFIX.getStringMode();
+        	JMeterUtils.setProperty("proxy.number.mode", "suffix");
+        	JMeterUtils.setProperty("proxy.number.requests", "true");        	
+        } else if (httpSampleNumberingMode == HttpSamplerNumberingMode.NO_NUMBER.getIntValue())
{
+            // choose no numbering
+        	sNumberingMode = HttpSamplerNumberingMode.NO_NUMBER.getStringMode();
+        	JMeterUtils.setProperty("proxy.number.requests", "false");
+        }
+    }
+
+    public void setHttpSamplerNumberingStartValue(int httpSamplerNumberingStartValue) {
+        iNumberingStartValue=  httpSamplerNumberingStartValue;
+    }
+
+    public void setHttpSamplerNumberingStartForSamplerCreator(int httpSamplerNumberingStartValue)
{
+        iNumberingStartValue =  httpSamplerNumberingStartValue;
+        // change the numbering start value directly to the AtomicInteger REQUEST_NUMBER
in the AbstractSamplerCreator
+        SamplerCreator samplerCreator = samplerCreatorFactory.getDefaultSamplerCreator();
+        samplerCreator.setRequestNumber(httpSamplerNumberingStartValue);
+    }
+
+    public int getRequestNumberFromSamplerCreator() {
+        int iRequestNumber = 1;
+        SamplerCreator samplerCreator = samplerCreatorFactory.getDefaultSamplerCreator();

Review comment:
       I think that this assumption may not always be correct, as the `DefaultSamplerCreator`
is probably the only factory, that would really work here.
   On the other hand that seems to be the same with the formatting scheme changes. Hm...

##########
File path: src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
##########
@@ -86,30 +75,49 @@ public AbstractSamplerCreator() {
     /**
      * @return int request number
      */
-    protected static int getRequestNumber() {
+    public int getRequestNumber() {

Review comment:
       I guess the static comes from the fact, that the result does not depend on the instance,
but rather the class.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message