Search in sources :

Example 16 with ConfigOp

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

the class ConfigOpTest method testEmptyNameAndValueForGet.

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

Example 17 with ConfigOp

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

the class ConfigOpTest method testFallback.

@Test
public void testFallback() {
    final ConfigOp config = geogig.command(ConfigOp.class);
    // Set a value in global config, then try to get value from local even though
    // we're not in a valid repository
    config.setAction(ConfigAction.CONFIG_SET).setScope(ConfigScope.GLOBAL).setName("section.key").setValue("1").call();
    Optional<Map<String, String>> value = config.setAction(ConfigAction.CONFIG_GET).setScope(ConfigScope.LOCAL).setName("section.key").setValue(null).call();
    assertTrue(value.isPresent());
    assertEquals("1", value.get().get("section.key"));
    value = Optional.absent();
    value = config.setAction(ConfigAction.CONFIG_GET).setScope(ConfigScope.LOCAL).setName("section.key").setValue("").call();
    assertTrue(value.isPresent());
    assertEquals("1", value.get().get("section.key"));
}
Also used : ConfigOp(org.locationtech.geogig.api.porcelain.ConfigOp) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 18 with ConfigOp

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

the class ConfigOpTest method testNoNameForUnset.

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

Example 19 with ConfigOp

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

the class ConfigOpTest method testNoNameForSet.

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

Example 20 with ConfigOp

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

the class ConfigOpTest method testEmptyNameForRemoveSection.

@Test
public void testEmptyNameForRemoveSection() {
    final ConfigOp config = geogig.command(ConfigOp.class);
    exception.expect(ConfigException.class);
    config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_REMOVE_SECTION).setName("").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