@Test public void testDeletion() throws Exception { final File f = new File(myClientRoot, "f.txt"); f.createNewFile(); final VirtualFile vf = myLFS.refreshAndFindFileByIoFile(f); myChangeListManager.ensureUpToDate(false); ((ChangeListManagerImpl) myChangeListManager).getUnversionedFiles().contains(vf); FileUtil.delete(f); myWorkingCopyDir.refresh(false, true); myChangeListManager.ensureUpToDate(false); ((ChangeListManagerImpl) myChangeListManager).getUnversionedFiles().isEmpty(); }
public void doTest(final Runnable runnable) { final TimeoutWaiter waiter = new TimeoutWaiter(); final DuringUpdateTest test = new DuringUpdateTest(waiter, runnable); myChangeProvider.setTest(test); waiter.setControlled(test); myDirtyScopeManager.markEverythingDirty(); myClManager.ensureUpToDate(false); waiter.startTimeout(); if (test.getException() != null) { test.getException().printStackTrace(); } assert test.get() : (test.getException() == null ? null : test.getException().getMessage()); }
@Test public void testGeneration() throws Exception { for (int i = 0; i < 100; i++) { final File f = new File(myClientRoot, "f" + i + ".txt"); f.createNewFile(); } myWorkingCopyDir.refresh(false, true); myChangeListManager.ensureUpToDate(false); final List<VirtualFile> unversionedFiles = ((ChangeListManagerImpl) myChangeListManager).getUnversionedFiles(); final Pattern pattern = Pattern.compile("f([0-9])+\\.txt"); int cnt = 0; for (VirtualFile unversionedFile : unversionedFiles) { if (VfsUtil.isAncestor(myWorkingCopyDir, unversionedFile, true)) { ++cnt; Assert.assertTrue(pattern.matcher(unversionedFile.getName()).matches()); } } Assert.assertEquals(100, cnt); }
@Before public void setUp() throws Exception { System.setProperty("svnkit.wc.17", "false"); UIUtil.invokeAndWaitIfNeeded( new Runnable() { @Override public void run() { try { final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory(); myTempDirFixture = fixtureFactory.createTempDirTestFixture(); myTempDirFixture.setUp(); final File svnRoot = new File(myTempDirFixture.getTempDirPath(), "svnroot"); svnRoot.mkdir(); File pluginRoot = new File(PluginPathManager.getPluginHomePath("svn4idea")); if (!pluginRoot.isDirectory()) { // try standalone mode Class aClass = SvnTestCase.class; String rootPath = PathManager.getResourceRoot( aClass, "/" + aClass.getName().replace('.', '/') + ".class"); pluginRoot = new File(rootPath).getParentFile().getParentFile().getParentFile(); } myClientBinaryPath = new File(pluginRoot, "testData/svn/bin"); ZipUtil.extract(new File(pluginRoot, "testData/svn/newrepo.zip"), svnRoot, null); myWcRoot = new File(myTempDirFixture.getTempDirPath(), "wcroot"); myWcRoot.mkdir(); myRepoUrl = "file:///" + FileUtil.toSystemIndependentName(svnRoot.getPath()); initProject(myWcRoot); activateVCS(SvnVcs17.VCS_NAME); verify(runSvn("co", myRepoUrl, ".")); myGate = new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)); myRefreshCopiesStub = new AtomicSectionsAware() { @Override public void enter() {} @Override public void exit() {} @Override public boolean shouldExitAsap() { return false; } @Override public void checkShouldExit() throws ProcessCanceledException {} }; final SvnVcs17 vcs = SvnVcs17.getInstance(myProject); ((StartupManagerImpl) StartupManager.getInstance(myProject)) .runPostStartupActivities(); // vcs.postStartup(); ((SvnFileUrlMappingImpl17) vcs.getSvnFileUrlMapping()).realRefresh(); } catch (Exception e) { throw new RuntimeException(e); } } }); // there should be kind-a waiting for after change list manager finds all changes and runs inner // refresh of copies in the above method ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty(); changeListManager.ensureUpToDate(false); }