RetrievalManager implements Runnable { public RetrievalManager(RetrievalSource source, File contentDir, File workDir, boolean overwrite, int threads, OutputWriter outWriter, boolean createSpaceDir, boolean applyTimestamps) { logger.info("Starting Retrieval Manager with " + threads + " threads"); this.source = source; this.contentDir = contentDir; this.workDir = workDir; this.overwrite = overwrite; this.outWriter = outWriter; this.createSpaceDir = createSpaceDir; this.applyTimestamps = applyTimestamps; workerPool = new ThreadPoolExecutor(threads, threads, Long.MAX_VALUE, TimeUnit.NANOSECONDS, new SynchronousQueue(), new ThreadPoolExecutor.AbortPolicy()); } RetrievalManager(RetrievalSource source,
                            File contentDir,
                            File workDir,
                            boolean overwrite,
                            int threads,
                            OutputWriter outWriter,
                            boolean createSpaceDir,
                            boolean applyTimestamps); void run(); void shutdown(); boolean isComplete();  }
@Test public void testRetrievalManager() throws Exception { int numTestFiles = 5; OutputWriter outWriter = createMockOutputWriter(); RetrievalSource source = new MockRetrievalSource(numTestFiles); RetrievalManager retManager = new RetrievalManager(source, tempDir, tempDir, false, 1, outWriter, true, false); retManager.run(); File spaceDir = new File(tempDir, spaceId); assertTrue(spaceDir.exists()); assertEquals(numTestFiles, spaceDir.listFiles().length); EasyMock.verify(outWriter); }