Author: adietish
Date: 2011-12-21 07:20:25 -0500 (Wed, 21 Dec 2011)
New Revision: 37485
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java
Log:
[JBIDE-10542] cleanup tests
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2011-12-21
07:49:34 UTC (rev 37484)
+++
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2011-12-21
12:20:25 UTC (rev 37485)
@@ -79,7 +79,7 @@
testProject.getProject(),
fileName,
fileContent);
- testRepository.track(file);
+ testRepository.add(file);
EGitUtils.commit(testProject.getProject(), null);
@@ -131,7 +131,7 @@
testProject2.getProject(),
fileName,
fileContent);
- testRepository2.track(fileInRepo2);
+ testRepository2.add(fileInRepo2);
File fileInClone = clonedTestRepository.createFile(fileName, fileContent);
clonedTestRepository.addAndCommit(fileInClone, "adding a file");
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java 2011-12-21
07:49:34 UTC (rev 37484)
+++
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/util/TestRepository.java 2011-12-21
12:20:25 UTC (rev 37485)
@@ -26,7 +26,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.RepositoryCache;
import org.eclipse.egit.core.op.BranchOperation;
@@ -146,7 +145,7 @@
File file = new File(repoPath, "dummy");
if (!file.exists())
FileUtils.createNewFile(file);
- track(file);
+ add(file);
return commit(message);
}
@@ -199,17 +198,13 @@
*/
public RevCommit addAndCommit(IProject project, File file, String commitMessage)
throws Exception {
- track(file);
- addToIndex(project, file);
-
+ add(file);
return commit(commitMessage);
}
public RevCommit addAndCommit(File file, String commitMessage)
throws Exception {
- track(file);
- addToIndex(file);
-
+ add(file);
return commit(commitMessage);
}
@@ -244,8 +239,8 @@
public RevCommit appendContentAndCommit(IProject project, File file,
String content, String commitMessage) throws Exception {
appendFileContent(file, content);
- track(file);
- addToIndex(project, file);
+ add(file);
+ add(project, file);
return commit(commitMessage);
}
@@ -276,8 +271,8 @@
return commitCommand.call();
}
- public void track(IFile file) throws IOException {
- track(new File(file.getLocation().toOSString()));
+ public void add(IFile file) throws IOException {
+ add(new File(file.getLocation().toOSString()));
}
/**
@@ -286,9 +281,9 @@
* @param file
* @throws IOException
*/
- public void track(File file) throws IOException {
- String repoPath = getRepoRelativePath(
- new Path(file.getPath()).toString());
+ public void add(File file) throws IOException {
+ String repoPath =
+ getRepoRelativePath(file.getAbsolutePath());
try {
new Git(repository).add().addFilepattern(repoPath).call();
} catch (NoFilepatternException e) {
@@ -353,37 +348,12 @@
* @param file
* @throws Exception
*/
- public void addToIndex(IProject project, File file) throws Exception {
- IFile iFile = getIFile(project, file);
- addToIndex(iFile);
+ public void add(IProject project, File file) throws Exception {
+ IFile iFile = getFile(project, file);
+ add(iFile);
}
/**
- * Adds the given file to the index
- *
- * @param file
- * @throws CoreException
- * @throws IOException
- */
- public void addToIndex(IFile file) throws CoreException, IOException {
- String repoPath = getRepoRelativePath(file.getLocation().toOSString());
- try {
- new Git(repository).add().addFilepattern(repoPath).call();
- } catch (NoFilepatternException e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public void addToIndex(File file) throws CoreException, IOException {
- String repoPath = getRepoRelativePath(file.getAbsolutePath());
- try {
- new Git(repository).add().addFilepattern(repoPath).call();
- } catch (NoFilepatternException e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
* Appends content to end of given file.
*
* @param file
@@ -504,7 +474,7 @@
return null;
}
- public IFile getIFile(IProject project, File file) throws CoreException {
+ public IFile getFile(IProject project, File file) throws CoreException {
String relativePath = getRepoRelativePath(file.getAbsolutePath());
String quotedProjectName = Pattern.quote(project.getName());
@@ -589,7 +559,7 @@
SystemReader.setInstance(mockSystemReader);
mockSystemReader.setProperty(Constants.GIT_CEILING_DIRECTORIES_KEY,
ceilingPath.toOSString());
}
-
+
public File getGitDir() {
return gitDir;
}