@Test public void testBrowse() throws Exception { Properties parameters = new Properties(); parameters.setProperty(StorageConnector.FILES_HOME_PATH_PROPERTY, myFileDir.getAbsolutePath()); connector = new FileStorageConnector(parameters); StorageTree<String> structure = connector.browse(); String tree = structure.printTree(); assertTrue(tree.contains(NEW_LINE + FORWARD_SLASH + myFileDir.getName() + NEW_LINE)); assertTrue(tree.contains(NEW_LINE + FORWARD_SLASH + myFileDir.getName() + FORWARD_SLASH + SUB_DIR + NEW_LINE)); assertTrue(tree.contains(NEW_LINE + FORWARD_SLASH + myFileDir.getName() + FORWARD_SLASH + SUB_DIR + FORWARD_SLASH + TEST_VDB_3_XML + NEW_LINE)); assertTrue(tree.contains(NEW_LINE + FORWARD_SLASH + myFileDir.getName() + FORWARD_SLASH + TEST_VDB_XML + NEW_LINE)); }
@Override public StorageTree<String> browse() throws Exception { File dir = new File(getPath()); StorageTree<String> storageTree = new StorageTree<String>(); if (! dir.isDirectory()) return storageTree; StorageNode<String> node = storageTree.addChild(dir.getName()); walk(node, dir); return storageTree; }
FileStorageConnector implements StorageConnector { @Override public StorageTree<String> browse() throws Exception { File dir = new File(getPath()); StorageTree<String> storageTree = new StorageTree<String>(); if (! dir.isDirectory()) return storageTree; StorageNode<String> node = storageTree.addChild(dir.getName()); walk(node, dir); return storageTree; } }
FileStorageConnector implements StorageConnector { @Override public StorageTree<String> browse() throws Exception { File dir = new File(getPath()); StorageTree<String> storageTree = new StorageTree<String>(); if (! dir.isDirectory()) return storageTree; StorageNode<String> node = storageTree.addChild(dir.getName()); walk(node, dir); return storageTree; } FileStorageConnector(Properties parameters); }
FileStorageConnector implements StorageConnector { @Override public StorageTree<String> browse() throws Exception { File dir = new File(getPath()); StorageTree<String> storageTree = new StorageTree<String>(); if (! dir.isDirectory()) return storageTree; StorageNode<String> node = storageTree.addChild(dir.getName()); walk(node, dir); return storageTree; } FileStorageConnector(Properties parameters); @Override StorageConnectorId getId(); @Override Set<Descriptor> getDescriptors(); String getPath(); String getFilePath(Properties parameters); @Override InputStream read(Properties parameters); @Override void write(Exportable artifact, UnitOfWork transaction, Properties parameters); @Override boolean refresh(); @Override StorageTree<String> browse(); @Override void dispose(); }
FileStorageConnector implements StorageConnector { @Override public StorageTree<String> browse() throws Exception { File dir = new File(getPath()); StorageTree<String> storageTree = new StorageTree<String>(); if (! dir.isDirectory()) return storageTree; StorageNode<String> node = storageTree.addChild(dir.getName()); walk(node, dir); return storageTree; } FileStorageConnector(Properties parameters); @Override StorageConnectorId getId(); @Override Set<Descriptor> getDescriptors(); String getPath(); String getFilePath(Properties parameters); @Override InputStream read(Properties parameters); @Override void write(Exportable artifact, UnitOfWork transaction, Properties parameters); @Override boolean refresh(); @Override StorageTree<String> browse(); @Override void dispose();  }