X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fjabaws%2FMinJabawsClientTests.java;h=145cddfb65141598205594004d7cc7e8e3567f0d;hb=refs%2Fheads%2FJAL-1562_help-documentation-system-refactoring;hp=5c9a192a10d2b58d7c4b568f778dee9292f60239;hpb=971ca3752d1e1139b8fa1c9bd80698e4d83dcab7;p=jalview.git diff --git a/test/jalview/ws/jabaws/MinJabawsClientTests.java b/test/jalview/ws/jabaws/MinJabawsClientTests.java index 5c9a192..145cddf 100644 --- a/test/jalview/ws/jabaws/MinJabawsClientTests.java +++ b/test/jalview/ws/jabaws/MinJabawsClientTests.java @@ -1,18 +1,13 @@ package jalview.ws.jabaws; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.List; -import java.util.function.Consumer; - -import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.jws2.jabaws2.Jws2InstanceFactory; import org.junit.Test; -import compbio.data.msa.Category; -import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.msa.RegistryWS; import compbio.data.sequence.FastaSequence; @@ -22,63 +17,87 @@ import compbio.ws.client.Services; public class MinJabawsClientTests { - @SuppressWarnings("rawtypes") - @Test - public void msaTest() throws Exception { - String url; - RegistryWS registry = Jws2Client - .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws"); - if (registry != null) { + /** + * simple test for the benefit of JAL-1338 + * @throws Exception + */ + @SuppressWarnings("rawtypes") + @Test + public void msaTest() throws Exception { + String url; + RegistryWS registry = Jws2Client + .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws"); + if (registry != null) + { + + MsaWS msaservice = null; + for (Services service : registry.getSupportedServices()) + { + if (service.equals(Services.ClustalOWS)) + { + msaservice = (MsaWS) Jws2Client.connect(url, service); + if (msaservice != null) + { + break; + } + } + } + if (msaservice == null) + { + fail("couldn't find a clustalO service on the public registry"); + } + FastaSequence fsq = new FastaSequence("seqA", + "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE"); + List iseqs = new ArrayList(); + for (int i = 0; i < 9; i++) + { + iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence() + + fsq.getSequence().substring(i + 3, i + 3 + i))); + } - MsaWS msaservice = null; - for (Services service : registry.getSupportedServices()) { - if (service.equals(Services.ClustalOWS)) { - msaservice = (MsaWS) Jws2Client.connect(url, service); - if (msaservice != null) { - break; - } - } - } - if (msaservice == null) { - fail("couldn't find a clustalO service on the public registry"); - } - FastaSequence fsq = new FastaSequence("seqA", - "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE"); - List iseqs = new ArrayList(); - for (int i = 0; i < 9; i++) { - iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence() - + fsq.getSequence().substring(i + 3, i + 3 + i))); - } + String jobid = msaservice.align(iseqs); + if (jobid != null) + { + JobStatus js = null; + do + { + try + { + Thread.sleep(500); + } catch (InterruptedException q) + { + } + ; + js = msaservice.getJobStatus(jobid); + } while (!js.equals(JobStatus.FAILED) + && !js.equals(JobStatus.CANCELLED) + && !js.equals(JobStatus.FINISHED)); + assertEquals("Trial alignment failed. State was " + js.name(), js, + JobStatus.FINISHED); + assertEquals( + "Mismatch in number of input and result sequences - assume alignment service wasn't interacted with correctly", + msaservice.getResult(jobid).getSequences().size(), + iseqs.size()); - String jobid = msaservice.align(iseqs); - if (jobid != null) { - JobStatus js = null; - do { - try { - Thread.sleep(500); - } catch (InterruptedException q) { - } - ; - js = msaservice.getJobStatus(jobid); - } while (!js.equals(JobStatus.FAILED) - && !js.equals(JobStatus.CANCELLED) - && !js.equals(JobStatus.FINISHED)); - assertEquals("Trial alignment failed. State was " + js.name(), - js, JobStatus.FINISHED); - assertEquals( - "Mismatch in number of input and result sequences - assume alignment service wasn't interacted with correctly", - msaservice.getResult(jobid).getSequences().size(), - iseqs.size()); - msaservice.getResult(jobid).getSequences() - .forEach(new Consumer() { - @Override - public void accept(FastaSequence t) { - System.out.println(">"+t.getId()); - System.out.println(t.getFormattedFasta()); - } - }); - } + List fastaSequences = msaservice.getResult(jobid).getSequences(); + for(FastaSequence fastaSequence : fastaSequences){ + System.out.println(">" + fastaSequence.getId()); + System.out.println(fastaSequence.getFormattedFasta()); + } + } - } - } + // msaservice.getResult(jobid).getSequences() + // .forEach(new Consumer() + // { + // @Override + // public void accept(FastaSequence t) + // { + // System.out.println(">" + t.getId()); + // System.out.println(t.getFormattedFasta()); + // } + // }); + } + + } } +