You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2017/11/19 12:00:46 UTC
svn commit: r1815728 - in /jmeter/trunk:
src/functions/org/apache/jmeter/functions/
test/src/org/apache/jmeter/functions/
Author: fschumacher
Date: Sun Nov 19 12:00:46 2017
New Revision: 1815728
URL: http://svn.apache.org/viewvc?rev=1815728&view=rev
Log:
Whitespace police
Modified:
jmeter/trunk/src/functions/org/apache/jmeter/functions/IsPropDefined.java
jmeter/trunk/src/functions/org/apache/jmeter/functions/IsVarDefined.java
jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsPropDefined.java
jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsVarDefined.java
Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/IsPropDefined.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/IsPropDefined.java?rev=1815728&r1=1815727&r2=1815728&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/IsPropDefined.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/IsPropDefined.java Sun Nov 19 12:00:46 2017
@@ -29,43 +29,47 @@ import org.apache.jmeter.util.JMeterUtil
/**
* Test if a JMeter property is defined
+ *
* @since 4.0
*/
public class IsPropDefined extends AbstractFunction {
- private static final List<String> desc = new LinkedList<>();
- private static final String KEY = "__isPropDefined";
+ private static final List<String> desc = new LinkedList<>();
+ private static final String KEY = "__isPropDefined";
- // Number of parameters expected - used to reject invalid calls
- private static final int MIN_PARAMETER_COUNT = 1;
- private static final int MAX_PARAMETER_COUNT = 1;
-
- static {
- desc.add(JMeterUtils.getResString("property_name_param"));
- }
-
- private CompoundVariable[] values;
-
- @Override
- public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException {
- String propertyName = values[0].execute();
- String propertyValue = JMeterUtils.getProperty(propertyName);
- return Boolean.toString(propertyValue != null);
- }
-
- @Override
- public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
- checkParameterCount(parameters, MIN_PARAMETER_COUNT, MAX_PARAMETER_COUNT);
- values = parameters.toArray(new CompoundVariable[parameters.size()]);
- }
-
- @Override
- public String getReferenceKey() {
- return KEY;
- }
-
- @Override
- public List<String> getArgumentDesc() {
- return desc;
- }
+ // Number of parameters expected - used to reject invalid calls
+ private static final int MIN_PARAMETER_COUNT = 1;
+ private static final int MAX_PARAMETER_COUNT = 1;
+
+ static {
+ desc.add(JMeterUtils.getResString("property_name_param"));
+ }
+
+ private CompoundVariable[] values;
+
+ @Override
+ public String execute(SampleResult previousResult, Sampler currentSampler)
+ throws InvalidVariableException {
+ String propertyName = values[0].execute();
+ String propertyValue = JMeterUtils.getProperty(propertyName);
+ return Boolean.toString(propertyValue != null);
+ }
+
+ @Override
+ public void setParameters(Collection<CompoundVariable> parameters)
+ throws InvalidVariableException {
+ checkParameterCount(parameters, MIN_PARAMETER_COUNT,
+ MAX_PARAMETER_COUNT);
+ values = parameters.toArray(new CompoundVariable[parameters.size()]);
+ }
+
+ @Override
+ public String getReferenceKey() {
+ return KEY;
+ }
+
+ @Override
+ public List<String> getArgumentDesc() {
+ return desc;
+ }
}
Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/IsVarDefined.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/IsVarDefined.java?rev=1815728&r1=1815727&r2=1815728&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/IsVarDefined.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/IsVarDefined.java Sun Nov 19 12:00:46 2017
@@ -29,43 +29,47 @@ import org.apache.jmeter.util.JMeterUtil
/**
* Test if a JMeter variable is defined
+ *
* @since 4.0
*/
public class IsVarDefined extends AbstractFunction {
- private static final List<String> desc = new LinkedList<>();
- private static final String KEY = "__isVarDefined";
- // Number of parameters expected - used to reject invalid calls
- private static final int MIN_PARAMETER_COUNT = 1;
- private static final int MAX_PARAMETER_COUNT = 1;
-
- static {
- desc.add(JMeterUtils.getResString("evalvar_name_param"));
- }
-
- private CompoundVariable[] values;
-
- @Override
- public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException {
- String variableName = values[0].execute();
- String variableValue = getVariables().get(variableName);
- return Boolean.toString(variableValue != null);
- }
-
- @Override
- public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
- checkParameterCount(parameters, MIN_PARAMETER_COUNT, MAX_PARAMETER_COUNT);
- values = parameters.toArray(new CompoundVariable[parameters.size()]);
- }
-
- @Override
- public String getReferenceKey() {
- return KEY;
- }
-
- @Override
- public List<String> getArgumentDesc() {
- return desc;
- }
+ private static final List<String> desc = new LinkedList<>();
+ private static final String KEY = "__isVarDefined";
+ // Number of parameters expected - used to reject invalid calls
+ private static final int MIN_PARAMETER_COUNT = 1;
+ private static final int MAX_PARAMETER_COUNT = 1;
+
+ static {
+ desc.add(JMeterUtils.getResString("evalvar_name_param"));
+ }
+
+ private CompoundVariable[] values;
+
+ @Override
+ public String execute(SampleResult previousResult, Sampler currentSampler)
+ throws InvalidVariableException {
+ String variableName = values[0].execute();
+ String variableValue = getVariables().get(variableName);
+ return Boolean.toString(variableValue != null);
+ }
+
+ @Override
+ public void setParameters(Collection<CompoundVariable> parameters)
+ throws InvalidVariableException {
+ checkParameterCount(parameters, MIN_PARAMETER_COUNT,
+ MAX_PARAMETER_COUNT);
+ values = parameters.toArray(new CompoundVariable[parameters.size()]);
+ }
+
+ @Override
+ public String getReferenceKey() {
+ return KEY;
+ }
+
+ @Override
+ public List<String> getArgumentDesc() {
+ return desc;
+ }
}
Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsPropDefined.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsPropDefined.java?rev=1815728&r1=1815727&r2=1815728&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsPropDefined.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsPropDefined.java Sun Nov 19 12:00:46 2017
@@ -31,6 +31,7 @@ import org.apache.jmeter.threads.JMeterC
import org.apache.jmeter.threads.JMeterVariables;
import org.junit.Before;
import org.junit.Test;
+
/**
*
* Test {@link IsPropDefined} Function
@@ -39,63 +40,63 @@ import org.junit.Test;
*
*/
public class TestIsPropDefined extends JMeterTestCase {
- protected AbstractFunction isPropDefined;
+ protected AbstractFunction isPropDefined;
- private SampleResult result;
+ private SampleResult result;
- private Collection<CompoundVariable> params;
+ private Collection<CompoundVariable> params;
- private JMeterVariables vars;
+ private JMeterVariables vars;
- private JMeterContext jmctx;
-
- @Before
- public void setUp() {
- isPropDefined = new IsPropDefined();
- result = new SampleResult();
- jmctx = JMeterContextService.getContext();
- String data = "dummy data";
- result.setResponseData(data, null);
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- params = new LinkedList<>();
- }
-
- @Test
- public void testParameterCountIsPropDefined() throws Exception {
- checkInvalidParameterCounts(isPropDefined, 1, 1);
- }
-
- @Test
- public void testIsPropDefined() throws Exception {
- params.add(new CompoundVariable("file.encoding"));
- isPropDefined.setParameters(params);
- String returnValue = isPropDefined.execute(result, null);
- assertEquals("true", returnValue);
- }
-
- @Test
- public void testIsPropNotDefined() throws Exception {
- params.add(new CompoundVariable("emptyProperty"));
- isPropDefined.setParameters(params);
- String returnValue = isPropDefined.execute(result, null);
- assertEquals("false", returnValue);
- }
-
- @Test
- public void testIsPropNotDefinedOnlyVarDefined() throws Exception {
- vars.put("emptyProperty", "emptyPropertyValue");
- params.add(new CompoundVariable("emptyProperty"));
- isPropDefined.setParameters(params);
- String returnValue = isPropDefined.execute(result, null);
- assertEquals("false", returnValue);
- }
-
- @Test(expected = InvalidVariableException.class)
- public void testIsPropDefinedError() throws Exception {
- isPropDefined.setParameters(params);
- isPropDefined.execute(result, null);
- }
+ private JMeterContext jmctx;
+
+ @Before
+ public void setUp() {
+ isPropDefined = new IsPropDefined();
+ result = new SampleResult();
+ jmctx = JMeterContextService.getContext();
+ String data = "dummy data";
+ result.setResponseData(data, null);
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ params = new LinkedList<>();
+ }
+
+ @Test
+ public void testParameterCountIsPropDefined() throws Exception {
+ checkInvalidParameterCounts(isPropDefined, 1, 1);
+ }
+
+ @Test
+ public void testIsPropDefined() throws Exception {
+ params.add(new CompoundVariable("file.encoding"));
+ isPropDefined.setParameters(params);
+ String returnValue = isPropDefined.execute(result, null);
+ assertEquals("true", returnValue);
+ }
+
+ @Test
+ public void testIsPropNotDefined() throws Exception {
+ params.add(new CompoundVariable("emptyProperty"));
+ isPropDefined.setParameters(params);
+ String returnValue = isPropDefined.execute(result, null);
+ assertEquals("false", returnValue);
+ }
+
+ @Test
+ public void testIsPropNotDefinedOnlyVarDefined() throws Exception {
+ vars.put("emptyProperty", "emptyPropertyValue");
+ params.add(new CompoundVariable("emptyProperty"));
+ isPropDefined.setParameters(params);
+ String returnValue = isPropDefined.execute(result, null);
+ assertEquals("false", returnValue);
+ }
+
+ @Test(expected = InvalidVariableException.class)
+ public void testIsPropDefinedError() throws Exception {
+ isPropDefined.setParameters(params);
+ isPropDefined.execute(result, null);
+ }
}
Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsVarDefined.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsVarDefined.java?rev=1815728&r1=1815727&r2=1815728&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsVarDefined.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestIsVarDefined.java Sun Nov 19 12:00:46 2017
@@ -31,6 +31,7 @@ import org.apache.jmeter.threads.JMeterC
import org.apache.jmeter.threads.JMeterVariables;
import org.junit.Before;
import org.junit.Test;
+
/**
*
* Test {@link IsVarDefined} Function
@@ -39,63 +40,63 @@ import org.junit.Test;
*
*/
public class TestIsVarDefined extends JMeterTestCase {
- protected AbstractFunction isVarDefined;
+ protected AbstractFunction isVarDefined;
- private SampleResult result;
+ private SampleResult result;
- private Collection<CompoundVariable> params;
+ private Collection<CompoundVariable> params;
- private JMeterVariables vars;
+ private JMeterVariables vars;
- private JMeterContext jmctx;
-
- @Before
- public void setUp() {
- isVarDefined = new IsVarDefined();
- result = new SampleResult();
- jmctx = JMeterContextService.getContext();
- String data = "dummy data";
- result.setResponseData(data, null);
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- params = new LinkedList<>();
- }
-
- @Test
- public void testParameterCountIsPropDefined() throws Exception {
- checkInvalidParameterCounts(isVarDefined, 1, 1);
- }
-
- @Test
- public void testIsVarNotDefinedOnlyPropDefined() throws Exception {
- params.add(new CompoundVariable("file.encoding"));
- isVarDefined.setParameters(params);
- String returnValue = isVarDefined.execute(result, null);
- assertEquals("false", returnValue);
- }
-
- @Test
- public void testIsVarDefined() throws Exception {
- vars.put("varName", "");
- params.add(new CompoundVariable("varName"));
- isVarDefined.setParameters(params);
- String returnValue = isVarDefined.execute(result, null);
- assertEquals("true", returnValue);
- }
-
- @Test
- public void testIsVarNotDefined() throws Exception {
- params.add(new CompoundVariable("emptyProperty"));
- isVarDefined.setParameters(params);
- String returnValue = isVarDefined.execute(result, null);
- assertEquals("false", returnValue);
- }
-
- @Test(expected = InvalidVariableException.class)
- public void testIsVarDefinedError() throws Exception {
- isVarDefined.setParameters(params);
- isVarDefined.execute(result, null);
- }
+ private JMeterContext jmctx;
+
+ @Before
+ public void setUp() {
+ isVarDefined = new IsVarDefined();
+ result = new SampleResult();
+ jmctx = JMeterContextService.getContext();
+ String data = "dummy data";
+ result.setResponseData(data, null);
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ params = new LinkedList<>();
+ }
+
+ @Test
+ public void testParameterCountIsPropDefined() throws Exception {
+ checkInvalidParameterCounts(isVarDefined, 1, 1);
+ }
+
+ @Test
+ public void testIsVarNotDefinedOnlyPropDefined() throws Exception {
+ params.add(new CompoundVariable("file.encoding"));
+ isVarDefined.setParameters(params);
+ String returnValue = isVarDefined.execute(result, null);
+ assertEquals("false", returnValue);
+ }
+
+ @Test
+ public void testIsVarDefined() throws Exception {
+ vars.put("varName", "");
+ params.add(new CompoundVariable("varName"));
+ isVarDefined.setParameters(params);
+ String returnValue = isVarDefined.execute(result, null);
+ assertEquals("true", returnValue);
+ }
+
+ @Test
+ public void testIsVarNotDefined() throws Exception {
+ params.add(new CompoundVariable("emptyProperty"));
+ isVarDefined.setParameters(params);
+ String returnValue = isVarDefined.execute(result, null);
+ assertEquals("false", returnValue);
+ }
+
+ @Test(expected = InvalidVariableException.class)
+ public void testIsVarDefinedError() throws Exception {
+ isVarDefined.setParameters(params);
+ isVarDefined.execute(result, null);
+ }
}