X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=testsrc%2Fcompbio%2Fws%2Fclient%2FTestRNAalifoldWS.java;h=fd8fb9be8112df03d0cb9c23878de967b11b75d8;hb=d182b2d2b6ede7c952c6ca5a24b1576c6a194eed;hp=2d392f74f5e5cc4b8e48fb7b84266b7c1c2bf585;hpb=fa61eaad52ffe5ee0db449c3dd9ec5fa67aec43f;p=jabaws.git diff --git a/testsrc/compbio/ws/client/TestRNAalifoldWS.java b/testsrc/compbio/ws/client/TestRNAalifoldWS.java index 2d392f7..fd8fb9b 100644 --- a/testsrc/compbio/ws/client/TestRNAalifoldWS.java +++ b/testsrc/compbio/ws/client/TestRNAalifoldWS.java @@ -1,5 +1,6 @@ -package compbio.ws.client; + package compbio.ws.client; +import compbio.metadata.AllTestSuit; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; @@ -8,6 +9,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.Writer; +import java.io.OutputStreamWriter; import java.net.ConnectException; import java.util.ArrayList; import java.util.List; @@ -17,11 +20,10 @@ import javax.xml.ws.WebServiceException; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import compbio.data.msa.FoldWS; import compbio.data.msa.JABAService; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Alignment; -import compbio.data.structure.FoldWS; -import compbio.data.sequence.RNAstruct; import compbio.data.sequence.ClustalAlignmentUtil; import compbio.data.sequence.ConservationMethod; import compbio.data.sequence.FastaSequence; @@ -37,47 +39,60 @@ 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.RNAalifoldWS; + public class TestRNAalifoldWS { - FoldWS foldws; + SequenceAnnotation foldws; -// @BeforeTest(groups = {AllTestSuit.test_group_webservices}) -// void initConnection() { -// -// try { -// JABAService client = Jws2Client.connect( -// "http://localhost:8080/jabaws", Services.RNAalifoldWS); -// foldws = (FoldWS) client; -// } catch (ConnectException e) { -// e.printStackTrace(); -// fail(e.getMessage()); -// } catch (WebServiceException e) { -// e.printStackTrace(); -// fail(e.getMessage()); -// } -// } + @BeforeTest(groups = {AllTestSuit.test_group_webservices}) + void initConnection() { + + try { + JABAService client = Jws2Client.connect( + "http://localhost:8080/jabaws", Services.RNAalifoldWS); + foldws = (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 testFold() throws FileNotFoundException, IOException, UnknownFileFormatException { - String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() - + File.separator; +// String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() +// + File.separator; Alignment aln = ClustalAlignmentUtil.readClustalFile(new FileInputStream( - CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" - + File.separator + "unfolded_RF00031.aln")); + AllTestSuit.test_input_aln)); + + List fsl = aln.getSequences(); try { - String jobId = foldws.fold(aln); + List> options = new ArrayList>(); + options.add(foldws.getRunnerOptions().getArgumentByOptionName("--mis")); + options.add(foldws.getRunnerOptions().getArgumentByOptionName("-p")); + options.add(foldws.getRunnerOptions().getArgumentByOptionName("--MEA")); + + System.out.println("TestRNAalifoldWS: print options: " + options.toString()); + + String jobId = foldws.customAnalize(fsl, options); System.out.println("J: " + jobId); - RNAstruct result = foldws.getResult(jobId); + ScoreManager result = foldws.getAnnotation(jobId); + System.out.println("fold results: \n" + result.toString()); + + Writer writer = new OutputStreamWriter(System.out); + result.writeOut(writer); + assertNotNull(result); } catch (UnsupportedRuntimeException e) { @@ -92,7 +107,10 @@ public class TestRNAalifoldWS { } catch (ResultNotAvailableException e) { e.printStackTrace(); fail(e.getMessage()); - } + } catch (WrongParameterException e) { + e.printStackTrace(); + fail(e.getMessage()); + } } }