Search in sources :

Example 1 with RemoteRemoveOp

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());
}
Also used : RemoteRemoveOp(org.locationtech.geogig.api.porcelain.RemoteRemoveOp) Ref(org.locationtech.geogig.api.Ref) UpdateRef(org.locationtech.geogig.api.plumbing.UpdateRef) RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) Remote(org.locationtech.geogig.api.Remote) UpdateRef(org.locationtech.geogig.api.plumbing.UpdateRef) Test(org.junit.Test)

Example 2 with RemoteRemoveOp

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());
}
Also used : RemoteRemoveOp(org.locationtech.geogig.api.porcelain.RemoteRemoveOp) RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) ConfigOp(org.locationtech.geogig.api.porcelain.ConfigOp) Remote(org.locationtech.geogig.api.Remote) Test(org.junit.Test)

Example 3 with RemoteRemoveOp

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();
}
Also used : RemoteRemoveOp(org.locationtech.geogig.api.porcelain.RemoteRemoveOp) Test(org.junit.Test)

Example 4 with RemoteRemoveOp

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());
}
Also used : RemoteRemoveOp(org.locationtech.geogig.api.porcelain.RemoteRemoveOp) RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) Remote(org.locationtech.geogig.api.Remote) Test(org.junit.Test)

Example 5 with RemoteRemoveOp

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());
}
Also used : RemoteRemoveOp(org.locationtech.geogig.api.porcelain.RemoteRemoveOp) RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) ConfigOp(org.locationtech.geogig.api.porcelain.ConfigOp) Remote(org.locationtech.geogig.api.Remote) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 RemoteRemoveOp (org.locationtech.geogig.api.porcelain.RemoteRemoveOp)8 Remote (org.locationtech.geogig.api.Remote)5 RemoteAddOp (org.locationtech.geogig.api.porcelain.RemoteAddOp)5 ConfigOp (org.locationtech.geogig.api.porcelain.ConfigOp)2 Ref (org.locationtech.geogig.api.Ref)1 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)1