private void waitUntilFinished(BLASTQuery query) throws InterruptedException, ExecutionException { StatusTranslator translator = new StatusTranslator(); BLASTSearchEngine service = getServiceFor(query.getVendorID()); SearchStatus current = service.pollQuery(query.getJobIdentifier()); query.setStatus(translator.translate(current)); while (current.equals(SearchStatus.RUNNING)) { current = service.pollQuery(query.getJobIdentifier()); query.setStatus(translator.translate(current)); Log.i(TAG, current.toString()); } Log.i(TAG, "BLAST search finished. Status of query is " + query.getStatus()); }
public void testSenderSendsAValidQuery() throws InterruptedException, ExecutionException { BLASTQuery query = aValidPendingBLASTQuery(); sender.execute(query); Integer numberSent = sender.get(); assertThat("Expected the number of queries sent to be more than 1", numberSent, is(1)); assertThat( "The BLAST query's identifier should be set", query.getJobIdentifier(), is(not(nullValue()))); }
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); }
private void removeFileFromDisk(BLASTQuery query) { if (context.deleteFile(query.getJobIdentifier() + ".xml")) { Log.i(TAG, "BLAST hits file deleted"); } }