[jmeter] branch master updated: Correct typo

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new 4757204  Correct typo
4757204 is described below

commit 475720408778cdaeec8f072ccf7d50a46f26a773
Author: Felix Schumacher 
AuthorDate: Sun Aug 29 19:25:33 2021 +0200

Correct typo
---
 xdocs/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index f035e5a..d9aca2d 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -241,7 +241,7 @@ Summary
   Silence warnings of missing font Arial on startup under linux
   65300IllegalAccessError when opening file dialog with Java 
16
   65336Blank labels when different elements had the same 
name
-  65522Restart doesn't work, when parameters cotain spaces
+  65522Restart doesn't work, when parameters contain spaces
 
 
  


[jmeter] branch master updated: Add a bit of markup to changes.xml to trigger CI

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new 860eab6  Add a bit of markup to changes.xml to trigger CI
860eab6 is described below

commit 860eab6100dd676056a68093c1ea3c6fde56a379
Author: Felix Schumacher 
AuthorDate: Sun Aug 29 17:57:31 2021 +0200

Add a bit of markup to changes.xml to trigger CI
---
 xdocs/changes.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 415b972..f035e5a 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -231,13 +231,13 @@ Summary
 
   64318DNS Cache Manager - custom DNS resolver does not use 
system resolver by default
   641Updated xercesImpl to 2.12.1 (from 2.12.0). Based on patch 
by Stefan Seide (stefan at trilobyte-se.de).
-  645Add escaping for new lines in AbstractInfluxdbMetricsSender. 
Contributed by David Getzlaff (david.getzlaff at t-systems.com>)
+  645Add escaping for new lines in 
AbstractInfluxdbMetricsSender. Contributed by David Getzlaff 
(david.getzlaff at t-systems.com>)
   65198Can't copy generated function from FunctionHelper
   Updated Apache Tika to 1.26 (from 1.24.1)
   658Improve javadoc. Contributed by Ori Marko (orimarko at 
gmail.com)
   661Fix wording in doc. Contributed by BugKing (wangzhen at 
fit2cloud.com)
   664Allow whitespace in path. Contributed by Till Neunast 
(github.com/tilln)
-  65270POST application/x-www-form-urlencoded cURL code 
generated from Postman is not imported correctly
+  65270POST application/x-www-form-urlencoded cURL 
code generated from Postman is not imported correctly
   Silence warnings of missing font Arial on startup under linux
   65300IllegalAccessError when opening file dialog with Java 
16
   65336Blank labels when different elements had the same 
name


[jmeter] branch master updated: Restart does not work when parameters contain spaces

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new b9cbab8  Restart does not work when parameters contain spaces
b9cbab8 is described below

commit b9cbab843b13f1d4c61e93ce4b87bff3ef995b66
Author: Felix Schumacher 
AuthorDate: Sun Aug 29 17:19:00 2021 +0200

Restart does not work when parameters contain spaces

Try to re-combine the parameters to regard spaces in file names

Java command line has no knowledge of the 'real' parameters and
we have to do a bit of guessing to re-assemble the parameters with
spaces and the drop the spaces, that should split the parameters.

So we guess, that each parameter starts with a dash (-) and
everything else are values, that should be stitched together.

Bugzilla Id: 65522
---
 .../java/org/apache/jmeter/gui/action/Restart.java | 70 +-
 xdocs/changes.xml  |  1 +
 2 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/gui/action/Restart.java 
b/src/core/src/main/java/org/apache/jmeter/gui/action/Restart.java
index d99bf72..2b49b69 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/action/Restart.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/action/Restart.java
@@ -22,6 +22,7 @@ import java.awt.event.KeyEvent;
 import java.io.File;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -100,6 +101,7 @@ public class Restart extends 
