MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / putReadDeleteAtTimestamp

Method putReadDeleteAtTimestamp

test/TestIntegration.java:197–223  ·  view source on GitHub ↗

Write two values to a HBase column and read them back, delete one, and read back the other.

()

Source from the content-addressed store, hash-verified

195 * delete one, and read back the other.
196 */
197 @Test
198 public void putReadDeleteAtTimestamp() throws Exception {
199 client.setFlushInterval(FAST_FLUSH);
200 byte[] t = table.getBytes();
201 byte[] k = "kprd@ts".getBytes();
202 byte[] f = family.getBytes();
203 // Make the qualifier unique to avoid running into HBASE-9879.
204 byte[] q = ("q" + System.currentTimeMillis()
205 + "-" + System.nanoTime()).getBytes();
206 byte[] v1 = "val1".getBytes();
207 byte[] v2 = "val2".getBytes();
208 final PutRequest put1 = new PutRequest(t, k, f, q, v1, 100L);
209 final PutRequest put2 = new PutRequest(t, k, f, q, v2, 200L);
210 client.put(put1).join();
211 client.put(put2).join();
212 final GetRequest get = new GetRequest(t, k, f, q).maxVersions(2);
213 final ArrayList<KeyValue> kvs = client.get(get).join();
214 assertSizeIs(2, kvs);
215 assertEq("val2", kvs.get(0).value());
216 assertEq("val1", kvs.get(1).value());
217 final DeleteRequest del = new DeleteRequest(t, k, f, q, 200L);
218 del.setDeleteAtTimestampOnly(true);
219 client.delete(del).join();
220 final ArrayList<KeyValue> kvs2 = client.get(get).join();
221 assertSizeIs(1, kvs2);
222 assertEq("val1", kvs2.get(0).value());
223 }
224
225 /**
226 * Call Append on a column for the first time and validate that it was

Callers

nothing calls this directly

Calls 9

assertSizeIsMethod · 0.95
assertEqMethod · 0.95
setFlushIntervalMethod · 0.80
putMethod · 0.80
maxVersionsMethod · 0.80
deleteMethod · 0.80
valueMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected