X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fjabaws%2FJpredJabaStructExportImport.java;h=d5b6ed118f621d6324ee3e7e7948f72cd0bf2b08;hb=2ca081eebf90c6731cd79bde140ca2fecc9c9644;hp=a21cfeb4bb4dbd33d23a2491a4ae571a2dc7e7e9;hpb=9d40dad63906695a693c749f9c95377491eb71bd;p=jalview.git diff --git a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java index a21cfeb..d5b6ed1 100644 --- a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java +++ b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java @@ -25,41 +25,34 @@ import static org.testng.AssertJUnit.assertTrue; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; -import jalview.gui.AlignFrame; import jalview.gui.Jalview2XML; import jalview.gui.JvOptionPane; import jalview.io.AnnotationFile; import jalview.io.DataSourceType; import jalview.io.FileFormat; -import jalview.io.FileLoader; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; import jalview.ws.jws2.JPred301Client; import jalview.ws.jws2.JabaParamStore; +import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.SequenceAnnotationWSClient; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.AutoCalcSetting; import java.awt.Component; -import java.net.ConnectException; import java.util.ArrayList; import java.util.List; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.xml.ws.WebServiceException; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import compbio.data.msa.Category; -import compbio.data.msa.JABAService; import compbio.metadata.Argument; import compbio.metadata.WrongParameterException; -import compbio.ws.client.Jws2Client; -import compbio.ws.client.Services; public class JpredJabaStructExportImport { @@ -71,56 +64,36 @@ public class JpredJabaStructExportImport JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); } - private static String testseqs = "examples/uniref50.fa"; + public static String testseqs = "examples/uniref50.fa"; - private static Jws2Instance jpredws; + public static Jws2Discoverer disc; - private static AlignFrame af = null; + public static Jws2Instance jpredws; + + jalview.ws.jws2.JPred301Client jpredClient; + + public static jalview.gui.AlignFrame af = null; @BeforeClass(alwaysRun = true) - public static void setUpBeforeClass() throws ConnectException, - WebServiceException + public static void setUpBeforeClass() throws Exception { Cache.loadProperties("test/jalview/io/testProps.jvprops"); - Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", - Boolean.TRUE.toString()); - Cache.applicationProperties.setProperty("SHOW_QUALITY", - Boolean.FALSE.toString()); - Cache.applicationProperties.setProperty("SHOW_CONSERVATION", - Boolean.FALSE.toString()); - Cache.applicationProperties.setProperty("SHOW_IDENTITY", - Boolean.FALSE.toString()); Cache.initLogger(); - getJabaws(); + disc = JalviewJabawsTestUtils.getJabawsDiscoverer(false); - FileLoader fl = new FileLoader(false); - af = fl.LoadFileWaitTillLoaded(testseqs, DataSourceType.FILE); - assertNotNull("Couldn't load test data ('" + testseqs + "')", af); - } - - /** - * @throws WebServiceException - * @throws ConnectException - * - */ - static void getJabaws() throws ConnectException, WebServiceException - { - String jabaws = "http://www.compbio.dundee.ac.uk/jabaws"; - JABAService service = null; - for (Category category : Category.getCategories()) + for (Jws2Instance svc : disc.getServices()) { - for (Services srv : category.getServices()) + if (svc.getServiceTypeURI().toLowerCase().contains("jpred")) { - if ("JpredWS".equals(srv.name())) - { - service = Jws2Client.connect(jabaws, srv); - } + jpredws = svc; } } - jpredws = new Jws2Instance(jabaws, "JpredWs", - "Secondary Structure Prediction", - "SERVICE: JpredWS version 3.0.3", service); + + System.out.println("State of jpredws: " + jpredws); Assert.assertNotNull(jpredws, "jpredws is null!"); + jalview.io.FileLoader fl = new jalview.io.FileLoader(false); + af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.DataSourceType.FILE); + assertNotNull("Couldn't load test data ('" + testseqs + "')", af); } @AfterClass(alwaysRun = true) @@ -133,7 +106,7 @@ public class JpredJabaStructExportImport } } - @Test(groups = { "Network" }) + @Test(groups = { "Functional" }) public void testJPredStructOneSeqOnly() { af.selectAllSequenceMenuItem_actionPerformed(null); @@ -143,7 +116,7 @@ public class JpredJabaStructExportImport af.getViewport().getSelectionGroup().getSequenceAt(0), false); af.hideSelSequences_actionPerformed(null); - JPred301Client jpredClient = new JPred301Client(jpredws, af, null, null); + jpredClient = new JPred301Client(jpredws, af, null, null); assertTrue( "Didn't find any default args to check for. Buggy implementation of hardwired arguments in client.", @@ -185,16 +158,11 @@ public class JpredJabaStructExportImport } - /* - * test disabled pending completion of JAL-1601 - * (JPred301Client is currently hidden in Jalview in - * - */ - @Test(groups = { "Network" }) - public void testJPredStructExport() throws InterruptedException + @Test(groups = { "Functional" }) + public void testJPredStructExport() { - JPred301Client jpredClient = new JPred301Client(jpredws, af, null, null); + jpredClient = new JPred301Client(jpredws, af, null, null); af.getViewport().getCalcManager().startWorker(jpredClient); @@ -209,24 +177,18 @@ public class JpredJabaStructExportImport ; } while (af.getViewport().getCalcManager().isWorking()); - synchronized (this) - { - wait(2000); - } AlignmentI orig_alig = af.getViewport().getAlignment(); - System.out.println("Alignment now has " - + orig_alig.getAlignmentAnnotation().length + " annotations"); - verifyAnnotationFileIO("Testing JPredWS Annotation IO", orig_alig); + + testAnnotationFileIO("Testing JPredWS Annotation IO", orig_alig); } - protected static void verifyAnnotationFileIO(String testname, - AlignmentI al) + public static void testAnnotationFileIO(String testname, AlignmentI al) { try { // what format would be appropriate for RNAalifold annotations? - String aligfileout = FileFormat.Fasta.getWriter(null).print( + String aligfileout = FileFormat.Pfam.getWriter(null).print( al.getSequencesArray(), true); String anfileout = new AnnotationFile() @@ -261,16 +223,16 @@ public class JpredJabaStructExportImport } catch (Exception e) { e.printStackTrace(); - Assert.fail("Test " - + testname - + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } + Assert.fail("Test " + + testname + + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } - @Test(groups = { "Network" }, enabled = false) + @Test(groups = { "Functional" }) public void testJpredwsSettingsRecovery() { - Assert.fail("not implemented"); + Assert.fail("not implemnented"); List opts = new ArrayList(); for (compbio.metadata.Argument rg : (List) jpredws .getRunnerConfig().getArguments()) @@ -292,7 +254,7 @@ public class JpredJabaStructExportImport opts.add(rg); } } - JPred301Client jpredClient = new JPred301Client(jpredws, af, null, opts); + jpredClient = new JPred301Client(jpredws, af, null, opts); af.getViewport().getCalcManager().startWorker(jpredClient);