public void testWeCannotDownloadResultsIfThereIsNoWebConnection() throws InterruptedException, ExecutionException { BLASTQuery query = BLASTQueryBuilder.aValidPendingBLASTQuery(); BLASTHitsLoaderTask downloader = new BLASTHitsLoaderTask(context, getServiceFor(query.getVendorID())) { protected boolean connectedToWeb() { return false; } }; downloader.execute(query); String nameOfFile = downloader.get(); assertNull("Name of file with BLAST hits", nameOfFile); }
public void testWeCanDownloadResultsOfAFINISHEDEMBLQuery() throws InterruptedException, ExecutionException { BLASTQuery emblQuery = BLASTQueryBuilder.validPendingEMBLBLASTQuery(); save(emblQuery); SendBLASTQuery.sendToEBIEMBL(context, emblQuery); waitUntilFinished(emblQuery); BLASTHitsLoaderTask downloader = new BLASTHitsLoaderTask(context, getServiceFor(emblQuery.getVendorID())); downloader.execute(emblQuery); String nameOfFile = downloader.get(); assertNotNull("Name of file with BLAST hits being non-nulled: " + nameOfFile, nameOfFile); assertFileOnDisk(String.format("%s.xml", emblQuery.getJobIdentifier())); removeFileFromDisk(emblQuery); }