[releng] Fix test failures
[egit/eclipse.git] / org.eclipse.egit.ui.test / src / org / eclipse / egit / ui / test / stagview / AbstractStagingViewTestCase.java
blob4f00384fc95c4ed5a6288efd80d9112ceb8305db
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;
13 import java.io.File;
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;
32 @Before
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();
43 @After
44 public void after() {
45 repository = null;
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,
58 repositoryFile);
59 repoNode.select();