You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2018/07/15 13:20:31 UTC

svn commit: r1835969 - in /jmeter/trunk: test/src/org/apache/jmeter/functions/TestDateTimeConvertFunction.java xdocs/usermanual/functions.xml

Author: pmouawad
Date: Sun Jul 15 13:20:30 2018
New Revision: 1835969

URL: http://svn.apache.org/viewvc?rev=1835969&view=rev
Log:
Bug 62533 - Allow use epoch time as Date String value in function __dateTimeConvert
Add Test
Clarify documentation
Bugzilla Id: 62533

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestDateTimeConvertFunction.java
    jmeter/trunk/xdocs/usermanual/functions.xml

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestDateTimeConvertFunction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestDateTimeConvertFunction.java?rev=1835969&r1=1835968&r2=1835969&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestDateTimeConvertFunction.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestDateTimeConvertFunction.java Sun Jul 15 13:20:30 2018
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEqu
 
 import java.util.Collection;
 import java.util.LinkedList;
+import java.util.TimeZone;
 
 import org.apache.jmeter.engine.util.CompoundVariable;
 import org.apache.jmeter.junit.JMeterTestCase;
@@ -37,7 +38,7 @@ import org.junit.Test;
  * 
  * @since 4.0
  */
-public class TestDateTimeConvertFunction extends JMeterTestCase {
+public class TestDateTimeConvertFunction extends JMeterTestCase  {
 
     protected AbstractFunction dateConvert;
 
@@ -78,6 +79,19 @@ public class TestDateTimeConvertFunction
     }
     
     @Test
+    public void testDateTimeConvertEpochTime() throws Exception {
+        TimeZone initialTZ = TimeZone.getDefault();
+        TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+        params.add(new CompoundVariable("1526574881000"));
+        params.add(new CompoundVariable(""));
+        params.add(new CompoundVariable("dd/MM/yyyy HH:mm"));
+        dateConvert.setParameters(params);
+        String returnValue = dateConvert.execute(result, null);
+        assertEquals("17/05/2018 16:34", returnValue);
+        TimeZone.setDefault(initialTZ);
+    }
+    
+    @Test
     public void testDateConvert() throws Exception {
         params.add(new CompoundVariable("2017-01-02"));
         params.add(new CompoundVariable("yyyy-MM-dd"));

Modified: jmeter/trunk/xdocs/usermanual/functions.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/functions.xml?rev=1835969&r1=1835968&r2=1835969&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jmeter/trunk/xdocs/usermanual/functions.xml Sun Jul 15 13:20:30 2018
@@ -1653,7 +1653,7 @@ returns:
     <source>${__dateTimeConvert(01212018,MMddyyyy,dd/MM/yyyy,)}</source> returns <code>21/01/2018</code>
     </p>
     <p>
-    With epoch time value: 1526574881000, <source>${__dateTimeConvert(1526574881000,,dd/MM/yyyy HH:mm,)}</source> returns <code>17/05/2018 16:34</code>
+    With epoch time value: 1526574881000, <source>${__dateTimeConvert(1526574881000,,dd/MM/yyyy HH:mm,)}</source> returns <code>17/05/2018 16:34</code> in UTC time(-Duser.timezone=GMT)
     </p>
 </component>
 <component index="&sect-num;.5.36" name="__isPropDefined">