use of org.eclipse.che.api.git.params.PullParams in project che by eclipse.
the class PullTest method testPullRemote.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testPullRemote(GitConnectionFactory connectionFactory) throws GitException, IOException, URISyntaxException, UnauthorizedException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
String branchName = "remoteBranch";
connection.checkout(CheckoutParams.create(branchName).withCreateNew(true));
addFile(connection, "remoteFile", "");
connection.add(AddParams.create(singletonList(".")));
connection.commit(CommitParams.create("remote test"));
GitConnection connection2 = connectToGitRepositoryWithContent(connectionFactory, remoteRepo);
//when
PullParams params = PullParams.create(connection.getWorkingDir().getAbsolutePath()).withRefSpec("refs/heads/remoteBranch:refs/heads/remoteBranch");
connection2.pull(params);
//then
assertTrue(new File(remoteRepo.getAbsolutePath(), "remoteFile").exists());
}
Aggregations