1 /*******************************************************************************
2 * Copyright (C) 2017 Thomas Wolf <thomas.wolf@paranor.ch>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
10 *******************************************************************************/
11 package org
.eclipse
.egit
.ui
.test
.stagview
;
15 import org
.eclipse
.egit
.core
.JobFamilies
;
16 import org
.eclipse
.egit
.ui
.Activator
;
17 import org
.eclipse
.egit
.ui
.test
.TestUtil
;
18 import org
.eclipse
.egit
.ui
.view
.repositories
.GitRepositoriesViewTestBase
;
19 import org
.eclipse
.jgit
.lib
.Repository
;
20 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTree
;
21 import org
.eclipse
.swtbot
.swt
.finder
.widgets
.SWTBotTreeItem
;
22 import org
.junit
.After
;
23 import org
.junit
.Before
;
25 public abstract class AbstractStagingViewTestCase
26 extends GitRepositoriesViewTestBase
{
28 protected File repositoryFile
;
30 protected Repository repository
;
33 public void before() throws Exception
{
34 repositoryFile
= createProjectAndCommitToRepository();
35 repository
= lookupRepository(repositoryFile
);
36 TestUtil
.configureTestCommitterAsUser(repository
);
37 Activator
.getDefault().getRepositoryUtil()
38 .addConfiguredRepository(repositoryFile
);
40 selectRepositoryNode();
46 Activator
.getDefault().getRepositoryUtil().removeDir(repositoryFile
);
49 protected void setContent(String content
) throws Exception
{
50 setTestFileContent(content
);
51 TestUtil
.joinJobs(JobFamilies
.INDEX_DIFF_CACHE_UPDATE
);
54 protected void selectRepositoryNode() throws Exception
{
55 SWTBotTree tree
= getOrOpenView().bot().tree();
57 SWTBotTreeItem repoNode
= myRepoViewUtil
.getRootItem(tree
,