You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by mc...@apache.org on 2017/07/25 07:59:29 UTC

svn commit: r1802896 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java

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


Re: svn commit: r1802896 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java

Posted by Philippe Mouawad <ph...@gmail.com>.
Thanks !

On Tue, Jul 25, 2017 at 11:43 AM, Maxime Chassagneux <
maxime.chassagneux@gmail.com> wrote:

> Hi Philippe,
>
> It's done :)
>
> Regards
>
> 2017-07-25 10:09 GMT+02:00 Philippe Mouawad <ph...@gmail.com>:
>
> > Hi Maxime,
> > Is it possible to add JUnits ?
> >
> > Thanks
> >
> > On Tue, Jul 25, 2017 at 9:59 AM, <mc...@apache.org> wrote:
> >
> > > 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
> > >
> > >
> > >
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
> >
>



-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1802896 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java

Posted by Maxime Chassagneux <ma...@gmail.com>.
Hi Philippe,

It's done :)

Regards

2017-07-25 10:09 GMT+02:00 Philippe Mouawad <ph...@gmail.com>:

> Hi Maxime,
> Is it possible to add JUnits ?
>
> Thanks
>
> On Tue, Jul 25, 2017 at 9:59 AM, <mc...@apache.org> wrote:
>
> > 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
> >
> >
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
>

Re: svn commit: r1802896 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeShift.java

Posted by Philippe Mouawad <ph...@gmail.com>.
Hi Maxime,
Is it possible to add JUnits ?

Thanks

On Tue, Jul 25, 2017 at 9:59 AM, <mc...@apache.org> wrote:

> 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
>
>
>


-- 
Cordialement.
Philippe Mouawad.