use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class DiffTest method testDiffNameOnlyCachedNoCommit.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffNameOnlyCachedNoCommit(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
makeCommitInMaster(connection);
//when
connection.add(AddParams.create(singletonList("aaa")));
List<String> diff = readDiff(DiffParams.create().withFileFilter(null).withType(DiffType.NAME_ONLY).withNoRenames(false).withRenameLimit(0).withCommitA(null).withCached(true), connection);
//then
assertEquals(diff.size(), 1);
assertTrue(diff.contains("aaa"));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class FetchTest method testWhenThereAreNoAnyRemotes.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class, expectedExceptions = GitException.class, expectedExceptionsMessageRegExp = "No remote repository specified. " + "Please, specify either a URL or a remote name from which new revisions should be fetched in request.")
public void testWhenThereAreNoAnyRemotes(GitConnectionFactory connectionFactory) throws Exception {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
//when
connection.fetch(FetchParams.create(null));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class GetCommitersTest method testGetCommitters.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testGetCommitters(GitConnectionFactory connectionFactory) throws GitException, IOException {
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
//given
addFile(connection, "newfile", "newfile content");
connection.add(AddParams.create(singletonList(".")));
connection.commit(CommitParams.create("test commit"));
//when
List<GitUser> committers = connection.getCommiters();
//then
assertEquals(committers.size(), 1);
assertEquals(committers.get(0), getTestGitUser());
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class GitTestUtil method connectToInitializedGitRepository.
public static GitConnection connectToInitializedGitRepository(GitConnectionFactory connectionFactory, File repository) throws GitException, IOException {
GitConnection connection = getTestUserConnection(connectionFactory, repository);
connection.init(false);
return connection;
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class InitTest method testInit.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testInit(GitConnectionFactory connectionFactory) throws GitException, URISyntaxException, IOException {
GitConnection connection = getTestUserConnection(connectionFactory, repository);
//check git is not initialized
assertFalse(new File(repository, ".git").exists());
//when
connection.init(false);
//then
assertTrue(new File(repository, ".git").exists());
}
Aggregations