### Question:
LocalControlConsole implements HostControlConsole { @Override public List<String> cacheFiles(List<? extends FileBlob> blobs) { ensureRunning(); List<String> result = new ArrayList<String>(); for(FileBlob blob: blobs) { result.add(cacheFile(blob)); } return result; } LocalControlConsole();  LocalControlConsole(String tmpDir); @Override boolean isLocalFileSystem(); @Override String cacheFile(FileBlob blob); @Override List<String> cacheFiles(List<? extends FileBlob> blobs); @Override Destroyable openSocket(SocketHandler handler); @Override Destroyable startProcess(String workingDir, String[] command, Map<String, String> env, ProcessHandler handler); @Override void terminate(); File getCacheDir();  }### Answer:
@Test public void verify_bulk_file_transfer_parallel() { int fileCount = 100; List<ByteBlob> blobs = new ArrayList<ByteBlob>(); List<String> paths = new ArrayList<String>(); for(int i = 0; i != fileCount; ++i) { ByteBlob blob = new ByteBlob("test-blob-" + i, generateData(i)); blobs.add(blob); } paths.addAll(console.cacheFiles(blobs)); for(int i = 0; i != fileCount; ++i) { String path = paths.get(i); assertTrue(new File(path).isFile()); assertEquals("File size ", (30 << 10) + i, new File(path).length()); } }
@Test public void verify_bulk_transfer_half_cached_parallel() { int fileCount = 100; List<ByteBlob> blobs = new ArrayList<ByteBlob>(); List<String> paths = new ArrayList<String>(); for(int i = 0; i != fileCount; ++i) { if (i % 2 == 0) { ByteBlob blob = new ByteBlob("test-blob-" + i, generateData(i)); blobs.add(blob); } } console.cacheFiles(blobs); blobs.clear(); for(int i = 0; i != fileCount; ++i) { ByteBlob blob = new ByteBlob("test-blob-" + i, generateData(i)); blobs.add(blob); } paths.addAll(console.cacheFiles(blobs)); for(int i = 0; i != fileCount; ++i) { String path = paths.get(i); assertTrue(new File(path).isFile()); assertEquals("File size ", (30 << 10) + i, new File(path).length()); } }