use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class ConfigTest method testShouldWarnOnInvalidPropertySetting.
@Test(expectedExceptions = GitException.class, expectedExceptionsMessageRegExp = "error: key does not contain a section: " + INVALID_PROPERTY_NAME + "\n", dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testShouldWarnOnInvalidPropertySetting(GitConnectionFactory connectionFactory) throws Exception {
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
connection.getConfig().add(INVALID_PROPERTY_NAME, PROPERTY_VALUE);
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class DiffTest method testDiffNameOnlyCached.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffNameOnlyCached(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("HEAD").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 DiffTest method testDiffNameStatusWithCommits.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffNameStatusWithCommits(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
makeCommitInMaster(connection);
//change README.txt
connection.add(AddParams.create(AddRequest.DEFAULT_PATTERN));
connection.rm(RmParams.create(singletonList("README.txt")));
connection.commit(CommitParams.create("testDiffNameStatusWithCommits"));
//when
List<String> diff = readDiff(DiffParams.create().withFileFilter(null).withType(DiffType.NAME_STATUS).withRenameLimit(0).withCommitA("HEAD^").withCommitB("HEAD"), connection);
//then
assertEquals(diff.size(), 2);
assertTrue(diff.contains("D\tREADME.txt"));
assertTrue(diff.contains("A\taaa"));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class DiffTest method testDiffNameStatus.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffNameStatus(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
makeCommitInMaster(connection);
//when
List<String> diff = readDiff(DiffParams.create().withType(DiffType.NAME_STATUS).withRenameLimit(0), connection);
//then
assertEquals(diff.size(), 1);
assertTrue(diff.contains("M\taaa"));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class DiffTest method testDiffNameOnlyWithCommits.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testDiffNameOnlyWithCommits(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
makeCommitInMaster(connection);
connection.add(AddParams.create(singletonList("aaa")));
connection.rm(RmParams.create(singletonList("README.txt")));
connection.commit(CommitParams.create("testDiffNameStatusWithCommits"));
//when
List<String> diff = readDiff(DiffParams.create().withFileFilter(null).withType(DiffType.NAME_ONLY).withNoRenames(false).withRenameLimit(0).withCommitA("HEAD^1").withCommitB("HEAD"), connection);
//then
assertEquals(diff.size(), 2);
assertTrue(diff.contains("README.txt"));
assertTrue(diff.contains("aaa"));
}
Aggregations