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

markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 43a964e  Change calculation of new file times to avoid Travis failures
43a964e is described below

commit 43a964eeed265af60c97a718c7bf7a51968f0cca
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Aug 18 16:45:16 2020 +0100

    Change calculation of new file times to avoid Travis failures
    
    Sometimes deployment would take ~8s on Travis. Using a new modification
    time of current time - 10 seconds meant the new time was within 1s of
    the old time and, therefore, not seen as different by Tomcat.
---
 .../startup/TestHostConfigAutomaticDeployment.java | 30 ++++++++++------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git 
a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java 
b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
index 319636b..dd4b181 100644
--- a/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
+++ b/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
@@ -1097,6 +1097,8 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
         File war = null;
         File dir = null;
 
+        long testStartTime = System.currentTimeMillis();
+
         if (startXml && !startExternalWar && !startExternalDir) {
             xml = createXmlInConfigBaseForAppbase();
         }
@@ -1130,40 +1132,36 @@ public class TestHostConfigAutomaticDeployment extends 
TomcatBaseTest {
                 if (xml == null) {
                     Assert.fail();
                 } else {
-                    xml.setLastModified(System.currentTimeMillis() -
-                            10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS);
+                    Assert.assertTrue("Failed to set last modified for [" + 
xml + "]. " +
+                            "This is expected (due to a JVM bug) with Java 6 
on Windows.", xml.setLastModified(
+                            testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
                 }
                 break;
             case EXT:
                 if (ext == null) {
                     Assert.fail();
                 } else {
-                    if (!ext.setLastModified(System.currentTimeMillis() -
-                            10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS)){
-                        Assert.fail("Failed to set last modified time for " +
-                                "external WAR file. This is expected (due to " 
+
-                                "a JVM bug) with Java 6 on Windows.");
-                    }
+                    Assert.assertTrue("Failed to set last modified for [" + 
ext + "]. " +
+                            "This is expected (due to a JVM bug) with Java 6 
on Windows.", ext.setLastModified(
+                            testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
                 }
                 break;
             case WAR:
                 if (war == null) {
                     Assert.fail();
                 } else {
-                    if (!war.setLastModified(System.currentTimeMillis() -
-                            10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS)) {
-                        Assert.fail("Failed to set last modified time for WAR 
" +
-                                "file. This is expected (due to a JVM bug) " +
-                                "with Java 6 on Windows.");
-                    }
+                    Assert.assertTrue("Failed to set last modified for [" + 
war + "]. " +
+                            "This is expected (due to a JVM bug) with Java 6 
on Windows.", war.setLastModified(
+                            testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
                 }
                 break;
             case DIR:
                 if (dir == null) {
                     Assert.fail();
                 } else {
-                    dir.setLastModified(System.currentTimeMillis() -
-                            10 * HostConfig.FILE_MODIFICATION_RESOLUTION_MS);
+                    Assert.assertTrue("Failed to set last modified for [" + 
dir + "]. " +
+                            "This is expected (due to a JVM bug) with Java 6 
on Windows.", dir.setLastModified(
+                            testStartTime - 10 * 
HostConfig.FILE_MODIFICATION_RESOLUTION_MS));
                 }
                 break;
             default:


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to