Search in sources :

Example 11 with ConfigOp

use of org.locationtech.geogig.api.porcelain.ConfigOp 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 12 with ConfigOp

use of org.locationtech.geogig.api.porcelain.ConfigOp 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)

Example 13 with ConfigOp

use of org.locationtech.geogig.api.porcelain.ConfigOp 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)

Example 14 with ConfigOp

use of org.locationtech.geogig.api.porcelain.ConfigOp 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)

Example 15 with ConfigOp

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

the class ConfigOpTest method testEmptyNameAndValueForSet.

@Test
public void testEmptyNameAndValueForSet() {
    final ConfigOp config = geogig.command(ConfigOp.class);
    exception.expect(ConfigException.class);
    config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_SET).setName("").setValue("").call();
}
Also used : ConfigOp(org.locationtech.geogig.api.porcelain.ConfigOp) Test(org.junit.Test)

Aggregations

ConfigOp (org.locationtech.geogig.api.porcelain.ConfigOp)22 Test (org.junit.Test)21 Remote (org.locationtech.geogig.api.Remote)4 ConfigException (org.locationtech.geogig.api.porcelain.ConfigException)4 RemoteAddOp (org.locationtech.geogig.api.porcelain.RemoteAddOp)4 ConfigDatabase (org.locationtech.geogig.storage.ConfigDatabase)4 HashMap (java.util.HashMap)3 Map (java.util.Map)2 RemoteListOp (org.locationtech.geogig.api.porcelain.RemoteListOp)2 RemoteRemoveOp (org.locationtech.geogig.api.porcelain.RemoteRemoveOp)2 Matchers.anyString (org.mockito.Matchers.anyString)1