SvnCleanupAndSpeedupTest

This commit is contained in:
Roman Shevchenko
2012-02-27 22:51:24 +01:00
parent 9e1b8d46a9
commit 22dd815c0d
3 changed files with 63 additions and 18 deletions
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.svn;
import com.intellij.ide.startup.impl.StartupManagerImpl;
@@ -13,7 +28,6 @@ import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.AbstractVcsTestCase;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.util.ui.UIUtil;
@@ -27,7 +41,7 @@ import java.io.File;
/**
* @author irengrig
*/
public class IgnoredFilesTest extends AbstractVcsTestCase {
public class IgnoredFilesTest extends SvnTestCase {
private SvnVcs myVcs;
private ProjectLevelVcsManagerImpl myVcsManager;
private ChangeListManager myChangeListManager;
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.svn;
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
@@ -12,6 +27,7 @@ import com.intellij.openapi.vcs.changes.ui.RollbackWorker;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import org.junit.Test;
@@ -60,9 +76,9 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
}
}
private static void sleep300() {
private static void sleep(final int millis) {
try {
Thread.sleep(10000);
Thread.sleep(millis);
}
catch (InterruptedException ignore) { }
}
@@ -71,14 +87,14 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
public void testModificationAndAfterRevert() throws Exception {
final SubTree subTree = new SubTree(myWorkingCopyDir);
checkin();
sleep300();
sleep(100);
editFileInCommand(myProject, subTree.myS1File, "new");
editFileInCommand(myProject, subTree.myS1File, "new content");
final CharSequence text1 = LoadTextUtil.loadText(subTree.myS1File);
Assert.assertEquals("new", text1.toString());
Assert.assertEquals("new content", text1.toString());
sleep300();
sleep(100);
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(subTree.myS1File.getPath()));
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
@@ -113,7 +129,7 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
assertVF(subTree.mySourceDir, newName);
sleep300();
sleep(300);
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myS1File}, clManager.getDefaultListName(), clManager);
@@ -138,7 +154,7 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
assertVF(subTree.myTargetDir, "s1.txt");
sleep300();
sleep(300);
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.myS1File}, clManager.getDefaultListName(), clManager);
@@ -166,7 +182,7 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
assertVF(subTree.mySourceDir, "s1.txt");
assertVF(subTree.mySourceDir, "s2.txt");
sleep300();
sleep(300);
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.mySourceDir, subTree.myS1File, subTree.myS2File},
@@ -199,7 +215,7 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
final CharSequence text1 = LoadTextUtil.loadText(subTree.myS1File);
Assert.assertEquals("new", text1.toString());
sleep300();
sleep(300);
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {subTree.mySourceDir, subTree.myS1File, subTree.myS2File},
@@ -262,7 +278,7 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
checkin();
deleteFileInCommand(subTree.myRootDir);
sleep300();
sleep(300);
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
@@ -288,11 +304,12 @@ public class SvnChangesCorrectlyRefreshedTest extends SvnTestCase {
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
}
private VirtualFile assertVF(final VirtualFile parent, final String name) {
@Nullable
private static VirtualFile assertVF(final VirtualFile parent, final String name) {
final VirtualFile[] files = parent.getChildren();
final StringBuilder sb = new StringBuilder("Files: ");
//final StringBuilder sb = new StringBuilder("Files: ");
for (VirtualFile file : files) {
sb.append(file.getName()).append(' ');
//sb.append(file.getName()).append(' ');
if (name.equals(file.getName())) return file;
}
System.out.println("not found as child");
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.svn16;
import com.intellij.ide.startup.impl.StartupManagerImpl;
@@ -13,7 +28,6 @@ import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.AbstractVcsTestCase;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.util.ui.UIUtil;
@@ -28,7 +42,7 @@ import java.io.File;
/**
* @author irengrig
*/
public class IgnoredFilesTest extends AbstractVcsTestCase {
public class IgnoredFilesTest extends SvnTestCase {
private SvnVcs myVcs;
private ProjectLevelVcsManagerImpl myVcsManager;
private ChangeListManager myChangeListManager;