@Test(groups = {"unit"}) public void shouldReadFromPathNotFound() throws Exception { when(operations.readColumnsAsMap(rowKey, "a/b/c/", getFinishString("a/b/c/"), Integer.MAX_VALUE, false)).thenReturn(Collections.<String,Object>emptyMap()); TestPojo result = dao.readFromPath(rowKey, path, typeReference); assertNull(result); }
@Override public <T> T readFromPath(K rowKey, Path path, TypeReference<T> type) { validateArgs(rowKey, path); int count = Integer.MAX_VALUE; boolean reversed = false; String start = path.toString(); String finish = getFinishString(start); Map<String,Object> columnsMap = operations.readColumnsAsMap(rowKey, start, finish, count, reversed); if (columnsMap.isEmpty()) { return null; } Map<Path,Object> pathMap = getTerminalPathMap(path, columnsMap); Object structure = Composer.get().compose(pathMap); return readMapper.convertValue(structure, new JacksonTypeReference<T>(type)); }
ThriftStructuredDataSupport extends AbstractThriftStructuredDataSupport<K> { @Override public <T> T readFromPath(K rowKey, Path path, TypeReference<T> type) { validateArgs(rowKey, path); int count = Integer.MAX_VALUE; boolean reversed = false; String start = path.toString(); String finish = getFinishString(start); Map<String,Object> columnsMap = operations.readColumnsAsMap(rowKey, start, finish, count, reversed); if (columnsMap.isEmpty()) { return null; } Map<Path,Object> pathMap = getTerminalPathMap(path, columnsMap); Object structure = Composer.get().compose(pathMap); return readMapper.convertValue(structure, new JacksonTypeReference<T>(type)); } }
ThriftStructuredDataSupport extends AbstractThriftStructuredDataSupport<K> { @Override public <T> T readFromPath(K rowKey, Path path, TypeReference<T> type) { validateArgs(rowKey, path); int count = Integer.MAX_VALUE; boolean reversed = false; String start = path.toString(); String finish = getFinishString(start); Map<String,Object> columnsMap = operations.readColumnsAsMap(rowKey, start, finish, count, reversed); if (columnsMap.isEmpty()) { return null; } Map<Path,Object> pathMap = getTerminalPathMap(path, columnsMap); Object structure = Composer.get().compose(pathMap); return readMapper.convertValue(structure, new JacksonTypeReference<T>(type)); } ThriftStructuredDataSupport(ColumnFamilyOperations<K,String,Object> operations); }
ThriftStructuredDataSupport extends AbstractThriftStructuredDataSupport<K> { @Override public <T> T readFromPath(K rowKey, Path path, TypeReference<T> type) { validateArgs(rowKey, path); int count = Integer.MAX_VALUE; boolean reversed = false; String start = path.toString(); String finish = getFinishString(start); Map<String,Object> columnsMap = operations.readColumnsAsMap(rowKey, start, finish, count, reversed); if (columnsMap.isEmpty()) { return null; } Map<Path,Object> pathMap = getTerminalPathMap(path, columnsMap); Object structure = Composer.get().compose(pathMap); return readMapper.convertValue(structure, new JacksonTypeReference<T>(type)); } ThriftStructuredDataSupport(ColumnFamilyOperations<K,String,Object> operations); @Override BatchContext beginBatch(); @Override void applyBatch(BatchContext batchContext); @Override T readFromPath(K rowKey, Path path, TypeReference<T> type); @Override void writeToPath(K rowKey,
                            Path path,
                            Object value,
                            @Nullable BatchContext batchContext); @Override void deletePath(K rowKey, Path path, @Nullable BatchContext batchContext); }
ThriftStructuredDataSupport extends AbstractThriftStructuredDataSupport<K> { @Override public <T> T readFromPath(K rowKey, Path path, TypeReference<T> type) { validateArgs(rowKey, path); int count = Integer.MAX_VALUE; boolean reversed = false; String start = path.toString(); String finish = getFinishString(start); Map<String,Object> columnsMap = operations.readColumnsAsMap(rowKey, start, finish, count, reversed); if (columnsMap.isEmpty()) { return null; } Map<Path,Object> pathMap = getTerminalPathMap(path, columnsMap); Object structure = Composer.get().compose(pathMap); return readMapper.convertValue(structure, new JacksonTypeReference<T>(type)); } ThriftStructuredDataSupport(ColumnFamilyOperations<K,String,Object> operations); @Override BatchContext beginBatch(); @Override void applyBatch(BatchContext batchContext); @Override T readFromPath(K rowKey, Path path, TypeReference<T> type); @Override void writeToPath(K rowKey,
                            Path path,
                            Object value,
                            @Nullable BatchContext batchContext); @Override void deletePath(K rowKey, Path path, @Nullable BatchContext batchContext);  }