SVN 1.7: svnkit 8802, tests ok

This commit is contained in:
irengrig
2012-02-20 12:54:17 +04:00
parent 613c8a4798
commit 8614b2bea0
8 changed files with 27 additions and 4 deletions
@@ -47,12 +47,19 @@ import java.util.Map;
public class VcsDirtyScopeVfsListener implements ApplicationComponent, BulkFileListener {
private final ProjectLocator myProjectLocator;
private final MessageBusConnection myMessageBusConnection;
// for tests only
private boolean myForbid;
public VcsDirtyScopeVfsListener() {
myProjectLocator = ProjectLocator.getInstance();
myMessageBusConnection = ApplicationManager.getApplication().getMessageBus().connect();
}
public void setForbid(boolean forbid) {
assert ApplicationManager.getApplication().isUnitTestMode();
myForbid = forbid;
}
@NotNull
public String getComponentName() {
return VcsDirtyScopeVfsListener.class.getName();
@@ -68,6 +75,7 @@ public class VcsDirtyScopeVfsListener implements ApplicationComponent, BulkFileL
@Override
public void before(List<? extends VFileEvent> events) {
if (myForbid) return;
final FileAndDirsCollector dirtyFilesAndDirs = new FileAndDirsCollector();
// collect files and directories - sources of events
for (VFileEvent event : events) {
@@ -89,6 +97,7 @@ public class VcsDirtyScopeVfsListener implements ApplicationComponent, BulkFileL
@Override
public void after(List<? extends VFileEvent> events) {
if (myForbid) return;
final FileAndDirsCollector dirtyFilesAndDirs = new FileAndDirsCollector();
// collect files and directories - sources of events
for (VFileEvent event : events) {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -47,9 +47,7 @@ public class MultipleRefreshesTest {
@Parameterized.Parameters
public static List<Object[]> data() {
final ArrayList<Object[]> result = new ArrayList<Object[]>(10);
//for (int i = 0; i < 100; i++) {
// todo debug
for (int i = 0; i < 1; i++) {
for (int i = 0; i < 100; i++) {
result.add(new Object[]{i});
}
return result;
@@ -225,7 +225,6 @@ public class SvnRenameTest extends SvnTestCase {
Assert.assertTrue(new File(unversionedDirFile, "c.txt").exists());
}
@Bombed(user = "irengrig", year = 2012, month = Calendar.FEBRUARY, day = 25, description = "waiting for svnkit fix (reported 18.02)")
// IDEA-13824
@Test
public void testRenameFileRenameDir() throws Exception {
@@ -1,13 +1,17 @@
package org.jetbrains.idea.svn17;
import com.intellij.idea.Bombed;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.components.ComponentManager;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vcs.ObjectsConvertor;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeVfsListener;
import com.intellij.openapi.vfs.VirtualFile;
import junit.framework.Assert;
import org.junit.Test;
@@ -23,6 +27,8 @@ public class SvnTestDirtyScopeStateTest extends SvnTestCase {
super.setUp();
myInitChangeListManager = false;
final VcsDirtyScopeVfsListener vfsListener = ApplicationManager.getApplication().getComponent(VcsDirtyScopeVfsListener.class);
vfsListener.setForbid(true);
}
@Test
@@ -35,6 +41,7 @@ public class SvnTestDirtyScopeStateTest extends SvnTestCase {
final VirtualFile fileB = createFileInCommand("b.txt", "old content");
final VirtualFile fileC = createFileInCommand("c.txt", "old content");
final VirtualFile fileD = createFileInCommand("d.txt", "old content");
waitABit();
final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));
@@ -70,6 +77,15 @@ public class SvnTestDirtyScopeStateTest extends SvnTestCase {
Assert.assertTrue(! dirty3.contains(new FilePathImpl(fileD)));
}
private void waitABit() {
try {
Thread.sleep(100);
}
catch (InterruptedException e) {
//
}
}
@Test
public void testOkToAddScopeUnderWriteAction() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
@@ -80,6 +96,7 @@ public class SvnTestDirtyScopeStateTest extends SvnTestCase {
final VirtualFile fileB = createFileInCommand("b.txt", "old content");
final VirtualFile fileC = createFileInCommand("c.txt", "old content");
final VirtualFile fileD = createFileInCommand("d.txt", "old content");
waitABit();
final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));