@Test public void testDefault() { test(ConfigScope.DEFAULT); }
@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")); } }
assertEquals("1", result.get("section.string")); assertEquals("2", result.get("section.string")); result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null) .call().or(new HashMap<String, String>()); assertNull(result.get("section.string")); result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null) .call().or(new HashMap<String, String>()); assertNull(result.get("section.string")); assertNull(result.get("section.string")); result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string2").setValue(null) .call().or(new HashMap<String, String>()); assertNull(result.get("section.string2")); assertEquals("1", result.get("section.string")); assertEquals("2", result.get("section.string2"));
@Test public void testEnum() { ConfigAction.values(); assertEquals(ConfigAction.CONFIG_GET, ConfigAction.valueOf("CONFIG_GET")); }
@Test public void testInvalidSectionKey() { final ConfigOp config = geogig.command(ConfigOp.class); Optional<Map<String, String>> result = config.setScope(ConfigScope.GLOBAL) .setAction(ConfigAction.CONFIG_GET).setName("doesnt.exist").setValue(null).call(); assertFalse(result.isPresent()); }
@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")); } }
assertEquals("1", result.get("section.string")); assertEquals("2", result.get("section.string")); result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null) .call().or(new HashMap<String, String>()); assertNull(result.get("section.string")); result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null) .call().or(new HashMap<String, String>()); assertNull(result.get("section.string")); assertNull(result.get("section.string")); result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string2").setValue(null) .call().or(new HashMap<String, String>()); assertNull(result.get("section.string2")); assertEquals("1", result.get("section.string")); assertEquals("2", result.get("section.string2"));
@Test public void testEnum() { ConfigAction.values(); assertEquals(ConfigAction.CONFIG_GET, ConfigAction.valueOf("CONFIG_GET")); }
@Test public void testInvalidSectionKey() { final ConfigOp config = geogig.command(ConfigOp.class); Optional<Map<String, String>> result = config.setScope(ConfigScope.GLOBAL) .setAction(ConfigAction.CONFIG_GET).setName("doesnt.exist").setValue(null).call(); assertFalse(result.isPresent()); }
@Test public void testLocal() { test(ConfigScope.LOCAL); }
@Test public void testGlobal() { test(ConfigScope.GLOBAL); }
@Test public void testDefault() { test(ConfigScope.DEFAULT); }
@Test public void testLocal() { test(ConfigScope.LOCAL); }
@Test public void testGlobal() { test(ConfigScope.GLOBAL); }