1 package jalview.ws.jabaws;
3 import static org.testng.AssertJUnit.assertEquals;
5 import java.util.ArrayList;
8 import org.testng.Assert;
9 import org.testng.annotations.Test;
11 import compbio.data.msa.MsaWS;
12 import compbio.data.msa.RegistryWS;
13 import compbio.data.sequence.FastaSequence;
14 import compbio.metadata.JobStatus;
15 import compbio.ws.client.Jws2Client;
16 import compbio.ws.client.Services;
18 public class MinJabawsClientTests
22 * simple test for the benefit of JAL-1338
25 @SuppressWarnings("rawtypes")
28 public void msaTest() throws Exception {
30 RegistryWS registry = Jws2Client
31 .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws");
32 if (registry != null) {
34 MsaWS msaservice = null;
35 for (Services service : registry.getSupportedServices()) {
36 if (service.equals(Services.ClustalOWS)) {
37 msaservice = (MsaWS) Jws2Client.connect(url, service);
38 if (msaservice != null) {
43 if (msaservice == null) {
44 Assert.fail("couldn't find a clustalO service on the public registry");
46 FastaSequence fsq = new FastaSequence("seqA",
47 "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE");
48 List<FastaSequence> iseqs = new ArrayList<FastaSequence>();
49 for (int i = 0; i < 9; i++) {
50 iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence()
51 + fsq.getSequence().substring(i + 3, i + 3 + i)));
54 String jobid = msaservice.align(iseqs);
63 } catch (InterruptedException q)
67 js = msaservice.getJobStatus(jobid);
68 } while (!js.equals(JobStatus.FAILED)
69 && !js.equals(JobStatus.CANCELLED)
70 && !js.equals(JobStatus.FINISHED));
71 assertEquals("Trial alignment failed. State was " + js.name(), js,
74 "Mismatch in number of input and result sequences - assume alignment service wasn't interacted with correctly",
75 msaservice.getResult(jobid).getSequences().size(),
77 for (FastaSequence t : msaservice.getResult(jobid).getSequences())
79 System.out.println(">" + t.getId());
80 System.out.println(t.getFormattedFasta());
82 // .forEach(new Consumer<FastaSequence>() {
84 // public void accept(FastaSequence t) {
85 // System.out.println(">"+t.getId());
86 // System.out.println(t.getFormattedFasta());