Search in sources :

Example 11 with Remote

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

the class RemoteAddOpTest method testAddRemoteNullBranch.

@Test
public void testAddRemoteNullBranch() {
    final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
    String remoteName = "myremote";
    String remoteURL = "http://test.com";
    Remote remote = remoteAdd.setName(remoteName).setURL(remoteURL).setBranch(null).call();
    assertEquals(remoteName, remote.getName());
    assertEquals(remoteURL, remote.getFetchURL());
    assertEquals(remoteURL, remote.getPushURL());
    assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());
}
Also used : RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) Remote(org.locationtech.geogig.api.Remote) Test(org.junit.Test)

Example 12 with Remote

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

the class RemoteAddOpTest method testAddRemoteEmptyBranch.

@Test
public void testAddRemoteEmptyBranch() {
    final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
    String remoteName = "myremote";
    String remoteURL = "http://test.com";
    Remote remote = remoteAdd.setName(remoteName).setURL(remoteURL).setBranch("").call();
    assertEquals(remoteName, remote.getName());
    assertEquals(remoteURL, remote.getFetchURL());
    assertEquals(remoteURL, remote.getPushURL());
    assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());
}
Also used : RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) Remote(org.locationtech.geogig.api.Remote) Test(org.junit.Test)

Example 13 with Remote

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

the class RemoteListOpTest method testListMultipleRemotes.

@Test
public void testListMultipleRemotes() {
    final RemoteAddOp remoteAdd = geogig.command(RemoteAddOp.class);
    String remoteName1 = "myremote";
    String remoteURL1 = "http://test.com";
    String remoteName2 = "myremote2";
    String remoteURL2 = "http://test2.org";
    String branch = "mybranch";
    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).setBranch(branch).call();
    assertEquals(remoteName2, remote.getName());
    assertEquals(remoteURL2, remote.getFetchURL());
    assertEquals(remoteURL2, remote.getPushURL());
    assertEquals("+refs/heads/" + branch + ":refs/remotes/" + remoteName2 + "/" + branch, remote.getFetch());
    final RemoteListOp remoteList = geogig.command(RemoteListOp.class);
    ImmutableList<Remote> allRemotes = remoteList.call();
    assertEquals(2, allRemotes.size());
    Remote firstRemote = allRemotes.get(0);
    Remote secondRemote = allRemotes.get(1);
    if (!firstRemote.getName().equals(remoteName1)) {
        // swap first and second
        Remote tempRemote = firstRemote;
        firstRemote = secondRemote;
        secondRemote = tempRemote;
    }
    assertEquals(remoteName1, firstRemote.getName());
    assertEquals(remoteURL1, firstRemote.getFetchURL());
    assertEquals(remoteURL1, firstRemote.getPushURL());
    assertEquals("+refs/heads/*:refs/remotes/" + remoteName1 + "/*", firstRemote.getFetch());
    assertEquals(remoteName2, secondRemote.getName());
    assertEquals(remoteURL2, secondRemote.getFetchURL());
    assertEquals(remoteURL2, secondRemote.getPushURL());
    assertEquals("+refs/heads/" + branch + ":refs/remotes/" + remoteName2 + "/" + branch, secondRemote.getFetch());
}
Also used : RemoteAddOp(org.locationtech.geogig.api.porcelain.RemoteAddOp) Remote(org.locationtech.geogig.api.Remote) RemoteListOp(org.locationtech.geogig.api.porcelain.RemoteListOp) Test(org.junit.Test)

Example 14 with Remote

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

the class RemoteListOpTest method testListNoRemotes.

@Test
public void testListNoRemotes() {
    final RemoteListOp remoteList = geogig.command(RemoteListOp.class);
    ImmutableList<Remote> allRemotes = remoteList.call();
    assertTrue(allRemotes.isEmpty());
}
Also used : Remote(org.locationtech.geogig.api.Remote) RemoteListOp(org.locationtech.geogig.api.porcelain.RemoteListOp) Test(org.junit.Test)

Example 15 with Remote

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

the class RemoteListOpTest method testListRemoteWithNoFetch.

@Test
public void testListRemoteWithNoFetch() {
    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 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

Remote (org.locationtech.geogig.api.Remote)31 Test (org.junit.Test)14 RemoteAddOp (org.locationtech.geogig.api.porcelain.RemoteAddOp)13 IOException (java.io.IOException)8 Ref (org.locationtech.geogig.api.Ref)8 RemoteRemoveOp (org.locationtech.geogig.api.porcelain.RemoteRemoveOp)6 UpdateRef (org.locationtech.geogig.api.plumbing.UpdateRef)5 RemoteException (org.locationtech.geogig.api.porcelain.RemoteException)5 RemoteListOp (org.locationtech.geogig.api.porcelain.RemoteListOp)5 CommandResponse (org.locationtech.geogig.web.api.CommandResponse)5 CommandSpecException (org.locationtech.geogig.web.api.CommandSpecException)5 ResponseWriter (org.locationtech.geogig.web.api.ResponseWriter)5 ConfigOp (org.locationtech.geogig.api.porcelain.ConfigOp)4 IRemoteRepo (org.locationtech.geogig.remote.IRemoteRepo)4 ConfigDatabase (org.locationtech.geogig.storage.ConfigDatabase)4 SymRef (org.locationtech.geogig.api.SymRef)3 LsRemote (org.locationtech.geogig.api.plumbing.LsRemote)3 ArrayList (java.util.ArrayList)2 ProgressListener (org.locationtech.geogig.api.ProgressListener)2 ChangedRef (org.locationtech.geogig.api.porcelain.TransferSummary.ChangedRef)2