protected @Override Boolean _call() { Optional<PR> propt = command(PRFindOp.class).setId(id).call(); propt.ifPresent(pr -> { final String section = String.format("pr.%d", id); configDatabase().removeSection(section); Context context = context(); Optional<GeogigTransaction> tx = pr.tryGetTransaction(context); if (tx.isPresent()) { tx.get().abort(); } else { delete(context, pr.getHeadRef()); delete(context, pr.getOriginRef()); } }); return propt.isPresent(); }
config.removeSectionGlobal(name); } else { config.removeSection(name);
remoteMappedBranch.orNull(), remoteUserName.orNull(), remotePassword.orNull()); config.removeSection(remoteSection);
config.removeSectionGlobal(name); } else { config.removeSection(name);
configDatabase().removeSection(remoteSection);
@Test public void testRemoveSection() { // Test integer and string config.put("section1.int", 1); config.put("section1.subsection.string", "2"); config.put("section1.subsection.subsub.int", 1); config.put("section1.subsection.subsub.string", "4"); config.put("section2.int", 3); assertTrue(config.get("section1.subsection.subsub.string").isPresent()); assertTrue(config.get("section1.subsection.subsub.int").isPresent()); config.removeSection("section1.subsection.subsub"); assertFalse(config.get("section1.subsection.subsub.string").isPresent()); assertFalse(config.get("section1.subsection.subsub.int").isPresent()); assertTrue(config.get("section1.int").isPresent()); config.removeSection("section1"); assertFalse(config.get("section1.int").isPresent()); }
@Test public void testRemoveSection() { // Test integer and string config.put("section1.int", 1); config.put("section1.subsection.string", "2"); config.put("section1.subsection.subsub.int", 1); config.put("section1.subsection.subsub.string", "4"); config.put("section2.int", 3); assertTrue(config.get("section1.subsection.subsub.string").isPresent()); assertTrue(config.get("section1.subsection.subsub.int").isPresent()); config.removeSection("section1.subsection.subsub"); assertFalse(config.get("section1.subsection.subsub.string").isPresent()); assertFalse(config.get("section1.subsection.subsub.int").isPresent()); assertTrue(config.get("section1.int").isPresent()); config.removeSection("section1"); assertFalse(config.get("section1.int").isPresent()); }
@Test public void testGlobalOnly() { ConfigDatabase globalOnly = IniFileConfigDatabase.globalOnly(platform); testGlobalOnly(() -> globalOnly.get("section.key")); testGlobalOnly(() -> globalOnly.getAll()); testGlobalOnly(() -> globalOnly.get("section.key", String.class)); testGlobalOnly(() -> globalOnly.getAllSection("section")); testGlobalOnly(() -> globalOnly.getAllSubsections("section.sub")); testGlobalOnly(() -> globalOnly.put("section.key", "val")); testGlobalOnly(() -> globalOnly.remove("section.key")); testGlobalOnly(() -> globalOnly.removeSection("section")); }
@Test public void testGlobalOnly() { ConfigDatabase globalOnly = IniFileConfigDatabase.globalOnly(platform); testGlobalOnly(() -> globalOnly.get("section.key")); testGlobalOnly(() -> globalOnly.getAll()); testGlobalOnly(() -> globalOnly.get("section.key", String.class)); testGlobalOnly(() -> globalOnly.getAllSection("section")); testGlobalOnly(() -> globalOnly.getAllSubsections("section.sub")); testGlobalOnly(() -> globalOnly.put("section.key", "val")); testGlobalOnly(() -> globalOnly.remove("section.key")); testGlobalOnly(() -> globalOnly.removeSection("section")); }