P4ChangelistListener implements ChangeListListener { @Override public void changesMoved(final Collection<Change> changes, final ChangeList fromList, final ChangeList toList) { LOG.debug("changesMoved: " + fromList + " to " + toList); changesAdded(changes, toList); } P4ChangelistListener(@NotNull final Project project); @Override void changeListAdded(@NotNull final ChangeList list); @Override void changeListRemoved(@NotNull final ChangeList list); @Override void changesRemoved(@NotNull final Collection<Change> changes, @NotNull final ChangeList fromList); @Override void changesAdded(@NotNull final Collection<Change> changes, @NotNull final ChangeList toList); @Override void changeListChanged(final ChangeList list); @Override void changeListRenamed(final ChangeList list, final String oldName); @Override void changeListCommentChanged(final ChangeList list, final String oldComment); @Override void changesMoved(final Collection<Change> changes, final ChangeList fromList, final ChangeList toList); @Override void defaultListChanged(final ChangeList oldDefaultList, final ChangeList newDefaultList); @Override void unchangedFileStatusChanged(); @Override void changeListUpdateDone();  }
@ExtendWith({ TemporaryFolderExtension.class, ErrorCollectorExtension.class }) @Test void offlineMoveFileToNewChangelist(TemporaryFolder tmp, Errors errors) throws InterruptedException, IOException { vcs.idea.useInlineThreading(errors.get()); ClientConfigRoot root = vcs.addClientConfigRoot(tmp, "client"); assertNotNull(root.getClientRootDir()); vcs.goOffline(root); assertFalse(vcs.registry.isOnline(root.getClientConfig().getClientServerRef())); P4ChangelistId defaultChangeId = vcs.addDefaultChangelist(root); VirtualFile addedVirtualFile = root.getClientRootDir().createChildData(this, "added.txt"); FilePath addedFile = VcsUtil.getFilePath(addedVirtualFile); vcs.server.getCommandRunner() .perform(root.getClientConfig(), new AddEditAction(addedFile, null, defaultChangeId, root.getClientConfig().getCharSetName())); errors.assertEmpty(); assertNotNull(vcs.cacheComponent.getState()); assertSize(1, vcs.cacheComponent.getState().pendingActions); assertEquals(ADD_EDIT_FILE, vcs.cacheComponent.getState().pendingActions.get(0).clientActionCmd); Change change = new Change(null, new CurrentContentRevision(addedFile)); MockLocalChangeList changeList = vcs.addIdeChangelist("Test change", "A test change", false); P4ChangelistListener listener = new P4ChangelistListener(vcs.idea.getMockProject()); listener.changesMoved(Collections.singleton(change), vcs.getMockChangelistManager().getDefaultChangeList(), changeList); Pair<IdeChangelistMap, IdeFileMap> cacheState = vcs.cacheComponent.getServerOpenedCache(); assertNotNull(cacheState.first.getP4ChangesFor(changeList)); assertSize(1, cacheState.first.getP4ChangesFor(changeList)); assertNotNull(cacheState.second.forIdeFile(addedFile)); }