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