@Test public void insertingGettingAndDeletingSimpleDataWorks() throws Exception { TransactionHandle txn = manager.beginTransaction(); KeyColumnValueStoreUtil.insert(store, txn, 0, "col0", "val0"); KeyColumnValueStoreUtil.insert(store, txn, 0, "col1", "val1"); txn.commit(); txn = manager.beginTransaction(); assertEquals("val0", KeyColumnValueStoreUtil.get(store, txn, 0, "col0")); assertEquals("val1", KeyColumnValueStoreUtil.get(store, txn, 0, "col1")); KeyColumnValueStoreUtil.delete(store, txn, 0, "col0"); KeyColumnValueStoreUtil.delete(store, txn, 0, "col1"); txn.commit(); txn = manager.beginTransaction(); assertEquals(null, KeyColumnValueStoreUtil.get(store, txn, 0, "col0")); assertEquals(null, KeyColumnValueStoreUtil.get(store, txn, 0, "col1")); txn.commit(); }
@Test public void containsKeyColumnReturnsTrueOnExtantInput() throws Exception { TransactionHandle txn = manager.beginTransaction(); KeyColumnValueStoreUtil.insert(store, txn, 1, "c", "v"); txn.commit(); txn = manager.beginTransaction(); ByteBuffer key1 = KeyColumnValueStoreUtil.longToByteBuffer(1); ByteBuffer c = KeyColumnValueStoreUtil.stringToByteBuffer("c"); assertTrue(store.containsKeyColumn(key1.duplicate(), c.duplicate(), txn)); txn.commit(); }