mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
svn: Remove fully commented and broken "SvnRootAboveTest", "SvnLocalChangesAndRootsTest"
* "SvnRootAboveTest" almost fully duplicates "SvnLocalChangesAndRootsTest"
* Mentioned use cases aren't tested, tests are broken and should be rewritten anyway if necessary
5bfb4c1f4c follow-up
This commit is contained in:
@@ -1,200 +0,0 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.svn;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vcs.VcsDirectoryMapping;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.IgnoredBeanFactory;
|
||||
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SvnLocalChangesAndRootsTest extends SvnTestCase {
|
||||
private File myAlienRoot;
|
||||
private ProjectLevelVcsManagerImpl myProjectLevelVcsManager;
|
||||
private ChangeListManager myClManager;
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
/*super.setUp();
|
||||
|
||||
myAlienRoot = new File(myTempDirFixture.getTempDirPath(), "alien");
|
||||
myAlienRoot.mkdir();
|
||||
|
||||
myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
|
||||
myProjectLevelVcsManager.setDirectoryMapping(myAlienRoot.getAbsolutePath(), SvnVcs.VCS_NAME);
|
||||
|
||||
myClManager = ChangeListManager.getInstance(myProject);*/
|
||||
}
|
||||
|
||||
// a subtree just marked under VCS root but not content root
|
||||
private class AlienTree {
|
||||
private final File myDir;
|
||||
private final File myFile;
|
||||
private final File myUnversioned;
|
||||
private final File myIgnored;
|
||||
|
||||
public AlienTree(final String base) throws IOException {
|
||||
final String name = "alien";
|
||||
myDir = new File(base, name);
|
||||
myDir.mkdir();
|
||||
sleep100();
|
||||
|
||||
myFile = new File(myDir, "file.txt");
|
||||
myFile.createNewFile();
|
||||
sleep100();
|
||||
|
||||
runInAndVerifyIgnoreOutput("import", "-m", "test", myDir.getAbsolutePath(), myRepoUrl + "/" + name);
|
||||
FileUtil.delete(myDir);
|
||||
runInAndVerifyIgnoreOutput("co", myRepoUrl + "/" + name, myDir.getAbsolutePath());
|
||||
|
||||
myUnversioned = new File(myDir, "unversioned.txt");
|
||||
myFile.createNewFile();
|
||||
sleep100();
|
||||
myIgnored = new File(myDir, "ignored.txt");
|
||||
myFile.createNewFile();
|
||||
sleep100();
|
||||
|
||||
// ignore
|
||||
myClManager.setFilesToIgnore(IgnoredBeanFactory.withMask("ignored*"));
|
||||
}
|
||||
|
||||
private void sleep100() {
|
||||
TimeoutUtil.sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() {
|
||||
//super.tearDown();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAlienRoot() {
|
||||
/*final AlienTree alienTree = new AlienTree(myAlienRoot.getAbsolutePath());
|
||||
|
||||
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
|
||||
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
|
||||
|
||||
final VirtualFile tmpVf = LocalFileSystem.getInstance().findFileByIoFile(new File(myTempDirFixture.getTempDirPath()));
|
||||
Assert.assertNotNull(tmpVf);
|
||||
|
||||
sleep100();
|
||||
|
||||
tmpVf.refresh(false, true);
|
||||
|
||||
final SvnVcs vcs = SvnVcs.getInstance(myProject);
|
||||
((SvnFileUrlMappingImpl) vcs.getSvnFileUrlMapping()).realRefresh(myRefreshCopiesStub);
|
||||
|
||||
Assert.assertEquals(2, vcs.getSvnFileUrlMapping().getAllWcInfos().size());
|
||||
|
||||
final VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(alienTree.myFile);
|
||||
editFileInCommand(myProject, vf, "78");
|
||||
|
||||
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
|
||||
myClManager.ensureUpToDate(false);
|
||||
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {vf},
|
||||
myClManager.getDefaultListName(), myClManager);
|
||||
|
||||
final VirtualFile vfUnv = LocalFileSystem.getInstance().findFileByIoFile(alienTree.myUnversioned);
|
||||
myClManager.isUnversioned(vfUnv);
|
||||
|
||||
final VirtualFile vfIgn = LocalFileSystem.getInstance().findFileByIoFile(alienTree.myIgnored);
|
||||
myClManager.isUnversioned(vfIgn);*/
|
||||
}
|
||||
|
||||
private class SubTree {
|
||||
private final VirtualFile myOuterDir;
|
||||
private final VirtualFile myOuterFile;
|
||||
private final VirtualFile myRootDir;
|
||||
private final VirtualFile myInnerFile;
|
||||
private VirtualFile myNonVersionedUpper;
|
||||
private final VirtualFile myMappingTarget;
|
||||
|
||||
private SubTree(final VirtualFile base, final VirtualFile projectRoot) {
|
||||
// todo +-
|
||||
myMappingTarget = projectRoot.getParent();
|
||||
myOuterDir = createDirInCommand(myMappingTarget, "outer" + System.currentTimeMillis());
|
||||
myOuterFile = createFileInCommand(myOuterDir, "outer.txt", "123");
|
||||
|
||||
myRootDir = createDirInCommand(base, "root");
|
||||
myInnerFile = createFileInCommand(myRootDir, "inner.txt", "321");
|
||||
|
||||
myNonVersionedUpper = createFileInCommand(base, "nonVersioned.txt", "135");
|
||||
|
||||
// correct mappings
|
||||
final List<VcsDirectoryMapping> mappings = myProjectLevelVcsManager.getDirectoryMappings();
|
||||
final String basePath = base.getPath();
|
||||
final List<VcsDirectoryMapping> newMappings = new ArrayList<>(mappings.size());
|
||||
|
||||
for (VcsDirectoryMapping mapping : mappings) {
|
||||
if (! basePath.equals(mapping.getDirectory())) {
|
||||
newMappings.add(mapping);
|
||||
}
|
||||
}
|
||||
newMappings.add(new VcsDirectoryMapping(myMappingTarget.getPath(), SvnVcs.VCS_NAME));
|
||||
myProjectLevelVcsManager.setDirectoryMappings(newMappings);
|
||||
sleep100();
|
||||
}
|
||||
|
||||
public void createNonVers() {
|
||||
myNonVersionedUpper = createFileInCommand(myMappingTarget, "nonVersioned.txt", "135");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSvnVcsRootAbove() {
|
||||
/*enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
|
||||
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
|
||||
|
||||
final SubTree subTree = new SubTree(myWorkingCopyDir, myProject.getBaseDir());
|
||||
|
||||
checkin();
|
||||
|
||||
subTree.createNonVers();
|
||||
|
||||
editFileInCommand(myProject, subTree.myOuterFile, "***");
|
||||
editFileInCommand(myProject, subTree.myInnerFile, "*&*");
|
||||
|
||||
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
|
||||
myClManager.ensureUpToDate(false);
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myOuterFile, subTree.myInnerFile},
|
||||
myClManager.getDefaultListName(), myClManager);*/
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFakeScopeDontBreakTheView() {
|
||||
/*enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
|
||||
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
|
||||
|
||||
final SubTree subTree = new SubTree(myWorkingCopyDir, myProject.getBaseDir());
|
||||
|
||||
checkin();
|
||||
|
||||
subTree.createNonVers();
|
||||
|
||||
editFileInCommand(myProject, subTree.myOuterFile, "***");
|
||||
editFileInCommand(myProject, subTree.myInnerFile, "*&*");
|
||||
|
||||
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
|
||||
myClManager.ensureUpToDate(false);
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myOuterFile, subTree.myInnerFile},
|
||||
myClManager.getDefaultListName(), myClManager);
|
||||
|
||||
VcsDirtyScopeManagerImpl.getInstance(myProject).fileDirty(subTree.myNonVersionedUpper);
|
||||
myClManager.ensureUpToDate(false);
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myOuterFile, subTree.myInnerFile},
|
||||
myClManager.getDefaultListName(), myClManager);*/
|
||||
}
|
||||
|
||||
private void sleep100() {
|
||||
TimeoutUtil.sleep(100);
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.svn;
|
||||
|
||||
import com.intellij.openapi.vcs.VcsDirectoryMapping;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SvnRootAboveTest extends SvnTestCase {
|
||||
private ProjectLevelVcsManagerImpl myProjectLevelVcsManager;
|
||||
private ChangeListManager myClManager;
|
||||
|
||||
private File myLocalWcRoot;
|
||||
private File myProjectRoot;
|
||||
private File myModuleRoot;
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
/*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 = Svn16TestCase.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);
|
||||
|
||||
// real WC root
|
||||
myLocalWcRoot = new File(myTempDirFixture.getTempDirPath(), "wcroot");
|
||||
myLocalWcRoot.mkdir();
|
||||
|
||||
myRepoUrl = "file:///" + FileUtil.toSystemIndependentName(svnRoot.getPath());
|
||||
verify(runSvn("co", myRepoUrl, myLocalWcRoot.getAbsolutePath()));
|
||||
|
||||
// one level below - project root dir
|
||||
sleep100();
|
||||
myProjectRoot = new File(myLocalWcRoot, "projectRoot");
|
||||
myProjectRoot.mkdir();
|
||||
// one more level below - content root
|
||||
sleep100();
|
||||
myModuleRoot = new File(myProjectRoot, "moduleRoot");
|
||||
myModuleRoot.mkdir();
|
||||
sleep100();
|
||||
|
||||
// set current directory
|
||||
verify(runArbitrary("cd", new String[] {myProjectRoot.getAbsolutePath()}));
|
||||
initProject(myModuleRoot);
|
||||
verify(runArbitrary("cd", new String[] {myTempDirFixture.getTempDirPath()}));
|
||||
|
||||
myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
|
||||
myProjectLevelVcsManager.setDirectoryMapping(myLocalWcRoot.getAbsolutePath(), SvnVcs.VCS_NAME);
|
||||
|
||||
final SvnVcs vcs = SvnVcs.getInstance(myProject);
|
||||
((SvnFileUrlMappingImpl) vcs.getSvnFileUrlMapping()).realRefresh(myRefreshCopiesStub);
|
||||
|
||||
myClManager = ChangeListManager.getInstance(myProject);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() {
|
||||
// no setup - no tear down
|
||||
}
|
||||
|
||||
private class SubTree {
|
||||
private final VirtualFile myOuterDir;
|
||||
private final VirtualFile myOuterFile;
|
||||
private final VirtualFile myRootDir;
|
||||
private final VirtualFile myInnerFile;
|
||||
private VirtualFile myNonVersionedUpper;
|
||||
private final VirtualFile myMappingTarget;
|
||||
|
||||
private SubTree(final VirtualFile base, final VirtualFile projectRoot) {
|
||||
// todo +-
|
||||
myMappingTarget = projectRoot.getParent();
|
||||
myOuterDir = createDirInCommand(myMappingTarget, "outer" + System.currentTimeMillis());
|
||||
myOuterFile = createFileInCommand(myOuterDir, "outer.txt", "123");
|
||||
|
||||
myRootDir = createDirInCommand(base, "root");
|
||||
myInnerFile = createFileInCommand(myRootDir, "inner.txt", "321");
|
||||
|
||||
myNonVersionedUpper = createFileInCommand(base, "nonVersioned.txt", "135");
|
||||
|
||||
// correct mappings
|
||||
final List<VcsDirectoryMapping> mappings = myProjectLevelVcsManager.getDirectoryMappings();
|
||||
final String basePath = base.getPath();
|
||||
final List<VcsDirectoryMapping> newMappings = new ArrayList<>(mappings.size());
|
||||
|
||||
for (VcsDirectoryMapping mapping : mappings) {
|
||||
if (! basePath.equals(mapping.getDirectory())) {
|
||||
newMappings.add(mapping);
|
||||
}
|
||||
}
|
||||
newMappings.add(new VcsDirectoryMapping(myMappingTarget.getPath(), SvnVcs.VCS_NAME));
|
||||
myProjectLevelVcsManager.setDirectoryMappings(newMappings);
|
||||
sleep100();
|
||||
}
|
||||
|
||||
public void createNonVers() {
|
||||
myNonVersionedUpper = createFileInCommand(myMappingTarget, "nonVersioned.txt", "135");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSvnVcsRootAbove() {
|
||||
/*enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
|
||||
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
|
||||
|
||||
final SubTree subTree = new SubTree(myWorkingCopyDir, myProject.getBaseDir());
|
||||
|
||||
checkin();
|
||||
|
||||
subTree.createNonVers();
|
||||
|
||||
editFileInCommand(myProject, subTree.myOuterFile, "***");
|
||||
editFileInCommand(myProject, subTree.myInnerFile, "*&*");
|
||||
|
||||
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
|
||||
myClManager.ensureUpToDate(false);
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myOuterFile, subTree.myInnerFile},
|
||||
myClManager.getDefaultListName(), myClManager);*/
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFakeScopeDontBreakTheView() {
|
||||
/*enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
|
||||
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
|
||||
|
||||
final SubTree subTree = new SubTree(myWorkingCopyDir, myProject.getBaseDir());
|
||||
|
||||
checkin();
|
||||
|
||||
subTree.createNonVers();
|
||||
|
||||
editFileInCommand(myProject, subTree.myOuterFile, "***");
|
||||
editFileInCommand(myProject, subTree.myInnerFile, "*&*");
|
||||
|
||||
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
|
||||
myClManager.ensureUpToDate(false);
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myOuterFile, subTree.myInnerFile},
|
||||
myClManager.getDefaultListName(), myClManager);
|
||||
|
||||
VcsDirtyScopeManagerImpl.getInstance(myProject).fileDirty(subTree.myNonVersionedUpper);
|
||||
myClManager.ensureUpToDate(false);
|
||||
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myOuterFile, subTree.myInnerFile},
|
||||
myClManager.getDefaultListName(), myClManager);*/
|
||||
}
|
||||
|
||||
private void sleep100() {
|
||||
TimeoutUtil.sleep(100);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user