private ParameterizedCommand<String> wrapWithSaveInProgressEvent( final Path path, final ParameterizedCommand<String> command) { return parameter -> { command.execute(parameter); saveInProgressEvent.fire(new SaveInProgressEvent(path)); }; }
void onSaveInProgress(@Observes SaveInProgressEvent evt) { if (lockTarget != null && evt.getPath().equals(lockTarget.getPath())) { releaseLock(); } }
private ParameterizedCommand<String> wrapWithSaveInProgressEvent( final Path path, final ParameterizedCommand<String> command) { return parameter -> { command.execute(parameter); saveInProgressEvent.fire(new SaveInProgressEvent(path)); }; }
void saveDocumentGraphEntries() { final Set<GuidedDecisionTableView.Presenter> allDecisionTables = new HashSet<>(modeller.getAvailableDecisionTables()); savePopUpPresenter.show(editorPath, (commitMessage) -> { editorView.showSaving(); saveGraphLatch = new SaveGraphLatch(allDecisionTables.size(), commitMessage); if (allDecisionTables.isEmpty()) { saveGraphLatch.saveDocumentGraph(); } else { allDecisionTables.stream().forEach((dtPresenter) -> { saveGraphLatch.saveDocumentGraphEntry(dtPresenter); saveInProgressEvent.fire(new SaveInProgressEvent(dtPresenter.getLatestPath())); }); } }); }
void saveDocumentGraphEntries() { final Set<GuidedDecisionTableView.Presenter> allDecisionTables = new HashSet<>(modeller.getAvailableDecisionTables()); savePopUpPresenter.show(editorPath, (commitMessage) -> { editorView.showSaving(); saveGraphLatch = new SaveGraphLatch(allDecisionTables.size(), commitMessage); if (allDecisionTables.isEmpty()) { saveGraphLatch.saveDocumentGraph(); } else { allDecisionTables.stream().forEach((dtPresenter) -> { saveGraphLatch.saveDocumentGraphEntry(dtPresenter); saveInProgressEvent.fire(new SaveInProgressEvent(dtPresenter.getLatestPath())); }); } }); }
@Test public void testShowWithAPathThatIsNotVersioned() throws Exception { presenter.show(path, command); verifyNoMoreInteractions(view); verify(command).execute(""); verify(saveInProgressEvent).fire(new SaveInProgressEvent(any(Path.class))); }
@Test public void testShowWithAPathThatIsNotVersioned() throws Exception { presenter.show(path, command); verifyNoMoreInteractions(view); verify(command).execute(""); verify(saveInProgressEvent).fire(new SaveInProgressEvent(any(Path.class))); }
@Test public void releaseLockOnSave() { lockManager.acquireLockOnDemand(); simulateLockSuccess(); simulateLockDemand(); lockManager.onSaveInProgress(new SaveInProgressEvent(path)); verify(lockService, times(1)).releaseLock(any(Path.class), any(ParameterizedCommand.class)); }
@Test public void releaseLockOnSave() { lockManager.acquireLockOnDemand(); simulateLockSuccess(); simulateLockDemand(); lockManager.onSaveInProgress(new SaveInProgressEvent(path)); verify(lockService, times(1)).releaseLock(any(Path.class), any(ParameterizedCommand.class)); }