You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2021/12/16 13:49:20 UTC

[freemarker] branch FREEMARKER-35 updated (c915e2e -> beee059)

This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a change to branch FREEMARKER-35
in repository https://gitbox.apache.org/repos/asf/freemarker.git.


    from c915e2e  [FREEMARKER-35] Fixed: Added automatic adjustment of the format style for OffsetTime, if the time zone has DST, and the style doesn't show the offset.
     new 05e5786  [FREEMARKER-35] JavaDoc error fixes
     new beee059  Print JUnit test failure details to console when building on Travis CI

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.xml                                          | 26 +++++++++++++++++++---
 src/main/java/freemarker/core/Configurable.java    | 15 +++----------
 .../core/TemplateTemporalFormatFactory.java        |  4 ++--
 .../freemarker/ext/beans/ErrorMessagesTest.java    |  1 -
 .../{logback-test.xml => logback-test-ci.xml}      | 19 ++++++++--------
 5 files changed, 37 insertions(+), 28 deletions(-)
 copy src/test/resources/{logback-test.xml => logback-test-ci.xml} (62%)

[freemarker] 01/02: [FREEMARKER-35] JavaDoc error fixes

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch FREEMARKER-35
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit 05e578604666c72fdea2f95a59119d9081bbfcea
Author: ddekany <dd...@apache.org>
AuthorDate: Thu Dec 16 14:18:03 2021 +0100

    [FREEMARKER-35] JavaDoc error fixes
---
 src/main/java/freemarker/core/Configurable.java           | 15 +++------------
 .../freemarker/core/TemplateTemporalFormatFactory.java    |  4 ++--
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 385ee87..938d318 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -1326,7 +1326,7 @@ public class Configurable {
      *
      * <p>If temporal support is enabled (see {@link Configuration#setIncompatibleImprovements(Version)} at 2.3.32, and
      * {@link DefaultObjectWrapperBuilder#setTemporalSupport(boolean)}) this is also used for these {@link Temporal}
-     * classes: {@link Instance}, {@link LocalDateTime}, {@link OffsetDateTime}, {@link ZonedDateTime}.
+     * classes: {@link Instant}, {@link LocalDateTime}, {@link OffsetDateTime}, {@link ZonedDateTime}.
      * For non-{@code Local} {@link Temporal}-s FreeMarker will detect if the format doesn't show the offset or zone (as
      * is typically the case for the {@code "medium"} format), and then before formatting it will convert the value to
      * the time zone specified in the {@link #setTimeZone(TimeZone) timeZone} setting of FreeMarker, or when parsing
@@ -1361,7 +1361,7 @@ public class Configurable {
      * <p>Defaults to {@code "iso"}, which will simply show the year like {@code "2021"} (without the quotation marks).
      *
      * @param yearFormat
-     *     See the similar parameter of {@link #setZonedDateTimeFormat(String)},
+     *     See the similar parameter of {@link #setDateTimeFormat(String)},
      *     {@code iso}/{@code xs} only the year is shown.
      *     Java (as of version 8) doesn't support "styles" (like "short", "medium", etc.) for this.
      *
@@ -1395,7 +1395,7 @@ public class Configurable {
      * <p>Defaults to {@code "iso"}, which will show the value like {@code "2021-12"} (without the quotation marks).
      *
      * @param yearMonthFormat
-     *     See the similar parameter of {@link #setZonedDateTimeFormat(String)};
+     *     See the similar parameter of {@link #setDateTimeFormat(String)};
      *     {@code iso}/{@code xs} will look like {@code 2021-12}.
      *     Java (as of version 8) doesn't support "styles" (like "short", "medium", etc.) for this.
      *
@@ -2543,15 +2543,6 @@ public class Configurable {
      *   <li><p>{@code "date_format", "time_format", "datetime_format"}:
      *       See {@link #setDateFormat(String)}, {@link #setTimeFormat(String)}, {@link #setDateTimeFormat(String)}.
      *
-     *   <li><p>{@code "local_date_format", "local_time_format", "local_datetime_format"}:
-     *       See {@link #setLocalDateFormat(String)}, {@link #setLocalTimeFormat(String)}, {@link #setLocalDateTimeFormat(String)}.
-     *
-     *   <li><p>{@code "offset_time_format", "offset_datetime_format"}:
-     *       See {@link #setOffsetTimeFormat(String)}, {@link #setOffsetDateTimeFormat(String)}.
-     *
-     *   <li><p>{@code "zoned_date_time_format"}:
-     *       See {@link #setZonedDateTimeFormat(String)}.
-     *
      *   <li><p>{@code "year_format"}:
      *       See {@link #setYearFormat(String)}.
      *
diff --git a/src/main/java/freemarker/core/TemplateTemporalFormatFactory.java b/src/main/java/freemarker/core/TemplateTemporalFormatFactory.java
index 5ab995b..e6cc58f 100644
--- a/src/main/java/freemarker/core/TemplateTemporalFormatFactory.java
+++ b/src/main/java/freemarker/core/TemplateTemporalFormatFactory.java
@@ -46,9 +46,9 @@ public abstract class TemplateTemporalFormatFactory extends TemplateValueFormatF
      * 
      * @param params
      *            The string that further describes how the format should look. For example, when the
-     *            {@link Configurable#getInstantFormat() instantFormat} is {@code "@fooBar 1, 2"}, then it will be
+     *            {@link Configurable#getDateTimeFormat() dateTimeFormat} is {@code "@fooBar 1, 2"}, then it will be
      *            {@code "1, 2"} (and {@code "@fooBar"} selects the factory). The format of this string is up to the
-     *            {@link TemplateTemporalFormatFactory} implementation. Not {@code null}, often an empty string.
+     *            {@link TemplateTemporalFormatFactory} implementation. Not {@code null}, but often an empty string.
      * @param temporalClass
      *            The type of the temporal. If this type is not supported, the method should throw an
      *            {@link UnformattableTemporalTypeException} exception.

[freemarker] 02/02: Print JUnit test failure details to console when building on Travis CI

Posted by dd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch FREEMARKER-35
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit beee05959b48982a9151cbe751dfca8f2ebfe527
Author: ddekany <dd...@apache.org>
AuthorDate: Thu Dec 16 14:19:59 2021 +0100

    Print JUnit test failure details to console when building on Travis CI
---
 build.xml                                          | 26 +++++++++++++++--
 .../freemarker/ext/beans/ErrorMessagesTest.java    |  1 -
 src/test/resources/logback-test-ci.xml             | 34 ++++++++++++++++++++++
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/build.xml b/build.xml
index 5f48e22..3250361 100644
--- a/build.xml
+++ b/build.xml
@@ -388,15 +388,24 @@
   <!-- Testing                                                           -->
   <!-- ================================================================= -->
 
-  <target name="test" depends="compileTest" description="Run test cases">
+  <target name="test" depends="_test, _testFailedCheck" />
+
+  <target name="_test" depends="compileTest, _setTestPropertiesIfCiMode">
     <mkdir dir="build/junit-reports" />
     <ivy:cachepath conf="run.test" pathid="ivy.dep.run.test" />
-    <junit haltonfailure="on" logfailedtests="true" fork="true" forkmode="once">
+    <junit failureproperty="testFailed" logfailedtests="true" fork="true" forkmode="once">
       <classpath>
         <pathelement path="build/test-classes" />
         <pathelement path="build/classes" />
         <path refid="ivy.dep.run.test" />
       </classpath>
+      <syspropertyset>
+        <propertyref prefix="testSystemProperties."/>
+        <mapper type="glob" from="testSystemProperties.*" to="*"/>
+      </syspropertyset>
+      <!-- Print failure details on Travis CI to the console, as we can't access the report files there:  -->
+      <formatter type="brief" usefile="false" if="ciMode" />
+      <!-- When not on Travis CI, these contain the detailed log:  -->
       <formatter type="plain" />
       <formatter type="xml" />
       <batchtest todir="build/junit-reports">
@@ -404,11 +413,21 @@
           <include name="**/*Test.java" />
           <include name="**/*TestSuite.java" />
           <exclude name="**/Abstract*.java" />
+          <exclude name="**/AdhocTest*.java" />
         </fileset>
       </batchtest>
     </junit>
   </target>
-  
+
+  <target name="_setTestPropertiesIfCiMode" if="ciMode">
+    <property name="testSystemProperties.logback.configurationFile" value="logback-test-ci.xml" />
+    <property name="testSystemProperties.logback.statusListenerClass" value="ch.qos.logback.core.status.OnConsoleStatusListener" />
+  </target>
+
+  <target name="_testFailedCheck" if="testFailed">
+    <fail message="Some tests have failed! Check build/junit-reports, or previous Ant log messages." />
+  </target>
+
   <!-- ================================================================= -->
   <!-- Generate docs                                                     -->
   <!-- ================================================================= -->
@@ -929,6 +948,7 @@ Proceed? </input>
 
   <target name="ci-setup">
     <ivy:settings file="ivysettings-ci.xml" />
+    <property name="ciMode" value="true" />
   </target>
 
   <target name="ci"
diff --git a/src/test/java/freemarker/ext/beans/ErrorMessagesTest.java b/src/test/java/freemarker/ext/beans/ErrorMessagesTest.java
index 9849b8e..5ae80b7 100644
--- a/src/test/java/freemarker/ext/beans/ErrorMessagesTest.java
+++ b/src/test/java/freemarker/ext/beans/ErrorMessagesTest.java
@@ -45,7 +45,6 @@ public class ErrorMessagesTest {
         try {
             thm.get("foo");
         } catch (TemplateModelException e) {
-            e.printStackTrace();
             final String msg = e.getMessage();
             assertThat(msg, containsString("\"foo\""));
             assertThat(msg, containsString("existing sub-variable"));
diff --git a/src/test/resources/logback-test-ci.xml b/src/test/resources/logback-test-ci.xml
new file mode 100644
index 0000000..140479d
--- /dev/null
+++ b/src/test/resources/logback-test-ci.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<configuration>
+	<!--
+	  In Continuous Integration mode the Ant junit task is configured to print the failed test details to the console,
+	  because we can't get the JUnit report on Travis CI, but see what was printed to the console. But then, for some
+	  reason, the stdout of the tests will be echoed on the console as well. Thus we have to prevent it being flooded
+	  by logs messages.
+	-->
+
+	<appender name="NOP" class="ch.qos.logback.core.helpers.NOPAppender" />
+
+	<root level="OFF">
+		<appender-ref ref="NOP" />
+	</root>
+	
+</configuration>
\ No newline at end of file