branch feature/sync updated (362b361 -> eec2299)
This is an automated email from the git hooks/post-receive script. New change to branch feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git from 362b361 surrounded log.debug to only generate if Debug is enabled new 4588ea2 remove milliseconds of lastSyncTime from sync save file new b03cc9a tests for addition/removal of SyncInfo in tasks new c719c22 checkbox for active sync showing up properly new eec2299 corrected a variable name The 4 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 eec2299c57ad7ec7d7201a1fc1bbf94c71792006 Author: servantie <servantie.c@gmail.com> Date: Mon Jun 27 09:48:44 2016 +0200 corrected a variable name commit c719c22ac5b23e478d21e940e759e54c367c065f Author: servantie <servantie.c@gmail.com> Date: Fri Jun 24 15:14:29 2016 +0200 checkbox for active sync showing up properly commit b03cc9aed77620f5c617745a32bc442eebfecb07 Author: servantie <servantie.c@gmail.com> Date: Thu Jun 23 18:05:35 2016 +0200 tests for addition/removal of SyncInfo in tasks commit 4588ea2d1bd3a6b9f433a20995eb939898843dc6 Author: servantie <servantie.c@gmail.com> Date: Thu Jun 23 11:42:54 2016 +0200 remove milliseconds of lastSyncTime from sync save file Summary of changes: .../java/org/chorem/jtimer/entities/TimerTask.java | 4 +-- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 9 ++--- .../chorem/jtimer/io/TimerTaskSynchronizer.java | 9 +++-- .../jtimer/ui/report/TimerTaskUpdaterView.java | 40 ++++++--------------- .../org/chorem/jtimer/entities/TimerTaskTest.java | 42 ++++++++++++++++++++++ 5 files changed, 63 insertions(+), 41 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 feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit 4588ea2d1bd3a6b9f433a20995eb939898843dc6 Author: servantie <servantie.c@gmail.com> Date: Thu Jun 23 11:42:54 2016 +0200 remove milliseconds of lastSyncTime from sync save file --- src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index 6615804..e4292c7 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -1182,10 +1182,11 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, else { out.write("false "); } - //write lastsync - //todo: remove the milliseconds + //write lastsync (HH:MM:SS) if (sync.getLastSync().isAfter(LocalDateTime.MIN)) { - out.write(sync.getLastSync().toString() + "\n"); + //remove the milliseconds + String syncString = sync.getLastSync().toString().substring(0, sync.getLastSync().toString().length()-4); + out.write(syncString + "\n"); } else { out.write("\n"); -- 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 feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit b03cc9aed77620f5c617745a32bc442eebfecb07 Author: servantie <servantie.c@gmail.com> Date: Thu Jun 23 18:05:35 2016 +0200 tests for addition/removal of SyncInfo in tasks --- .../org/chorem/jtimer/entities/TimerTaskTest.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java b/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java index 87cc0e1..6db7cb0 100644 --- a/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java +++ b/src/test/java/org/chorem/jtimer/entities/TimerTaskTest.java @@ -116,4 +116,46 @@ public class TimerTaskTest extends AbstractJTimerTest { Assert.assertEquals(task.getSubTasks().size(), 1); Assert.assertEquals(clonedTask.getSubTasks().size(), 0); } + + /** + * Test that no URL is present twice for a task + */ + @Test + public void addSyncInfoTest() { + TimerTask task = new TimerTask(); + String url1 = "localhost/test"; + String url2 = "localhost/test"; + + task.addSyncInfo(url1); + task.addSyncInfo(url2); + + Assert.assertTrue(task.getSynchronizingInfoList().size() == 1); + + String url3 = "localhost"; + task.addSyncInfo(url3); + + Assert.assertTrue(task.getSynchronizingInfoList().size() == 2); + } + + /** + * Test that removal of URL works ? + */ + @Test + public void removeSyncInfoTest() { + TimerTask task = new TimerTask(); + + String url1 = "localhost/test"; + String url2 = "localhost/other"; + + task.addSyncInfo(url1); + task.addSyncInfo(url2); + + Assert.assertTrue(task.getSynchronizingInfoList().size() == 2); + + task.removeSyncInfo(url1); + + Assert.assertTrue(task.getSynchronizingInfoList().size() == 1); + Assert.assertTrue(task.getSynchronizingURLList().contains(url2)); + + } } -- 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 feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit c719c22ac5b23e478d21e940e759e54c367c065f Author: servantie <servantie.c@gmail.com> Date: Fri Jun 24 15:14:29 2016 +0200 checkbox for active sync showing up properly --- .../java/org/chorem/jtimer/entities/TimerTask.java | 4 +-- .../chorem/jtimer/io/GTimerIncrementalSaver.java | 2 +- .../chorem/jtimer/io/TimerTaskSynchronizer.java | 3 +- .../jtimer/ui/report/TimerTaskUpdaterView.java | 40 ++++++---------------- 4 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/entities/TimerTask.java b/src/main/java/org/chorem/jtimer/entities/TimerTask.java index 070f3d0..1285a53 100644 --- a/src/main/java/org/chorem/jtimer/entities/TimerTask.java +++ b/src/main/java/org/chorem/jtimer/entities/TimerTask.java @@ -305,10 +305,8 @@ public class TimerTask implements Cloneable, * @param isActive a boolean for activity (true to sync auto) */ public void addSyncInfo(String url, LocalDateTime time, boolean isActive) { - if (!url.isEmpty()) { - if (!getSynchronizingURLList().contains(url)) { + if (!url.isEmpty() && !getSynchronizingURLList().contains(url)) { synchronisingInfoList.add(new SyncInfo(url, time, isActive)); - } } } diff --git a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java index e4292c7..1c34ef5 100644 --- a/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java +++ b/src/main/java/org/chorem/jtimer/io/GTimerIncrementalSaver.java @@ -1183,7 +1183,7 @@ public class GTimerIncrementalSaver extends AbstractSaver implements Saver, out.write("false "); } //write lastsync (HH:MM:SS) - if (sync.getLastSync().isAfter(LocalDateTime.MIN)) { + if (sync.getLastSync() != null && sync.getLastSync().isAfter(LocalDateTime.MIN)) { //remove the milliseconds String syncString = sync.getLastSync().toString().substring(0, sync.getLastSync().toString().length()-4); out.write(syncString + "\n"); diff --git a/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java b/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java index 42c83cf..050ea7c 100644 --- a/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java +++ b/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java @@ -42,7 +42,7 @@ public class TimerTaskSynchronizer implements DataEventListener { public TimerTaskSynchronizer() { timer = new Timer(); timer.schedule(new UpdateTask(), autoSyncDelay, autoSyncDelay); - log.info("Starting synchronising thread"); + log.info("Starting synchronizing thread"); tasksToSync = Collections.synchronizedCollection(new ArrayList<>()); } @@ -136,7 +136,6 @@ public class TimerTaskSynchronizer implements DataEventListener { log.debug("Sync failed on " + syncURL); } } - } } diff --git a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java index c45ada3..99612fd 100644 --- a/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java +++ b/src/main/java/org/chorem/jtimer/ui/report/TimerTaskUpdaterView.java @@ -231,8 +231,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, checkIsActiveSync.addActionListener(this); checkIsActiveSync.setAction(getContext().getActionMap(this).get("isActiveSync")); if (urlComboBox.getSelectedItem() != null) { - if (task.getSynchronizingURLList().contains(urlComboBox.getSelectedItem())){ - SyncInfo syncInfo = task.getSynchronizingInfo((String) urlComboBox.getSelectedItem()); + String selectedURL = (String) urlComboBox.getSelectedItem(); + if (task.getSynchronizingURLList().contains(selectedURL)){ + SyncInfo syncInfo = task.getSynchronizingInfo(selectedURL); LocalDateTime lastSyncTime = syncInfo.getLastSync(); //if there has been an update before, display its date if ((lastSyncTime != null) && lastSyncTime.isAfter(LocalDateTime.MIN)) { @@ -258,15 +259,11 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, panelOption.add(deleteButton, new GridBagConstraints(1, 5, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 1, 1), 0, 0)); - - - - - panelOption.add(lastUpdate, new GridBagConstraints(2, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(1, 3, 1, 1), 0, 0)); panelOption.add(checkIsActiveSync, new GridBagConstraints(1, 4, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(4, 1, 1, 1), 0, 0)); + configComponent.add(panelGeneral); configComponent.add(panelOption); @@ -402,7 +399,6 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, getApplication().hide(this); } - /** * Make update. * @@ -445,6 +441,7 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, /** * Active sync checkbox checked, activates sync + * todo: solve problem of not showing up as ticked */ @Action public boolean isActiveSync() { @@ -456,7 +453,6 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, return isActiveSyncURL; } - /** * Can update ? * @@ -604,6 +600,9 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, if (log.isDebugEnabled()) { log.debug("Selected an object : " + urlComboBox.getSelectedItem().toString()); } + if (checkIsActiveSync != null) { + checkIsActiveSync.setSelected(task.getSynchronizingInfo(urlToDisplay).getActiveSync()); + } //display last Sync Time if (lastUpdate != null && task.getSynchronizingInfo(urlToDisplay).getLastSync() != null) { if (task.getSynchronizingInfo(urlToDisplay).getLastSync().isAfter(LocalDateTime.MIN)) { @@ -618,36 +617,19 @@ public class TimerTaskUpdaterView extends FrameView implements DocumentListener, } } - @Override public void actionPerformed(ActionEvent actionEvent) { String actionCommand = actionEvent.getActionCommand(); - if (actionCommand.equals("comboBox")) { + if ("comboBox".equals(actionCommand)) { String urlToAdd = (String) urlComboBox.getSelectedItem(); if (!task.getSynchronizingURLList().contains(urlToAdd)) { if (log.isDebugEnabled()) { - log.debug("New URL detected !"); + log.debug("New URL added"); } itemAdded(); } } -// else if (actionCommand.equals("comboBoxChanged")) { -// if (log.isDebugEnabled()) { -// log.debug("There has been a change in the comboBox"); -// } -// -// } -// else if (actionCommand.equals("comboBoxEdited")) { -// if (log.isDebugEnabled()) { -// log.debug("The comboBox was edited"); -// } -// } -// else if (actionCommand.equals(getResourceMap().getString("isActiveSync.Action.text"))) { -// if (log.isDebugEnabled()) { -// log.debug("Checkbox ticked, unticked"); -// } -// } - else if (actionCommand.equals("deleteURL")) { + else if ("deleteURL".equals(actionCommand)) { String urlToUse = (String) urlComboBox.getSelectedItem(); //if the delete button has been clicked, delete the task (if it exists) if ((urlToUse != null) && !urlToUse.isEmpty() && (task.getSynchronizingURLList().contains(urlToUse))) { -- 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 feature/sync in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit eec2299c57ad7ec7d7201a1fc1bbf94c71792006 Author: servantie <servantie.c@gmail.com> Date: Mon Jun 27 09:48:44 2016 +0200 corrected a variable name --- src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java b/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java index 050ea7c..45eb6bb 100644 --- a/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java +++ b/src/main/java/org/chorem/jtimer/io/TimerTaskSynchronizer.java @@ -112,13 +112,13 @@ public class TimerTaskSynchronizer implements DataEventListener { List<JsonObject> jsonObjectList = TimerTaskHelper.taskToJSONFormat(task, false, timezone); for (JsonObject object : jsonObjectList) { - int SyncResult = synchronizeTaskOnURL(object); + int syncResult = synchronizeTaskOnURL(object); boolean successfulSync = false; String syncURL = object.get("URL").getAsString(); - if (SyncResult > 199 && SyncResult < 300) { + if (syncResult > 199 && syncResult < 300) { successfulSync = true; } - else if (SyncResult == 0) { + else if (syncResult == 0) { if (log.isDebugEnabled()) { log.debug("Error in connection " + syncURL); } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm