use of site.ycsb.ByteIterator in project YCSB by brianfrankcooper.
the class RestClientTest method read_404.
// Not found error.
@Test
public void read_404() {
HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
Status status = rc.read(null, ABSENT_RESOURCE, null, result);
assertEquals(Status.NOT_FOUND, status);
}
use of site.ycsb.ByteIterator in project YCSB by brianfrankcooper.
the class RestClientTest method read_403.
// Unauthorized request error.
@Test
public void read_403() {
HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
Status status = rc.read(null, UNAUTHORIZED_RESOURCE, null, result);
assertEquals(Status.FORBIDDEN, status);
}
use of site.ycsb.ByteIterator in project YCSB by brianfrankcooper.
the class RestClientTest method update_500.
@Test
public void update_500() {
HashMap<String, ByteIterator> data = new HashMap<String, ByteIterator>();
data.put(DATA_TAG, new StringByteIterator(INPUT_DATA));
Status status = rc.update(null, INVALID_RESOURCE, data);
assertEquals(Status.ERROR, status);
}
use of site.ycsb.ByteIterator in project YCSB by brianfrankcooper.
the class RadosClientTest method compareMap.
private void compareMap(HashMap<String, ByteIterator> src, HashMap<String, ByteIterator> dest) {
assertEquals(src.size(), dest.size());
Set setSrc = src.entrySet();
Iterator<Map.Entry> itSrc = setSrc.iterator();
for (int i = 0; i < 10; i++) {
Map.Entry<String, ByteIterator> entrySrc = itSrc.next();
assertEquals(entrySrc.getValue().toString(), dest.get(entrySrc.getKey()).toString());
}
}
use of site.ycsb.ByteIterator in project YCSB by brianfrankcooper.
the class HBaseClient1Test method testScan.
@Test
public void testScan() throws Exception {
// Fill with data
final String colStr = "row_number";
final byte[] col = Bytes.toBytes(colStr);
final int n = 10;
final List<Put> puts = new ArrayList<Put>(n);
for (int i = 0; i < n; i++) {
final byte[] key = Bytes.toBytes(String.format("%05d", i));
final byte[] value = java.nio.ByteBuffer.allocate(4).putInt(i).array();
final Put p = new Put(key);
p.addColumn(Bytes.toBytes(COLUMN_FAMILY), col, value);
puts.add(p);
}
table.put(puts);
// Test
final Vector<HashMap<String, ByteIterator>> result = new Vector<HashMap<String, ByteIterator>>();
// Scan 5 records, skipping the first
client.scan(tableName, "00001", 5, null, result);
assertEquals(5, result.size());
for (int i = 0; i < 5; i++) {
final HashMap<String, ByteIterator> row = result.get(i);
assertEquals(1, row.size());
assertTrue(row.containsKey(colStr));
final byte[] bytes = row.get(colStr).toArray();
final ByteBuffer buf = ByteBuffer.wrap(bytes);
final int rowNum = buf.getInt();
assertEquals(i + 1, rowNum);
}
}
Aggregations