use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.
the class RemoteAddOpTest method testAddMultipleRemotes.
@Test
public void testAddMultipleRemotes() {
final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
String remoteName1 = "myremote";
String remoteURL1 = "http://test.com";
String remoteName2 = "myremote2";
String remoteURL2 = "http://test2.org";
Remote remote = remoteAdd.setName(remoteName1).setURL(remoteURL1).call();
assertEquals(remoteName1, remote.getName());
assertEquals(remoteURL1, remote.getFetchURL());
assertEquals(remoteURL1, remote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName1 + "/*", remote.getFetch());
remote = remoteAdd.setName(remoteName2).setURL(remoteURL2).call();
assertEquals(remoteName2, remote.getName());
assertEquals(remoteURL2, remote.getFetchURL());
assertEquals(remoteURL2, remote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName2 + "/*", remote.getFetch());
}
use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.
the class RemoteRemoveOpTest method testRemoveRemoteWithRefs.
@Test
public void testRemoveRemoteWithRefs() {
final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
String remoteName = "myremote";
String remoteURL = "http://test.com";
Remote remote = remoteAdd.setName(remoteName).setURL(remoteURL).call();
assertEquals(remoteName, remote.getName());
assertEquals(remoteURL, remote.getFetchURL());
assertEquals(remoteURL, remote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());
String refName = Ref.REMOTES_PREFIX + remoteName + "/branch1";
geogig.command(UpdateRef.class).setName(refName).setNewValue(ObjectId.NULL).call();
final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);
Remote deletedRemote = remoteRemove.setName(remoteName).call();
Optional<Ref> remoteRef = geogig.command(RefParse.class).setName(refName).call();
assertFalse(remoteRef.isPresent());
assertEquals(remoteName, deletedRemote.getName());
assertEquals(remoteURL, deletedRemote.getFetchURL());
assertEquals(remoteURL, deletedRemote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", deletedRemote.getFetch());
}
use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.
the class RemoteRemoveOpTest method testRemoveRemoteWithNoURL.
@Test
public void testRemoveRemoteWithNoURL() {
final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
String remoteName = "myremote";
String remoteURL = "http://test.com";
Remote remote = remoteAdd.setName(remoteName).setURL(remoteURL).call();
assertEquals(remoteName, remote.getName());
assertEquals(remoteURL, remote.getFetchURL());
assertEquals(remoteURL, remote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());
final ConfigOp config = geogig.command(ConfigOp.class);
config.setAction(ConfigAction.CONFIG_UNSET).setName("remote." + remoteName + ".url").call();
final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);
Remote deletedRemote = remoteRemove.setName(remoteName).call();
assertEquals(remoteName, deletedRemote.getName());
assertEquals("", deletedRemote.getFetchURL());
assertEquals("", deletedRemote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", deletedRemote.getFetch());
}
use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.
the class RemoteRemoveOpTest method testRemoveRemote.
@Test
public void testRemoveRemote() {
final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
String remoteName = "myremote";
String remoteURL = "http://test.com";
Remote remote = remoteAdd.setName(remoteName).setURL(remoteURL).call();
assertEquals(remoteName, remote.getName());
assertEquals(remoteURL, remote.getFetchURL());
assertEquals(remoteURL, remote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());
final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);
Remote deletedRemote = remoteRemove.setName(remoteName).call();
assertEquals(remoteName, deletedRemote.getName());
assertEquals(remoteURL, deletedRemote.getFetchURL());
assertEquals(remoteURL, deletedRemote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", deletedRemote.getFetch());
}
use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.
the class RemoteRemoveOpTest method testRemoveRemoteWithNoFetch.
@Test
public void testRemoveRemoteWithNoFetch() {
final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
String remoteName = "myremote";
String remoteURL = "http://test.com";
Remote remote = remoteAdd.setName(remoteName).setURL(remoteURL).call();
assertEquals(remoteName, remote.getName());
assertEquals(remoteURL, remote.getFetchURL());
assertEquals(remoteURL, remote.getPushURL());
assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());
final ConfigOp config = geogig.command(ConfigOp.class);
config.setAction(ConfigAction.CONFIG_UNSET).setName("remote." + remoteName + ".fetch").call();
final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);
Remote deletedRemote = remoteRemove.setName(remoteName).call();
assertEquals(remoteName, deletedRemote.getName());
assertEquals(remoteURL, deletedRemote.getFetchURL());
assertEquals(remoteURL, deletedRemote.getPushURL());
assertEquals("", deletedRemote.getFetch());
}
Aggregations