/** * Releases all the references for this transaction, but does not close the original * {@link RefDatabase} */ @Override public void close() { refDb.removeAll(this.txNamespace); }
/** * Releases all the references for this transaction, but does not close the original * {@link RefDatabase} */ @Override public void close() { refDb.removeAll(this.txNamespace); }
@Override public Map<String, String> removeAll(String namespace) { Map<String, String> ret = actual.removeAll(namespace); snapshot.removeAll(namespace); return ret; }
@Override public Map<String, String> removeAll(String namespace) { Map<String, String> ret = actual.removeAll(namespace); snapshot.removeAll(namespace); return ret; }
@Override public Map<String, String> removeAll(String namespace) { final String txMappedNamespace = toChangedInternal(namespace); Map<String, String> removed = refDb.removeAll(txMappedNamespace); Map<String, String> external = toExternal(removed); return external; }
@Override public Map<String, String> removeAll(String namespace) { final String txMappedNamespace = toInternal(namespace); Map<String, String> removed = refDb.removeAll(txMappedNamespace); Map<String, String> external = toExternal(removed); return external; }
@Test public void testRemoveAllNullNamespace() { expected.expect(NullPointerException.class); expected.expectMessage("provided namespace is null"); refDb.removeAll(null); }
@Test public void testRemoveAllNullNamespace() { expected.expect(NullPointerException.class); expected.expectMessage("provided namespace is null"); refDb.removeAll(null); }
@Test public void testRemoveAllNamespace() { final String txNamespace1 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace1"); final String txNamespace2 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace2"); final Map<String, String> allrefs = createTestRefs(); Map<String, String> removed; removed = refDb.removeAll(txNamespace1); assertEquals(Maps.filterKeys(allrefs, new Predicate<String>() { @Override public boolean apply(String key) { return key.startsWith(txNamespace1); } }), removed); removed = refDb.removeAll(txNamespace2); assertEquals(Maps.filterKeys(allrefs, new Predicate<String>() { @Override public boolean apply(String key) { return key.startsWith(txNamespace2); } }), removed); }
@Test public void testRemoveAllNamespace() { final String txNamespace1 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace1"); final String txNamespace2 = Ref.append(Ref.TRANSACTIONS_PREFIX, "txnamespace2"); final Map<String, String> allrefs = createTestRefs(); Map<String, String> removed; removed = refDb.removeAll(txNamespace1); assertEquals(Maps.filterKeys(allrefs, new Predicate<String>() { @Override public boolean apply(String key) { return key.startsWith(txNamespace1); } }), removed); removed = refDb.removeAll(txNamespace2); assertEquals(Maps.filterKeys(allrefs, new Predicate<String>() { @Override public boolean apply(String key) { return key.startsWith(txNamespace2); } }), removed); }