Search in sources :

Example 16 with RemoteAddOp

use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.

the class RemoteAddOpTest method testAddRemoteThatExists.

@Test
public void testAddRemoteThatExists() {
    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());
    exception.expect(RemoteException.class);
    remoteAdd.setName(remoteName).setURL("someotherurl.com").call();
}
Also used : RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) Remote(org.locationtech.geogig.api.Remote) Test(org.junit.Test)

Example 17 with RemoteAddOp

use of org.locationtech.geogig.api.porcelain.RemoteAddOp in project GeoGig by boundlessgeo.

the class RemoteListOpTest method testListRemoteWithNoURL.

@Test
public void testListRemoteWithNoURL() {
    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 RemoteListOp remoteList = geogig.command(RemoteListOp.class);
    ImmutableList<Remote> allRemotes = remoteList.call();
    assertTrue(allRemotes.isEmpty());
}
Also used : RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) ConfigOp(org.locationtech.geogig.api.porcelain.ConfigOp) Remote(org.locationtech.geogig.api.Remote) RemoteListOp(org.locationtech.geogig.api.porcelain.RemoteListOp) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)17 RemoteAddOp (org.locationtech.geogig.api.porcelain.RemoteAddOp)17 Remote (org.locationtech.geogig.api.Remote)13 RemoteRemoveOp (org.locationtech.geogig.api.porcelain.RemoteRemoveOp)5 ConfigOp (org.locationtech.geogig.api.porcelain.ConfigOp)4 RemoteListOp (org.locationtech.geogig.api.porcelain.RemoteListOp)3 Ref (org.locationtech.geogig.api.Ref)1 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)1