blob: 1bc05fa6d69c96595afa6765f959fda244f705e7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*******************************************************************************
* Copyright (C) 2017 Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.egit.ui.test.stagview;
import java.io.File;
import org.eclipse.egit.core.JobFamilies;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.repository.RepositoriesView;
import org.eclipse.egit.ui.internal.staging.StagingView;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestUtils;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.After;
import org.junit.Before;
public abstract class AbstractStagingViewTestCase
extends LocalRepositoryTestCase {
protected static final GitRepositoriesViewTestUtils repoViewUtil = new GitRepositoriesViewTestUtils();
protected File repositoryFile;
protected Repository repository;
@Before
public void before() throws Exception {
repositoryFile = createProjectAndCommitToRepository();
repository = lookupRepository(repositoryFile);
TestUtil.configureTestCommitterAsUser(repository);
Activator.getDefault().getRepositoryUtil()
.addConfiguredRepository(repositoryFile);
selectRepositoryNode();
}
@After
public void after() {
TestUtil.hideView(RepositoriesView.VIEW_ID);
TestUtil.hideView(StagingView.VIEW_ID);
Activator.getDefault().getRepositoryUtil().removeDir(repositoryFile);
}
protected void setContent(String content) throws Exception {
setTestFileContent(content);
TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
}
protected void selectRepositoryNode() throws Exception {
SWTBotView repositoriesView = TestUtil
.showView(RepositoriesView.VIEW_ID);
SWTBotTree tree = repositoriesView.bot().tree();
SWTBotTreeItem repoNode = repoViewUtil.getRootItem(tree,
repositoryFile);
repoNode.select();
}
}
|