db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Vandahl (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TORQUE-351) Torque-Generator, runOnlyOnSourceChange
Date Sun, 26 Aug 2018 15:00:00 GMT

     [ https://issues.apache.org/jira/browse/TORQUE-351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Vandahl resolved TORQUE-351.
-----------------------------------
       Resolution: Fixed
         Assignee: Thomas Vandahl
    Fix Version/s: 4.1

Fixed in SVN

> Torque-Generator, runOnlyOnSourceChange
> ---------------------------------------
>
>                 Key: TORQUE-351
>                 URL: https://issues.apache.org/jira/browse/TORQUE-351
>             Project: Torque
>          Issue Type: Bug
>          Components: Generator
>    Affects Versions: 4.1
>         Environment: Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
> ..
> Java version: 1.8.0_171, vendor: Oracle Corporation
> Java home: C:\java\jdk8x64\jre
> Default locale: de_DE, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Georg Kallidis
>            Assignee: Thomas Vandahl
>            Priority: Major
>             Fix For: 4.1
>
>
> I get an test failure in torque-generator running mvn clean test:
>  
> {code:java}
> Test set: org.apache.torque.generator.control.RunOnlyOnSourceChangeTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.14 sec <<<
FAILURE!
> testRunOnlyOnSourceChange(org.apache.torque.generator.control.RunOnlyOnSourceChangeTest)
Time elapsed: 1.14 sec <<< FAILURE!
> java.lang.AssertionError: Tue Jul 03 11:13:31 CEST 2018 not equal to Tue Jul 03 11:13:32
CEST 2018 expected:<1530609211675> but was:<1530609212737>
> at org.junit.Assert.fail(Assert.java:91)
> at org.junit.Assert.failNotEquals(Assert.java:645)
> at org.junit.Assert.assertEquals(Assert.java:126)
> at org.junit.Assert.assertEquals(Assert.java:470)
> at org.apache.torque.generator.control.RunOnlyOnSourceChangeTest.testRunOnlyOnSourceChange(RunOnlyOnSourceChangeTest.java:112)
> {code}
> It fails at this line (the first teste after initialization and the content was moved)
>  
>  
> {code:java}
> assertTrue(unchangedTargetFile1LastModified == assertFile(targetDir1, "unchangedOutput.txt",
"unchangedValue"));
> {code}
>  
> Apparently unchangedOutput.txt should not have changed the lastModified.... (I expanded
the assert to get a little more information.) The reported time difference (about 1000msec)
is due to 
> {code:java}
>  Thread.sleep(1000);
> {code}
> in the test and is apparently only there because checkSourceModified returns true (I
read TORQUE-338, this might be also still another issue), i.e. it's not the reason, why itt
fails, but a consequence of it.
> Investigating the source code I found, that, if I comment out this
>  
> {code:java}
> if (lastGenerationTime.before(sourceLastModified))
> {
> log.debug("checkSourceModified(): "
> + "lastGenerationTime was before source was modified ("
> + lastGenerationTime
> + " < "
> + sourceLastModified
> + "), return true");
> sourceModifiedCache.put(sourceChangeKey, true);
> return true;
> }
> {code}
> in 
> {noformat}
> org.apache.torque.generator.control.Controller.checkSourceModified(Source, ControllerState,
UnitConfiguration){noformat}
> which is called, if _isRunOnlyOnSourceChange_ is true for the unitConfiguration, the
failure is gone.
> The time difference there between lastGenerationTime and sourceLastModified is alwasy
below 100ms (sometimes only 25ms), and might be due to the OS environment. This might be a
windows problem? One solution might be to remove the milliseconds.
> If I replace the code with 
> {code:java}
> final GregorianCalendar gcLastGenerationTime = new GregorianCalendar();
> gcLastGenerationTime.setTime( lastGenerationTime );
> gcLastGenerationTime.set(Calendar.MILLISECOND, 0);
> final GregorianCalendar gcSourceLastModified = new GregorianCalendar();
> gcSourceLastModified.setTime( sourceLastModified );
> gcSourceLastModified.set(Calendar.MILLISECOND, 0);
> if (gcLastGenerationTime.before(gcSourceLastModified))
> {code}
> all the tests run successfully.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message