branch develop updated (5bc154c -> b333168)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git from 5bc154c Fix test failing on windows new 075995c fixes #1357: Empty time must not be add to file new b333168 Update libs The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit b33316881b9b2839d4c2b9f6140b405f5b0027ca Author: CHRE <CHATELLIER@codelutin.com> Date: Thu May 26 15:56:41 2016 +0200 Update libs commit 075995cfa72e39dda76f0cc94a3c7c7bc137100d Author: CHRE <CHATELLIER@codelutin.com> Date: Thu May 26 13:07:23 2016 +0200 fixes #1357: Empty time must not be add to file Summary of changes: pom.xml | 8 +-- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 23 ++++--- .../jtimer/io/GTimerIncrementalSaverTest.java | 80 ++++++++++++++++++++-- src/test/resources/testdata/0.task | 1 + 4 files changed, 90 insertions(+), 22 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit 075995cfa72e39dda76f0cc94a3c7c7bc137100d Author: CHRE <CHATELLIER@codelutin.com> Date: Thu May 26 13:07:23 2016 +0200 fixes #1357: Empty time must not be add to file --- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 23 ++++--- .../jtimer/io/GTimerIncrementalSaverTest.java | 80 ++++++++++++++++++++-- src/test/resources/testdata/0.task | 1 + 3 files changed, 86 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index 7d57ad5..0871e41 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -487,8 +487,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, // log if (log.isDebugEnabled()) { - log.debug("Load task (" + taskFile.getName() + ") : " - + gtimerTaskName); + log.debug("Load task (" + taskFile.getName() + ") : " + gtimerTaskName); } // analyse des donnees (temps) @@ -501,11 +500,13 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, try { Date keyDate = GTimerTimeUtil.yyyyMMdd2Date(sKey); String timeString = (String) prop.get(sKey); - t.setTime(keyDate, Long.valueOf(timeString) * 1000); + Long time = Long.valueOf(timeString) * 1000; + if (time > 0) { + t.setTime(keyDate, time); + } } catch (NumberFormatException e) { if (log.isErrorEnabled()) { - log.error("Can't convert " + prop.get(sKey) - + " into long"); + log.error("Can't convert " + prop.get(sKey) + " into long"); } } } @@ -531,14 +532,12 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, taskToManage.put(t, associatedProject); if (log.isDebugEnabled()) { - log.debug("Put " + t.getName() + ", " - + associatedProject.getName()); + log.debug("Put " + t.getName() + ", " + associatedProject.getName()); } } else { if (log.isWarnEnabled()) { log.warn("File " + taskFile + ": task " + t.getName() - + " is associated with a wrong project number " - + prop.get("Project")); + + " is associated with a wrong project number " + prop.get("Project")); } } @@ -1015,8 +1014,10 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, Date date = entry.getKey(); long value = entry.getValue() / 1000; - String gtimerDate = GTimerTimeUtil.date2yyyyMMdd(date); - out.write(gtimerDate + " " + value + "\n"); + if (value > 0) { + String gtimerDate = GTimerTimeUtil.date2yyyyMMdd(date); + out.write(gtimerDate + " " + value + "\n"); + } } deleteBackupFile(backupfile); diff --git a/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java b/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java index 3a153a6..9aaafc3 100644 --- a/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java +++ b/src/test/java/org/chorem/jtimer/io/GTimerIncrementalSaverTest.java @@ -24,14 +24,9 @@ package org.chorem.jtimer.io; import java.io.File; import java.io.IOException; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; +import java.util.*; +import org.apache.commons.io.FileUtils; import org.chorem.jtimer.AbstractJTimerTest; import org.chorem.jtimer.entities.TimerAlert; import org.chorem.jtimer.entities.TimerProject; @@ -342,4 +337,75 @@ public class GTimerIncrementalSaverTest extends AbstractJTimerTest { } }*/ } + + /** + * Test que les lignes avec 0 ne sont pas chargées dans les fichiers de temps. + * + * @throws IOException + */ + @Test + public void dontLoadZeroTimeTest() throws IOException { + /*try { + //FIXME testSaver.lock();*/ + + GTimerIncrementalSaver gsaver = (GTimerIncrementalSaver) testSaver; + + // task to get annotation + Collection<TimerProject> projects = gsaver.load(); + + TimerTask task1 = findTask(projects, "Chorem/Add webservice"); + Assert.assertNotNull(task1); + Assert.assertEquals(task1.getAllDaysAndTimes().size(), 3); + + /*FIXME testSaver.unlock(); + } catch (DataLockingException e) { + if(log.isErrorEnabled()) { + log.error("parseAnnotations error", e); + Assert.fail(); + } + }*/ + } + + /** + * Test que les lignes avec 0 ne sont pas enregistrées dans les fichiers de temps. + * + * @throws IOException + */ + @Test + public void dontSaveZeroTimeTest() throws IOException { + /*try { + //FIXME testSaver.lock();*/ + + GTimerIncrementalSaver gsaver = (GTimerIncrementalSaver) testSaver; + + // task to get annotation + Collection<TimerProject> projects = gsaver.load(); + + TimerProject project = findProject(projects, "Chorem"); + TimerTask task = new TimerTask("test"); + task.setCreationDate(new Date()); + + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, 2016); + calendar.set(Calendar.MONTH, 5); + calendar.set(Calendar.DAY_OF_MONTH, 26); + + task.setTime(new Date(), 0L); + task.setNumber(99); + project.addTask(task); + gsaver.saveTask(task); + + String taskFileName = gsaver.dataSaveDirectory + File.separator + task.getNumber() + "." + GTimerIncrementalSaver.GTIMER_TASK_EXTENSION; + File taskFile = new File(taskFileName); + List<String> lines = FileUtils.readLines(taskFile); + Assert.assertTrue(lines.stream().noneMatch(line -> line.startsWith("2016"))); + + /*FIXME testSaver.unlock(); + } catch (DataLockingException e) { + if(log.isErrorEnabled()) { + log.error("parseAnnotations error", e); + Assert.fail(); + } + }*/ + } } diff --git a/src/test/resources/testdata/0.task b/src/test/resources/testdata/0.task index cda6545..7480c1b 100644 --- a/src/test/resources/testdata/0.task +++ b/src/test/resources/testdata/0.task @@ -7,3 +7,4 @@ Data: 20070625 579 20070626 1407 20090124 14400 +20160526 0 \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit b33316881b9b2839d4c2b9f6140b405f5b0027ca Author: CHRE <CHATELLIER@codelutin.com> Date: Thu May 26 15:56:41 2016 +0200 Update libs --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 7d8f2d2..ccf3177 100644 --- a/pom.xml +++ b/pom.xml @@ -219,7 +219,7 @@ <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-config</artifactId> - <version>3.0-rc-3</version> + <version>3.0-rc-4</version> <scope>compile</scope> <exclusions> <exclusion> @@ -308,7 +308,7 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.4</version> + <version>2.5</version> </dependency> <!-- tests dependencies --> @@ -316,7 +316,7 @@ <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> - <version>6.9.10</version> + <version>6.9.11</version> <scope>test</scope> <exclusions> <exclusion> @@ -354,7 +354,7 @@ <plugin> <groupId>com.akathist.maven.plugins.launch4j</groupId> <artifactId>launch4j-maven-plugin</artifactId> - <version>1.7.8</version> + <version>1.7.10</version> <executions> <execution> <id>launch4j</id> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm