RetrievalWorker implements Runnable { public File getLocalFile() { if (this.localFile == null) { ChunkUtil util = new ChunkUtil(); String contentId = contentItem.getContentId(); if (util.isChunkManifest(contentId)) { contentId = util.preChunkedContentId(contentId); } if (createSpaceDir) { File spaceDir = new File(contentDir, contentItem.getSpaceId()); logger.debug("spaceDir.absolutePath={}", spaceDir.getAbsolutePath()); this.localFile = new File(spaceDir, contentId); } else { this.localFile = new File(contentDir, contentId); } } logger.debug("localFile.absolutePath={}", this.localFile.getAbsolutePath()); return this.localFile; } RetrievalWorker(ContentItem contentItem,
                           RetrievalSource source,
                           File contentDir,
                           boolean overwrite,
                           OutputWriter outWriter,
                           boolean createSpaceDir,
                           boolean applyTimestamps); void run(); Map<String, String> retrieveFile(); Map<String, String> retrieveFile(RetrievalListener listener); File getLocalFile();  }
@Test public void testGetLocalFile() throws Exception { RetrievalWorker worker = createRetrievalWorker(true); File localFile = worker.getLocalFile(); assertNotNull(localFile); assertTrue(localFile.getAbsolutePath().contains(spaceId)); for (String pathElem : contentId.split("/")) { assertTrue(localFile.getAbsolutePath().contains(pathElem)); } worker = createRetrievalWorkerSingleSpace(true); localFile = worker.getLocalFile(); assertNotNull(localFile); assertFalse(localFile.getAbsolutePath().contains(spaceId)); for (String pathElem : contentId.split("/")) { assertTrue(localFile.getAbsolutePath().contains(pathElem)); } }