public static boolean containsKey(KeyColumnValueStore store, StaticBuffer key, StoreTransaction txh) throws BackendException { return containsKey(store,key,32,txh); }
public void checkKeys(Set<Integer> removed) throws BackendException { for (int i = 0; i < numKeys; i++) { if (removed.contains(i)) { Assert.assertFalse(KCVSUtil.containsKey(store, KeyValueStoreUtil.getBuffer(i), tx)); } else { Assert.assertTrue(KCVSUtil.containsKey(store, KeyValueStoreUtil.getBuffer(i), tx)); } } }
@Test public void containsKeyReturnsFalseOnNonexistentKey() throws Exception { StaticBuffer key1 = KeyColumnValueStoreUtil.longToByteBuffer(1); Assert.assertFalse(KCVSUtil.containsKey(store, key1, tx)); }
@Test public void containsKeyReturnsTrueOnExtantKey() throws Exception { StaticBuffer key1 = KeyColumnValueStoreUtil.longToByteBuffer(1); Assert.assertFalse(KCVSUtil.containsKey(store, key1, tx)); KeyColumnValueStoreUtil.insert(store, tx, 1, "c", "v"); tx.commit(); tx = startTx(); Assert.assertTrue(KCVSUtil.containsKey(store, key1, tx)); }