From: jprocter Date: Thu, 2 Aug 2012 11:46:51 +0000 (+0100) Subject: JWS-47 new customAnalize test for IUPredWS - with several unaligned sequences of... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2ccf319191155419dc119567e5d4e5ac4c3dc84f;p=jabaws.git JWS-47 new customAnalize test for IUPredWS - with several unaligned sequences of different lengths. --- diff --git a/testsrc/compbio/ws/client/TestIUPredWS.java b/testsrc/compbio/ws/client/TestIUPredWS.java new file mode 100644 index 0000000..56533fa --- /dev/null +++ b/testsrc/compbio/ws/client/TestIUPredWS.java @@ -0,0 +1,105 @@ +package compbio.ws.client; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.ConnectException; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.ws.WebServiceException; + +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import compbio.data.msa.JABAService; +import compbio.data.msa.SequenceAnnotation; +import compbio.data.sequence.ConservationMethod; +import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.ScoreManager; +import compbio.data.sequence.SequenceUtil; +import compbio.metadata.AllTestSuit; +import compbio.metadata.JobSubmissionException; +import compbio.metadata.LimitExceededException; +import compbio.metadata.Option; +import compbio.metadata.PresetManager; +import compbio.metadata.ResultNotAvailableException; +import compbio.metadata.RunnerConfig; +import compbio.metadata.UnsupportedRuntimeException; +import compbio.metadata.WrongParameterException; +import compbio.runner.conservation.AACon; +import compbio.util.SysPrefs; +import compbio.ws.server.IUPredWS; + +public class TestIUPredWS { + + SequenceAnnotation msaws; + + @BeforeTest(groups = {AllTestSuit.test_group_webservices}) + void initConnection() { + /* + * URL url = null; try { url = new + * URL("http://localhost:8080/jabaws/AAConWS?wsdl"); } catch + * (MalformedURLException e) { e.printStackTrace(); + * fail(e.getLocalizedMessage()); } String namespace = + * "http://msa.data.compbio/01/12/2010/"; QName qname = new + * QName(namespace, "AAConWS"); Service serv = Service.create(url, + * qname); msaws = serv.getPort(new QName(namespace, "AAConWSPort"), + * Annotation.class); + */try { + JABAService client = Jws2Client.connect( + "http://localhost:18080/jaba", Services.IUPredWS); + msaws = (SequenceAnnotation) client; + } catch (ConnectException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (WebServiceException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + @Test(groups = {AllTestSuit.test_group_webservices}) + public void testCustomAnalize() throws FileNotFoundException, IOException { + + String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + + File.separator; + + List fsl = SequenceUtil.readFasta(new FileInputStream( + CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" + + File.separator + "TO1381.fasta")); + + try { + List> opts=new ArrayList>(); + opts.add(msaws.getRunnerOptions().getArgumentByOptionName("Long")); + + String jobId = msaws.customAnalize(fsl,opts); + System.out.println("J: " + jobId); + ScoreManager result = msaws.getAnnotation(jobId); + assertNotNull(result); +// assertEquals(result.asSet().size(), 1); + + } catch (UnsupportedRuntimeException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (LimitExceededException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (ResultNotAvailableException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (WrongParameterException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + + } +}