@Test public void testRenameNotification() { renamePopUpPresenterShowMock(); when(renamePopUpPresenterMock.getView()).thenReturn(renamePopUpView); final FolderItem item = mock(FolderItem.class); presenter.renameItem(item); verify(notification, times(1)).fire(any(NotificationEvent.class)); }
public void renameItem(final FolderItem folderItem) { final Path path = getFolderItemPath(folderItem); renamePopUpPresenter.show(path, new Validator() { @Override public void validate(final String value, final ValidatorCallback callback) { validationService.call(new RemoteCallback<Object>() { @Override public void callback(Object response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(); } } }) .isFileNameValid(path, value); } }, new CommandWithFileNameAndCommitMessage() { @Override public void execute(final FileNameAndCommitMessage details) { baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming()); explorerService.call( getRenameSuccessCallback(getRenameView()), getRenameErrorCallback(getRenameView()) ) .renameItem(folderItem, details.getNewFileName(), details.getCommitMessage()); } } ); }
BaseViewPresenter { public void renameItem(final FolderItem folderItem) { final Path path = getFolderItemPath(folderItem); renamePopUpPresenter.show(path, new Validator() { @Override public void validate(final String value, final ValidatorCallback callback) { validationService.call(new RemoteCallback<Object>() { @Override public void callback(Object response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(); } } }) .isFileNameValid(path, value); } }, new CommandWithFileNameAndCommitMessage() { @Override public void execute(final FileNameAndCommitMessage details) { baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming()); explorerService.call( getRenameSuccessCallback(getRenameView()), getRenameErrorCallback(getRenameView()) ) .renameItem(folderItem, details.getNewFileName(), details.getCommitMessage()); } } ); } }
BaseViewPresenter { public void renameItem(final FolderItem folderItem) { final Path path = getFolderItemPath(folderItem); renamePopUpPresenter.show(path, new Validator() { @Override public void validate(final String value, final ValidatorCallback callback) { validationService.call(new RemoteCallback<Object>() { @Override public void callback(Object response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(); } } }) .isFileNameValid(path, value); } }, new CommandWithFileNameAndCommitMessage() { @Override public void execute(final FileNameAndCommitMessage details) { baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming()); explorerService.call( getRenameSuccessCallback(getRenameView()), getRenameErrorCallback(getRenameView()) ) .renameItem(folderItem, details.getNewFileName(), details.getCommitMessage()); } } ); } BaseViewPresenter(BaseViewImpl baseView); }
BaseViewPresenter { public void renameItem(final FolderItem folderItem) { final Path path = getFolderItemPath(folderItem); renamePopUpPresenter.show(path, new Validator() { @Override public void validate(final String value, final ValidatorCallback callback) { validationService.call(new RemoteCallback<Object>() { @Override public void callback(Object response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(); } } }) .isFileNameValid(path, value); } }, new CommandWithFileNameAndCommitMessage() { @Override public void execute(final FileNameAndCommitMessage details) { baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming()); explorerService.call( getRenameSuccessCallback(getRenameView()), getRenameErrorCallback(getRenameView()) ) .renameItem(folderItem, details.getNewFileName(), details.getCommitMessage()); } } ); } BaseViewPresenter(BaseViewImpl baseView); @PostConstruct void init(); void onActiveOptionsChange(final @Observes ActiveOptionsChangedEvent changedEvent); void update(); void refresh(); void loadContent(final FolderItem item); FolderListing getActiveContent(); void deleteItem(final FolderItem folderItem); void renameItem(final FolderItem folderItem); void copyItem(final FolderItem folderItem); void uploadArchivedFolder(final FolderItem folderItem); String getCurrentTag(); Set<String> getActiveContentTags(); void onModuleSelected(final Module module); void onActiveFolderItemSelected(final FolderItem item); void onItemSelected(final FolderItem folderItem); void setVisible(final boolean visible); void onTagFilterChanged(@Observes TagChangedEvent event); void onResourceUpdated(@Observes final ResourceUpdatedEvent event); void onResourceAdded(@Observes final ResourceAddedEvent event); void onResourceDeleted(@Observes final ResourceDeletedEvent event); void onResourceCopied(@Observes final ResourceCopiedEvent event); void onLockStatusChange(@Observes final LockInfo lockInfo); void initialiseViewForActiveContext(final WorkspaceProjectContext context); void initialiseViewForActiveContext(String initPath); void onResourceRenamed(@Observes final ResourceRenamedEvent event); boolean canShowTags(); }
BaseViewPresenter { public void renameItem(final FolderItem folderItem) { final Path path = getFolderItemPath(folderItem); renamePopUpPresenter.show(path, new Validator() { @Override public void validate(final String value, final ValidatorCallback callback) { validationService.call(new RemoteCallback<Object>() { @Override public void callback(Object response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(); } } }) .isFileNameValid(path, value); } }, new CommandWithFileNameAndCommitMessage() { @Override public void execute(final FileNameAndCommitMessage details) { baseView.showBusyIndicator(CommonConstants.INSTANCE.Renaming()); explorerService.call( getRenameSuccessCallback(getRenameView()), getRenameErrorCallback(getRenameView()) ) .renameItem(folderItem, details.getNewFileName(), details.getCommitMessage()); } } ); } BaseViewPresenter(BaseViewImpl baseView); @PostConstruct void init(); void onActiveOptionsChange(final @Observes ActiveOptionsChangedEvent changedEvent); void update(); void refresh(); void loadContent(final FolderItem item); FolderListing getActiveContent(); void deleteItem(final FolderItem folderItem); void renameItem(final FolderItem folderItem); void copyItem(final FolderItem folderItem); void uploadArchivedFolder(final FolderItem folderItem); String getCurrentTag(); Set<String> getActiveContentTags(); void onModuleSelected(final Module module); void onActiveFolderItemSelected(final FolderItem item); void onItemSelected(final FolderItem folderItem); void setVisible(final boolean visible); void onTagFilterChanged(@Observes TagChangedEvent event); void onResourceUpdated(@Observes final ResourceUpdatedEvent event); void onResourceAdded(@Observes final ResourceAddedEvent event); void onResourceDeleted(@Observes final ResourceDeletedEvent event); void onResourceCopied(@Observes final ResourceCopiedEvent event); void onLockStatusChange(@Observes final LockInfo lockInfo); void initialiseViewForActiveContext(final WorkspaceProjectContext context); void initialiseViewForActiveContext(String initPath); void onResourceRenamed(@Observes final ResourceRenamedEvent event); boolean canShowTags();  }