@Test(expectedExceptions = { IndexingException.class }) public void noDescriptorFromTree() throws IndexingException { DefaultData defaultData = mock(DefaultData.class); when(indexingTree.put(defaultData)).thenReturn(null); indexingTreeHandler.startWrite(storageWriter.new WriteTask(defaultData, null)); }
public int startWrite(WriteTask writeTask) throws IndexingException { DefaultData data = writeTask.getData(); if (null == data) { throw new IndexingException("Indexing failed. Data to index was null."); } TreeDescriptorPair treeDescriptorPair = new TreeDescriptorPair(); writeTasksInProcess.put(writeTask, treeDescriptorPair); IStorageTreeComponent<DefaultData> indexingTree = storageIndexingTreeReference.get(); IStorageDescriptor storageDescriptor = indexingTree.put(data); if (null == storageDescriptor) { throw new IndexingException("Indexing failed. Storage descriptor was null."); } treeDescriptorPair.setIndexingTree(indexingTree); treeDescriptorPair.setStorageDescriptor(storageDescriptor); return storageDescriptor.getChannelId(); }
StorageIndexingTreeHandler { public int startWrite(WriteTask writeTask) throws IndexingException { DefaultData data = writeTask.getData(); if (null == data) { throw new IndexingException("Indexing failed. Data to index was null."); } TreeDescriptorPair treeDescriptorPair = new TreeDescriptorPair(); writeTasksInProcess.put(writeTask, treeDescriptorPair); IStorageTreeComponent<DefaultData> indexingTree = storageIndexingTreeReference.get(); IStorageDescriptor storageDescriptor = indexingTree.put(data); if (null == storageDescriptor) { throw new IndexingException("Indexing failed. Storage descriptor was null."); } treeDescriptorPair.setIndexingTree(indexingTree); treeDescriptorPair.setStorageDescriptor(storageDescriptor); return storageDescriptor.getChannelId(); } }
StorageIndexingTreeHandler { public int startWrite(WriteTask writeTask) throws IndexingException { DefaultData data = writeTask.getData(); if (null == data) { throw new IndexingException("Indexing failed. Data to index was null."); } TreeDescriptorPair treeDescriptorPair = new TreeDescriptorPair(); writeTasksInProcess.put(writeTask, treeDescriptorPair); IStorageTreeComponent<DefaultData> indexingTree = storageIndexingTreeReference.get(); IStorageDescriptor storageDescriptor = indexingTree.put(data); if (null == storageDescriptor) { throw new IndexingException("Indexing failed. Storage descriptor was null."); } treeDescriptorPair.setIndexingTree(indexingTree); treeDescriptorPair.setStorageDescriptor(storageDescriptor); return storageDescriptor.getChannelId(); }  }
StorageIndexingTreeHandler { public int startWrite(WriteTask writeTask) throws IndexingException { DefaultData data = writeTask.getData(); if (null == data) { throw new IndexingException("Indexing failed. Data to index was null."); } TreeDescriptorPair treeDescriptorPair = new TreeDescriptorPair(); writeTasksInProcess.put(writeTask, treeDescriptorPair); IStorageTreeComponent<DefaultData> indexingTree = storageIndexingTreeReference.get(); IStorageDescriptor storageDescriptor = indexingTree.put(data); if (null == storageDescriptor) { throw new IndexingException("Indexing failed. Storage descriptor was null."); } treeDescriptorPair.setIndexingTree(indexingTree); treeDescriptorPair.setStorageDescriptor(storageDescriptor); return storageDescriptor.getChannelId(); }  void prepare(); int startWrite(WriteTask writeTask); void writeSuccessful(WriteTask writeTask, long position, long size); void writeFailed(WriteTask writeTask); void cancelIndexingTreeSavingFuture(); void finish(); void registerStorageWriter(StorageWriter storageWriter); }
StorageIndexingTreeHandler { public int startWrite(WriteTask writeTask) throws IndexingException { DefaultData data = writeTask.getData(); if (null == data) { throw new IndexingException("Indexing failed. Data to index was null."); } TreeDescriptorPair treeDescriptorPair = new TreeDescriptorPair(); writeTasksInProcess.put(writeTask, treeDescriptorPair); IStorageTreeComponent<DefaultData> indexingTree = storageIndexingTreeReference.get(); IStorageDescriptor storageDescriptor = indexingTree.put(data); if (null == storageDescriptor) { throw new IndexingException("Indexing failed. Storage descriptor was null."); } treeDescriptorPair.setIndexingTree(indexingTree); treeDescriptorPair.setStorageDescriptor(storageDescriptor); return storageDescriptor.getChannelId(); }  void prepare(); int startWrite(WriteTask writeTask); void writeSuccessful(WriteTask writeTask, long position, long size); void writeFailed(WriteTask writeTask); void cancelIndexingTreeSavingFuture(); void finish(); void registerStorageWriter(StorageWriter storageWriter);  }