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