X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=test%2Fjalview%2Fws%2Fjabaws%2FMinJabawsClientTests.java;h=998524a46c262e942b854d6b90fc3a8d6a0b46cb;hb=262f29f7b600e4c8d02461600b5184707192b9c1;hp=b55e8ee552814e65ed05b4ae9ceeb15582c184a2;hpb=5002a0f587ac8f1c18117e29bb4be2754743afc2;p=jalview.git
diff --git a/test/jalview/ws/jabaws/MinJabawsClientTests.java b/test/jalview/ws/jabaws/MinJabawsClientTests.java
index b55e8ee..998524a 100644
--- a/test/jalview/ws/jabaws/MinJabawsClientTests.java
+++ b/test/jalview/ws/jabaws/MinJabawsClientTests.java
@@ -1,12 +1,35 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.jabaws;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertEquals;
+
+import jalview.gui.JvOptionPane;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
import compbio.data.msa.MsaWS;
import compbio.data.msa.RegistryWS;
@@ -15,66 +38,93 @@ import compbio.metadata.JobStatus;
import compbio.ws.client.Jws2Client;
import compbio.ws.client.Services;
-public class MinJabawsClientTests {
+public class MinJabawsClientTests
+{
+
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
- /**
- * 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) {
+ /**
+ * simple test for the benefit of JAL-1338
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("rawtypes")
+ @Test(groups = { "Network" })
+ 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)
+ {
+ Assert.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());
- List seqList = msaservice.getResult(jobid).getSequences();
- for(FastaSequence fSeq : seqList){
- System.out.println(">"+fSeq.getId());
- System.out.println(fSeq.getFormattedFasta());
- }
- }
+ 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());
+ for (FastaSequence t : msaservice.getResult(jobid).getSequences())
+ {
+ System.out.println(">" + t.getId());
+ System.out.println(t.getFormattedFasta());
+ }
+ // .forEach(new Consumer() {
+ // @Override
+ // public void accept(FastaSequence t) {
+ // System.out.println(">"+t.getId());
+ // System.out.println(t.getFormattedFasta());
+ // }
+ // });
+ }
- }
- }
+ }
+ }
}