AbstractActionWithNoRunningTest implements MenuCrea
  */
 public static void restartApplication(Runnable runBeforeRestart) {
 String javaCommand = System.getProperty(SUN_JAVA_COMMAND);
+List processArgs = new ArrayList<>();
 if(StringUtils.isEmpty(javaCommand)) {
 
JOptionPane.showMessageDialog(GuiPackage.getInstance().getMainFrame(),
 JMeterUtils.getResString("restart_error")+":\n This 
command is only supported on Open JDK or Oracle JDK" ,  //$NON-NLS-1$  
//$NON-NLS-2$
@@ -107,46 +109,43 @@ public class Restart extends 
AbstractActionWithNoRunningTest implements MenuCrea
 return;
 }
 // java binary
-String java = System.getProperty("java.home") + "/bin/java";
+processArgs.add(System.getProperty("java.home") + "/bin/java");
 // vm arguments
 List vmArguments = 
ManagementFactory.getRuntimeMXBean().getInputArguments();
-StringBuilder vmArgsOneLine = new StringBuilder();
 for (String arg : vmArguments) {
 // if it's the agent argument : we ignore it otherwise the
 // address of the old application and the new one will be in
 // conflict
 if (!arg.contains("-agentlib")) {
-vmArgsOneLine.append(arg);
-vmArgsOneLine.append(" ");
+processArgs.add(arg);
 }
 }
-// init the command to execute, add the vm args
-final StringBuilder cmd = new StringBuilder(java + " " + 
vmArgsOneLine);
 
 // program main and program arguments
 String[] mainCommand = javaCommand.split(" ");
 // program main is a jar
 if (mainCommand[0].endsWith(".jar")) {
 // if it's a jar, add -jar mainJar
-cmd.append("-jar " + new File(mainCommand[0]).getPath());
+processArgs.add("-jar");
+processArgs.add(new File(mainCommand[0]).getPath());
 } else {
 // else it's a .class, add the classpath and mainClass
-cmd.append("-cp \"" + System.getProperty("java.class.path") + "\" 
" + mainCommand[0]);
+processArgs.add("-cp");
+processArgs.add(System.getProperty("java.class.path"));
+processArgs.add(mainCommand[0]);
 }
 // finally add program arguments
-for (int i = 1; i < mainCommand.length; i++) {
-cmd.append(" ");
-cmd.append(mainCommand[i]);
-}
+processRemainingArgs(processArgs, mainCommand);
+log.debug("Restart with {} from [{}]", processArgs, javaCommand);
 // execute the command in a shutdown hook, to be sure that all the
 // resources have been disposed before restarting the application
 Runtime.getRuntime().addShutdownHook(new Thread() {
 @Override
 public void run() {
 try {
-Runtime.getRuntime().exec(cmd.toString());
+new ProcessBuilder(processArgs).start();
 } catch (IOException e) {
-log.error("Error calling restart command {}", 
cmd.toString(), e);
+

[jmeter] branch master updated: Add debug statement for IfController to show result of expression

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new 6ecce5d  Add debug statement for IfController to show result of 
expression
6ecce5d is described below

commit 6ecce5dc889c9e6a097cf8f3c6cea84d80c5bdc7
Author: Felix Schumacher 
AuthorDate: Mon Jun 7 16:51:05 2021 +0200

Add debug statement for IfController to show result of expression
---
 src/core/src/main/java/org/apache/jmeter/control/IfController.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/core/src/main/java/org/apache/jmeter/control/IfController.java 
b/src/core/src/main/java/org/apache/jmeter/control/IfController.java
index 48e7b23..e415cec 100644
--- a/src/core/src/main/java/org/apache/jmeter/control/IfController.java
+++ b/src/core/src/main/java/org/apache/jmeter/control/IfController.java
@@ -203,6 +203,7 @@ public class IfController extends GenericController 
implements Serializable, Thr
 
 
 private static boolean evaluateExpression(String cond) {
+log.debug(">> evaluate Expression [{}] equals (ignoring case) 
'true'", cond);
 return cond.equalsIgnoreCase("true"); // $NON-NLS-1$
 }
 


[jmeter] branch master updated: JSONPathAssertion attributes are out of order

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new ee0c973  JSONPathAssertion attributes are out of order
ee0c973 is described below

commit ee0c973bffcdce9832a3437614fab0e59ab222c4
Author: Felix Schumacher 
AuthorDate: Tue May 11 18:20:13 2021 +0200

JSONPathAssertion attributes are out of order

Compare JSON objects and not their string representations.

When using our stringifier, the order of the entries in maps
is not guaranteed and can lead to wrong results.

In the old days we made no difference between a string or int
when asserting a result. Jackson JSON Parser differentiates
between 'foo' and '"foo"' (former is invalid) and '1' and '"1"'
(former is an int, latter a string).

To enable both (complex, simple and edge cases), we now have to do
more work.

Bugzilla Id: 65299
---
 .../jmeter/assertions/JSONPathAssertion.java   |  7 ++-
 .../assertions/jmespath/JMESPathAssertion.java | 11 +++-
 .../jmeter/assertions/TestJSONPathAssertion.java   | 73 +-
 .../assertions/jmespath/TestJMESPathAssertion.java |  6 +-
 xdocs/changes.xml  |  2 +
 5 files changed, 66 insertions(+), 33 deletions(-)

diff --git 
a/src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java
 
b/src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java
index 67e528e..2e135b4 100644
--- 
a/src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java
+++ 
b/src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java
@@ -20,6 +20,7 @@ package org.apache.jmeter.assertions;
 import java.io.Serializable;
 import java.text.DecimalFormat;
 import java.util.Map;
+import java.util.Objects;
 
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.AbstractTestElement;
@@ -31,6 +32,7 @@ import org.slf4j.LoggerFactory;
 
 import net.minidev.json.JSONArray;
 import net.minidev.json.JSONObject;
+import net.minidev.json.JSONValue;
 
 import com.jayway.jsonpath.JsonPath;
 
@@ -153,12 +155,13 @@ public class JSONPathAssertion extends 
AbstractTestElement implements Serializab
 }
 
 private boolean isEquals(Object subj) {
-String str = objectToString(subj);
 if (isUseRegex()) {
+String str = objectToString(subj);
 Pattern pattern = 
JMeterUtils.getPatternCache().getPattern(getExpectedValue());
 return JMeterUtils.getMatcher().matches(str, pattern);
 } else {
-return str.equals(getExpectedValue());
+Object expected = JSONValue.parse(getExpectedValue());
+return Objects.equals(expected, subj);
 }
 }
 
diff --git 
a/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/JMESPathAssertion.java
 
b/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/JMESPathAssertion.java
index 97edda7..0cf46bd 100644
--- 
a/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/JMESPathAssertion.java
+++ 
b/src/components/src/main/java/org/apache/jmeter/assertions/jmespath/JMESPathAssertion.java
@@ -18,6 +18,7 @@
 package org.apache.jmeter.assertions.jmespath;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 import org.apache.jmeter.assertions.Assertion;
 import org.apache.jmeter.assertions.AssertionResult;
@@ -179,7 +180,15 @@ public class JMESPathAssertion extends AbstractTestElement 
implements Serializab
 Pattern pattern = 
JMeterUtils.getPatternCache().getPattern(getExpectedValue());
 return JMeterUtils.getMatcher().matches(str, pattern);
 } else {
-return str.equals(getExpectedValue());
+String expectedValueString = getExpectedValue();
+// first try to match as a string value, as
+// we did in the old days
+if (str.equals(expectedValueString)) {
+return true;
+}
+// now try harder and compare it as an JSON object
+JsonNode expected = OBJECT_MAPPER.readValue(expectedValueString, 
JsonNode.class);
+return Objects.equals(expected, jsonNode);
 }
 }
 
diff --git 
a/src/components/src/test/java/org/apache/jmeter/assertions/TestJSONPathAssertion.java
 
b/src/components/src/test/java/org/apache/jmeter/assertions/TestJSONPathAssertion.java
index d879903..636a139 100644
--- 
a/src/components/src/test/java/org/apache/jmeter/assertions/TestJSONPathAssertion.java
+++ 
b/src/components/src/test/java/org/apache/jmeter/assertions/TestJSONPathAssertion.java
@@ -17,19 +17,20 @@
 
 package org.apache.jmeter.assertions;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;

[jmeter] branch master updated: Missing changes entry for Bug 65336

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new ece6161  Missing changes entry for Bug 65336
ece6161 is described below

commit ece61619ce703c71ca9b6c4b4eaee05195d6bebc
Author: Felix Schumacher 
AuthorDate: Sun Aug 29 11:04:36 2021 +0200

Missing changes entry for Bug 65336
---
 xdocs/changes.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 08f7e38..6d2a897 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -238,6 +238,7 @@ Summary
   65270POST application/x-www-form-urlencoded cURL code 
generated from Postman is not imported correctly
   Silence warnings of missing font Arial on startup under linux
   65300IllegalAccessError when opening file dialog with Java 
16
+  65336Blank labels when different elements had the same 
name
 
 
  


[jmeter] branch master updated: Don't mark enclosed properties of TestElementProperty as temporary

2021-08-29 Thread fschumacher
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
 new 3128163  Don't mark enclosed properties of TestElementProperty as 
temporary
3128163 is described below

commit 31281636281e03fc3379677b24052fe612e2e7b5
Author: Felix Schumacher 
AuthorDate: Sun Jun 6 13:22:37 2021 +0200

Don't mark enclosed properties of TestElementProperty as temporary

The inner properties of a MultiProperty are marked as temporary by
the AbstractTestElement setTemporary implementation. This is needed,
since the MultiProperty default implementation of mergeIn is recursive
on MultiProperties. The TestElementProperty does not implement this
method recursively and therefore must not have marked the enclosed
properties as temporary.

Bugzilla Id: 65336
---
 .../jmeter/testelement/AbstractTestElement.java| 10 ++-
 .../testelement/AbstractTestElementSpec.groovy | 99 ++
 2 files changed, 108 insertions(+), 1 deletion(-)

diff --git 
a/src/core/src/main/java/org/apache/jmeter/testelement/AbstractTestElement.java 
b/src/core/src/main/java/org/apache/jmeter/testelement/AbstractTestElement.java
index 94364f2..93f8369 100644
--- 
a/src/core/src/main/java/org/apache/jmeter/testelement/AbstractTestElement.java
+++ 
b/src/core/src/main/java/org/apache/jmeter/testelement/AbstractTestElement.java
@@ -546,13 +546,21 @@ public abstract class AbstractTestElement implements 
TestElement, Serializable,
 temporaryProperties = new LinkedHashSet<>();
 }
 temporaryProperties.add(property);
-if (property instanceof MultiProperty) {
+if (isMergingEnclosedProperties(property)) {
 for (JMeterProperty jMeterProperty : (MultiProperty) property) {
 setTemporary(jMeterProperty);
 }
 }
 }
 
+// While TestElementProperty is implementing MultiProperty, it works 
differently.
+// It doesn't merge the inner properties one by one as MultiProperty would 
do.
+// Therefore we must not mark the enclosed properties of 
TestElementProperty as
+// temporary (Bug 65336)
+private boolean isMergingEnclosedProperties(JMeterProperty property) {
+return property instanceof MultiProperty && !(property instanceof 
TestElementProperty);
+}
+
 /**
  * @return Returns the threadContext.
  */
diff --git 
a/src/core/src/test/groovy/org/apache/jmeter/testelement/AbstractTestElementSpec.groovy
 
b/src/core/src/test/groovy/org/apache/jmeter/testelement/AbstractTestElementSpec.groovy
new file mode 100644
index 000..c258cc3
--- /dev/null
+++ 
b/src/core/src/test/groovy/org/apache/jmeter/testelement/AbstractTestElementSpec.groovy
@@ -0,0 +1,99 @@
+/*
+ * 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.testelement
+
+import org.apache.jmeter.junit.spock.JMeterSpec
+import org.apache.jmeter.testelement.property.JMeterProperty
+import org.apache.jmeter.testelement.property.MultiProperty
+import org.apache.jmeter.testelement.property.PropertyIterator
+import org.apache.jmeter.testelement.property.TestElementProperty
+
+import spock.lang.Unroll
+import sun.reflect.generics.reflectiveObjects.NotImplementedException
+
+@Unroll
+class AbstractTestElementSpec extends JMeterSpec {
+
+def "set outer properties as temporary when using a TestElementProperty"() 
{
+given:
+AbstractTestElement sut = Spy(AbstractTestElement.class)
+def outerElement = Mock(TestElement.class)
+def innerElement = Mock(TestElement.class)
+def outerProp = new TestElementProperty("outerProp", outerElement)
+def innerProp = new TestElementProperty("innerProp", innerElement)
+outerProp.addProperty(innerProp)
+when:
+sut.setTemporary(outerProp)
+then:
+sut.isTemporary(outerProp)
+!sut.isTemporary(innerProp)
+}
+
+def "set all properties as temporary when using a MultiProperty"() {
+given:
+