use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class RemoteListTest method testRemoteList.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testRemoteList(GitConnectionFactory connectionFactory) throws ServerException, URISyntaxException, UnauthorizedException, IOException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
GitConnection connection2 = connectionFactory.getConnection(remoteRepo.getAbsolutePath());
connection2.clone(CloneParams.create(connection.getWorkingDir().getAbsolutePath()).withWorkingDir(connection2.getWorkingDir().getAbsolutePath()));
assertEquals(connection2.remoteList(null, false).size(), 1);
//create new remote
connection2.remoteAdd(RemoteAddParams.create("newremote", "newremote.url"));
assertEquals(connection2.remoteList(null, false).size(), 2);
//when
List<Remote> one = connection2.remoteList("newremote", false);
//then
assertEquals(one.get(0).getUrl(), "newremote.url");
assertEquals(one.size(), 1);
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class RemoteUpdateTest method testDeleteUrl.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testDeleteUrl(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
//add url
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
addInitialRemote(connection);
connection.remoteUpdate(RemoteUpdateParams.create("newRemote").withAddUrl(singletonList("newUrl")));
//when
connection.remoteUpdate(RemoteUpdateParams.create("newRemote").withRemoveUrl(singletonList("newUrl")));
//then
assertFalse(parseAllConfig(connection).containsKey("remote.newRemote.newUrl"));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class RemoteUpdateTest method testDeletePushUrl.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testDeletePushUrl(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
addInitialRemote(connection);
//add push url
connection.remoteUpdate(RemoteUpdateParams.create("newRemote").withAddPushUrl(singletonList("pushurl")));
//when
connection.remoteUpdate(RemoteUpdateParams.create("newRemote").withRemovePushUrl(singletonList("pushurl")));
//then
assertNull(parseAllConfig(connection).get("remote.newRemote.pushurl"));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class RemoteUpdateTest method testAddPushUrl.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testAddPushUrl(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
addInitialRemote(connection);
//when
connection.remoteUpdate(RemoteUpdateParams.create("newRemote").withAddPushUrl(singletonList("pushurl1")));
//then
assertTrue(parseAllConfig(connection).get("remote.newRemote.pushurl").contains("pushurl1"));
}
use of org.eclipse.che.api.git.GitConnection in project che by eclipse.
the class RemoveTest method testNotCachedRemove.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testNotCachedRemove(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
//when
connection.rm(RmParams.create(singletonList("README.txt")).withCached(false));
//then
assertFalse(new File(connection.getWorkingDir(), "README.txt").exists());
assertEquals(connection.status(StatusFormat.SHORT).getRemoved().get(0), "README.txt");
assertTrue(connection.status(StatusFormat.SHORT).getUntracked().isEmpty());
}
Aggregations