jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1819608 - /jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java
Date Sat, 30 Dec 2017 14:58:52 GMT
Author: pmouawad
Date: Sat Dec 30 14:58:52 2017
New Revision: 1819608

URL: http://svn.apache.org/viewvc?rev=1819608&view=rev
Log:
Bug 61938 - __timeShift tests use wrong year format
Bugzilla Id: 61938

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java?rev=1819608&r1=1819607&r2=1819608&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeShiftFunction.java Sat Dec 30
14:58:52 2017
@@ -102,7 +102,7 @@ public class TestTimeShiftFunction exten
 
     @Test
     public void testNowPlusOneDay() throws Exception {
-        Collection<CompoundVariable> params = makeParams("YYYY-MM-dd", "", "P1d", "");
+        Collection<CompoundVariable> params = makeParams("yyyy-MM-dd", "", "P1d", "");
         function.setParameters(params);
         value = function.execute(result, null);
         LocalDate tomorrow = LocalDate.now().plusDays(1);
@@ -112,7 +112,7 @@ public class TestTimeShiftFunction exten
     
     @Test
     public void testNowWithComplexPeriod() throws Exception {
-        Collection<CompoundVariable> params = makeParams("YYYY-MM-dd'T'HH:mm:ss", "",
"P10DT-1H-5M5S", "");
+        Collection<CompoundVariable> params = makeParams("yyyy-MM-dd'T'HH:mm:ss", "",
"P10DT-1H-5M5S", "");
         function.setParameters(params);
         value = function.execute(result, null);
         LocalDateTime futureDate = LocalDateTime.now().plusDays(10).plusHours(-1).plusMinutes(-5).plusSeconds(5);
@@ -121,15 +121,15 @@ public class TestTimeShiftFunction exten
     }
     
     @Test
-    @Ignore
     public void testPotentialBugWithComplexPeriod() throws Exception {
-        Collection<CompoundVariable> params = makeParams("YYYY-MM-dd'T'HH:mm:ss", "2017-12-21
12:00", "P10DT-1H-5M5S", "");
+        Collection<CompoundVariable> params = makeParams("yyyy-MM-dd'T'HH:mm:ss", "2017-12-21T12:00:00",
"P10DT-1H-5M5S", "");
         function.setParameters(params);
         value = function.execute(result, null);
-        DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
-        LocalDateTime baseDate = LocalDateTime.parse("2017-12-21 12:00", dateFormat);
-        LocalDateTime futureDate = baseDate.plusDays(10).plusHours(-1).plusMinutes(-5).plusSeconds(5);
         LocalDateTime futureDateFromFunction = LocalDateTime.parse(value);
+        
+        DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd' 'HH:mm:ss");
+        LocalDateTime baseDate = LocalDateTime.parse("2017-12-21 12:00:00", dateFormat);
+        LocalDateTime futureDate = baseDate.plusDays(10).plusHours(-1).plusMinutes(-5).plusSeconds(5);
         assertThat(futureDateFromFunction, within(1, ChronoUnit.SECONDS, futureDate));
     }
 
@@ -162,7 +162,7 @@ public class TestTimeShiftFunction exten
         Random r = new Random();
         int randomInt = r.ints(1, 60).limit(1).findFirst().getAsInt();
         vars.put("random", String.valueOf( randomInt ) );
-        Collection<CompoundVariable> params = makeParams("YYYY-MM-dd'T'HH:mm:ss", "",
"PT${random}M", "");
+        Collection<CompoundVariable> params = makeParams("yyyy-MM-dd'T'HH:mm:ss", "",
"PT${random}M", "");
         function.setParameters(params);
         value = function.execute(result, null);
         LocalDateTime randomFutureDate = LocalDateTime.parse(value);
@@ -180,19 +180,19 @@ public class TestTimeShiftFunction exten
     
     @Test
     public void testNowPlusOneDayWithLocale() throws Exception {
-        Collection<CompoundVariable> params = makeParams("YYYY-MMMM-dd", "2017-juillet-01",
"P1D", "fr_FR", "");
+        Collection<CompoundVariable> params = makeParams("yyyy-MMMM-dd", "2017-juillet-01",
"P1D", "fr_FR", "");
         function.setParameters(params);
         value = function.execute(result, null);
         assertThat(value, is(equalTo("2017-juillet-02")));
-        params = makeParams("YYYY-MMMM-dd", "2017-July-01", "P1D", "en_EN", "");
+        params = makeParams("yyyy-MMMM-dd", "2017-July-01", "P1D", "en_EN", "");
         function.setParameters(params);
         value = function.execute(result, null);
         assertThat(value, is(equalTo("2017-July-02")));
-        params = makeParams("YYYY-MMMM-dd", "2017-julio-01", "P1D", "es_ES", "");
+        params = makeParams("yyyy-MMMM-dd", "2017-julio-01", "P1D", "es_ES", "");
         function.setParameters(params);
         value = function.execute(result, null);
         assertThat(value, is(equalTo("2017-julio-02")));
-        params = makeParams("YYYY-MMMM-dd", "2017-Juli-01", "P1D", "de_DE", "");
+        params = makeParams("yyyy-MMMM-dd", "2017-Juli-01", "P1D", "de_DE", "");
         function.setParameters(params);
         value = function.execute(result, null);
         assertThat(value, is(equalTo("2017-Juli-02")));



Mime
View raw message