Search in sources :

Example 1 with MockAbstractVcs

use of com.intellij.openapi.vcs.changes.committed.MockAbstractVcs in project intellij-community by JetBrains.

the class VcsRepositoryManagerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    cd(myProjectRoot);
    myVcs = new MockAbstractVcs(myProject);
    myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    myProjectLevelVcsManager.registerVcs(myVcs);
    READY_TO_READ = new CountDownLatch(1);
    CONTINUE_MODIFY = new CountDownLatch(1);
    myMockCreator = createMockRepositoryCreator();
    ExtensionPoint<VcsRepositoryCreator> point = getExtensionPoint();
    point.registerExtension(myMockCreator);
    myGlobalRepositoryManager = new VcsRepositoryManager(myProject, myProjectLevelVcsManager);
    myGlobalRepositoryManager.initComponent();
}
Also used : MockAbstractVcs(com.intellij.openapi.vcs.changes.committed.MockAbstractVcs) VcsRepositoryCreator(com.intellij.dvcs.repo.VcsRepositoryCreator) VcsRepositoryManager(com.intellij.dvcs.repo.VcsRepositoryManager) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 2 with MockAbstractVcs

use of com.intellij.openapi.vcs.changes.committed.MockAbstractVcs in project intellij-community by JetBrains.

the class LocalChangesUnderRootsTest method testChangesInTwoGitRoots.

public void testChangesInTwoGitRoots() {
    AllVcsesI myVcses = AllVcses.getInstance(myProject);
    myVcses.registerManually(new MockAbstractVcs(myProject, "Mock"));
    List<VirtualFile> roots = createRootStructure(Pair.create(myBaseDir.getPath(), "Mock"), Pair.create("community", "Mock"));
    Change changeBeforeCommunity = createChangeForPath("a.txt");
    Change changeAfterCommunity = createChangeForPath("readme.txt");
    Change changeInCommunity = createChangeForPath("community/com.txt");
    myChangeListManager.addChanges(changeBeforeCommunity, changeAfterCommunity, changeInCommunity);
    Map<VirtualFile, Collection<Change>> expected = new HashMap<>();
    expected.put(roots.get(0), Arrays.asList(changeBeforeCommunity, changeAfterCommunity));
    expected.put(roots.get(1), Collections.singletonList(changeInCommunity));
    Map<VirtualFile, Collection<Change>> changesUnderRoots = myLocalChangesUnderRoots.getChangesUnderRoots(roots);
    assertEqualMaps(expected, changesUnderRoots);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) MockAbstractVcs(com.intellij.openapi.vcs.changes.committed.MockAbstractVcs) Change(com.intellij.openapi.vcs.changes.Change) AllVcsesI(com.intellij.openapi.vcs.impl.projectlevelman.AllVcsesI)

Example 3 with MockAbstractVcs

use of com.intellij.openapi.vcs.changes.committed.MockAbstractVcs in project intellij-community by JetBrains.

the class VcsRootPlatformTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getTestName(true)).getFixture();
    myProjectFixture.setUp();
    myProject = myProjectFixture.getProject();
    myProjectRoot = myProject.getBaseDir();
    cd(myProjectRoot);
    Module module = doCreateRealModuleIn("foo", myProject, EmptyModuleType.getInstance());
    myRootModel = ((ModuleRootManagerImpl) ModuleRootManager.getInstance(module)).getRootModel();
    mkdir(myRepositoryFolderName);
    myProjectRoot.refresh(false, true);
    myRepository = myProjectRoot.findChild(myRepositoryFolderName);
    myVcs = new MockAbstractVcs(myProject);
    myVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    ExtensionPoint<VcsRootChecker> point = getExtensionPoint();
    myExtension = new VcsRootChecker() {

        @NotNull
        @Override
        public VcsKey getSupportedVcs() {
            return myVcs.getKeyInstanceMethod();
        }

        @Override
        public boolean isRoot(@NotNull String path) {
            return new File(path, DOT_MOCK).exists();
        }

        @Override
        public boolean isVcsDir(@NotNull String path) {
            return path.toLowerCase().endsWith(DOT_MOCK);
        }
    };
    point.registerExtension(myExtension);
    myVcsManager.registerVcs(myVcs);
    myVcsName = myVcs.getName();
    myRepository.refresh(false, true);
}
Also used : VcsKey(com.intellij.openapi.vcs.VcsKey) VcsRootChecker(com.intellij.openapi.vcs.VcsRootChecker) MockAbstractVcs(com.intellij.openapi.vcs.changes.committed.MockAbstractVcs) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 4 with MockAbstractVcs

use of com.intellij.openapi.vcs.changes.committed.MockAbstractVcs in project intellij-community by JetBrains.

the class TaskVcsTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    myVcs = new MockAbstractVcs(getProject());
    myChangeProvider = new MyMockChangeProvider();
    myVcs.setChangeProvider(myChangeProvider);
    AllVcses.getInstance(getProject()).registerManually(myVcs);
    myChangeListManager = (ChangeListManagerImpl) ChangeListManager.getInstance(getProject());
    myTaskManager = (TaskManagerImpl) TaskManager.getManager(getProject());
    ProjectLevelVcsManager.getInstance(getProject()).setDirectoryMapping("", myVcs.getName());
    ProjectLevelVcsManager.getInstance(getProject()).hasActiveVcss();
    myRepository = new TestRepository();
    myRepository.setTasks(new Task() {

        @NotNull
        @Override
        public String getId() {
            return "TEST-001";
        }

        @NotNull
        @Override
        public String getSummary() {
            return "Summary";
        }

        @Override
        public String getDescription() {
            return null;
        }

        @NotNull
        @Override
        public Comment[] getComments() {
            return Comment.EMPTY_ARRAY;
        }

        @NotNull
        @Override
        public Icon getIcon() {
            return TasksIcons.Unknown;
        }

        @NotNull
        @Override
        public TaskType getType() {
            return TaskType.BUG;
        }

        @Override
        public Date getUpdated() {
            return null;
        }

        @Override
        public Date getCreated() {
            return null;
        }

        @Override
        public boolean isClosed() {
            return false;
        }

        @Override
        public boolean isIssue() {
            return true;
        }

        @Override
        public String getIssueUrl() {
            return null;
        }

        @Override
        public TaskRepository getRepository() {
            return myRepository;
        }
    });
    myTaskManager.setRepositories(Collections.singletonList(myRepository));
}
Also used : MockAbstractVcs(com.intellij.openapi.vcs.changes.committed.MockAbstractVcs) NotNull(org.jetbrains.annotations.NotNull) Date(java.util.Date)

Aggregations

MockAbstractVcs (com.intellij.openapi.vcs.changes.committed.MockAbstractVcs)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 NotNull (org.jetbrains.annotations.NotNull)2 VcsRepositoryCreator (com.intellij.dvcs.repo.VcsRepositoryCreator)1 VcsRepositoryManager (com.intellij.dvcs.repo.VcsRepositoryManager)1 Module (com.intellij.openapi.module.Module)1 VcsKey (com.intellij.openapi.vcs.VcsKey)1 VcsRootChecker (com.intellij.openapi.vcs.VcsRootChecker)1 Change (com.intellij.openapi.vcs.changes.Change)1 AllVcsesI (com.intellij.openapi.vcs.impl.projectlevelman.AllVcsesI)1 File (java.io.File)1 Date (java.util.Date)1 CountDownLatch (java.util.concurrent.CountDownLatch)1