Author: mchassagneux
Date: Tue Jul 25 07:59:29 2017
New Revision: 1802896
URL: http://svn.apache.org/viewvc?rev=1802896&view=rev
Log:
make date & period variable on each execution
Bugzilla Id: 61335
Modified:
jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java
Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java?rev=1802896&r1=1802895&r2=1802896&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java
(original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java Tue
Jul 25 07:59:29 2017
@@ -71,8 +71,8 @@ public class TimeShift extends AbstractF
// Ensure that these are set, even if no paramters are provided
private String format = ""; //$NON-NLS-1$
- private String dateToShift = ""; //$NON-NLS-1$
- private String amountToShift = ""; //$NON-NLS-1$
+ private CompoundVariable dateToShiftCompound; //$NON-NLS-1$
+ private CompoundVariable amountToShiftCompound; //$NON-NLS-1$
private String variableName = ""; //$NON-NLS-1$
private ZoneId systemDefaultZoneID = ZoneId.systemDefault();
@@ -87,6 +87,8 @@ public class TimeShift extends AbstractF
@Override
public String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {
String dateString;
+ String amountToShift = amountToShiftCompound.execute().trim();
+ String dateToShift = dateToShiftCompound.execute().trim();
LocalDateTime localDateTimeToShift =
LocalDateTime.now(systemDefaultZoneID);
DateTimeFormatter formatter = null;
if (!StringUtils.isEmpty(format)) {
@@ -161,8 +163,8 @@ public class TimeShift extends AbstractF
Object[] values = parameters.toArray();
format = ((CompoundVariable) values[0]).execute().trim();
- dateToShift = ((CompoundVariable) values[1]).execute().trim();
- amountToShift = ((CompoundVariable) values[2]).execute().trim();
+ dateToShiftCompound = (CompoundVariable) values[1];
+ amountToShiftCompound = (CompoundVariable) values[2];
variableName = ((CompoundVariable) values[3]).execute().trim();
// Create the cache