use of org.locationtech.geogig.api.porcelain.RemoteRemoveOp 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.RemoteRemoveOp 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.RemoteRemoveOp in project GeoGig by boundlessgeo.
the class RemoteRemoveOpTest method testRemoveNoRemotes.
@Test
public void testRemoveNoRemotes() {
final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);
exception.expect(RemoteException.class);
remoteRemove.setName("remote").call();
}
use of org.locationtech.geogig.api.porcelain.RemoteRemoveOp 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.RemoteRemoveOp 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