@Test public void testReadNoExistedRow() { Set<String> fields = Collections.singleton("field0"); HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>(); insertToDatabase(); Status readStatus = myClient.read(TEST_TABLE, "Missing row", fields, result); assertEquals(readStatus, Status.ERROR); assertEquals(result.size(), 0); }
public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { Object rowKey = makeRowKey(key); String containerKey = makeContainerKey(key); final Container<Object, Row> container = store.getContainer(containerKey); if(container == null) { LOGGER.severe("[ERROR]getCollection " + containerKey + " in read()"); return Status.ERROR; } Row targetRow = container.get(rowKey); if (targetRow == null) { LOGGER.severe("[ERROR]get(rowKey) in read()"); return Status.ERROR; } for (int i = 1; i < containerInfo.getColumnCount(); i++) { result.put(containerInfo.getColumnInfo(i).getName(), new ByteArrayByteIterator(targetRow.getValue(i).toString().getBytes())); } return Status.OK; } catch (GSException e) { LOGGER.severe("Exception: " + e.getMessage()); return Status.ERROR; } }
GridDBClient extends site.ycsb.DB { public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { Object rowKey = makeRowKey(key); String containerKey = makeContainerKey(key); final Container<Object, Row> container = store.getContainer(containerKey); if(container == null) { LOGGER.severe("[ERROR]getCollection " + containerKey + " in read()"); return Status.ERROR; } Row targetRow = container.get(rowKey); if (targetRow == null) { LOGGER.severe("[ERROR]get(rowKey) in read()"); return Status.ERROR; } for (int i = 1; i < containerInfo.getColumnCount(); i++) { result.put(containerInfo.getColumnInfo(i).getName(), new ByteArrayByteIterator(targetRow.getValue(i).toString().getBytes())); } return Status.OK; } catch (GSException e) { LOGGER.severe("Exception: " + e.getMessage()); return Status.ERROR; } } }
GridDBClient extends site.ycsb.DB { public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { Object rowKey = makeRowKey(key); String containerKey = makeContainerKey(key); final Container<Object, Row> container = store.getContainer(containerKey); if(container == null) { LOGGER.severe("[ERROR]getCollection " + containerKey + " in read()"); return Status.ERROR; } Row targetRow = container.get(rowKey); if (targetRow == null) { LOGGER.severe("[ERROR]get(rowKey) in read()"); return Status.ERROR; } for (int i = 1; i < containerInfo.getColumnCount(); i++) { result.put(containerInfo.getColumnInfo(i).getName(), new ByteArrayByteIterator(targetRow.getValue(i).toString().getBytes())); } return Status.OK; } catch (GSException e) { LOGGER.severe("Exception: " + e.getMessage()); return Status.ERROR; } }  }
GridDBClient extends site.ycsb.DB { public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { Object rowKey = makeRowKey(key); String containerKey = makeContainerKey(key); final Container<Object, Row> container = store.getContainer(containerKey); if(container == null) { LOGGER.severe("[ERROR]getCollection " + containerKey + " in read()"); return Status.ERROR; } Row targetRow = container.get(rowKey); if (targetRow == null) { LOGGER.severe("[ERROR]get(rowKey) in read()"); return Status.ERROR; } for (int i = 1; i < containerInfo.getColumnCount(); i++) { result.put(containerInfo.getColumnInfo(i).getName(), new ByteArrayByteIterator(targetRow.getValue(i).toString().getBytes())); } return Status.OK; } catch (GSException e) { LOGGER.severe("Exception: " + e.getMessage()); return Status.ERROR; } }  void init(); void cleanup(); Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result); Status scan(String table, String startkey, int recordcount, Set<String> fields,
          Vector<HashMap<String, ByteIterator>> result); Status update(String table, String key, Map<String, ByteIterator> values); Status insert(String table, String key, Map<String, ByteIterator> values); Status delete(String table, String key); }
GridDBClient extends site.ycsb.DB { public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { Object rowKey = makeRowKey(key); String containerKey = makeContainerKey(key); final Container<Object, Row> container = store.getContainer(containerKey); if(container == null) { LOGGER.severe("[ERROR]getCollection " + containerKey + " in read()"); return Status.ERROR; } Row targetRow = container.get(rowKey); if (targetRow == null) { LOGGER.severe("[ERROR]get(rowKey) in read()"); return Status.ERROR; } for (int i = 1; i < containerInfo.getColumnCount(); i++) { result.put(containerInfo.getColumnInfo(i).getName(), new ByteArrayByteIterator(targetRow.getValue(i).toString().getBytes())); } return Status.OK; } catch (GSException e) { LOGGER.severe("Exception: " + e.getMessage()); return Status.ERROR; } }  void init(); void cleanup(); Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result); Status scan(String table, String startkey, int recordcount, Set<String> fields,
          Vector<HashMap<String, ByteIterator>> result); Status update(String table, String key, Map<String, ByteIterator> values); Status insert(String table, String key, Map<String, ByteIterator> values); Status delete(String table, String key); static final String VALUE_COLUMN_NAME_PREFIX; static final int ROW_KEY_COLUMN_POS; static final int DEFAULT_CACHE_CONTAINER_NUM; static final int FIELD_NUM; static final GSType SCHEMA_TYPE; }