X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fjabaws%2FJpredJabaStructExportImport.java;h=dc157e222a8712f56a21edabe004445fb3ece7ff;hb=cd126a7085c5ebcfc8c05378c71bd862abc4fd91;hp=f47e542f16d80965c7f708aa5ac02e1b0e6e025c;hpb=c4ec878c9cb59fc40a88ed8ecdf5fda46f3de111;p=jalview.git diff --git a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java index f47e542..dc157e2 100644 --- a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java +++ b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,12 +20,16 @@ */ package jalview.ws.jabaws; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; + +import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.gui.Jalview2XML; +import jalview.gui.JvOptionPane; import jalview.io.AnnotationFile; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; import jalview.ws.jws2.JPred301Client; @@ -33,7 +37,6 @@ 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.ArgumentI; import jalview.ws.params.AutoCalcSetting; import java.awt.Component; @@ -43,15 +46,25 @@ import java.util.List; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeGroups; +import org.testng.annotations.Test; import compbio.metadata.Argument; import compbio.metadata.WrongParameterException; public class JpredJabaStructExportImport { + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + public static String testseqs = "examples/uniref50.fa"; public static Jws2Discoverer disc; @@ -62,16 +75,15 @@ public class JpredJabaStructExportImport public static jalview.gui.AlignFrame af = null; - @BeforeClass + @BeforeGroups(groups = { "Network" }) public static void setUpBeforeClass() throws Exception { - - jalview.bin.Cache.initLogger(); + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Cache.initLogger(); disc = JalviewJabawsTestUtils.getJabawsDiscoverer(false); for (Jws2Instance svc : disc.getServices()) { - if (svc.getServiceTypeURI().toLowerCase().contains("jpred")) { jpredws = svc; @@ -79,19 +91,13 @@ public class JpredJabaStructExportImport } System.out.println("State of jpredws: " + jpredws); - - if (jpredws == null) - System.exit(0); - + Assert.assertNotNull(jpredws, "jpredws is null!"); jalview.io.FileLoader fl = new jalview.io.FileLoader(false); - - af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.FormatAdapter.FILE); - + af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.DataSourceType.FILE); assertNotNull("Couldn't load test data ('" + testseqs + "')", af); - } - @AfterClass + @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { if (af != null) @@ -101,7 +107,7 @@ public class JpredJabaStructExportImport } } - @Test + @Test(groups = { "Network" }, enabled = false) public void testJPredStructOneSeqOnly() { af.selectAllSequenceMenuItem_actionPerformed(null); @@ -142,7 +148,7 @@ public class JpredJabaStructExportImport if (!success) { jpredClient.cancelCurrentJob(); - fail("Jpred Client didn't run with hardwired default parameters."); + Assert.fail("Jpred Client didn't run with hardwired default parameters."); } } catch (InterruptedException x) @@ -153,7 +159,7 @@ public class JpredJabaStructExportImport } - @Test + @Test(groups = { "Network" }, enabled = false) public void testJPredStructExport() { @@ -183,12 +189,11 @@ public class JpredJabaStructExportImport try { // what format would be appropriate for RNAalifold annotations? - String aligfileout = new FormatAdapter().formatSequences("PFAM", - al.getSequencesArray()); + String aligfileout = FileFormat.Pfam.getWriter(null).print( + al.getSequencesArray(), true); - String anfileout = new AnnotationFile().printAnnotations( - al.getAlignmentAnnotation(), al.getGroups(), - al.getProperties()); + String anfileout = new AnnotationFile() + .printAnnotationsForAlignment(al); assertTrue( "Test " + testname @@ -205,30 +210,31 @@ public class JpredJabaStructExportImport // again what format would be appropriate? AlignmentI al_new = new FormatAdapter().readFile(aligfileout, - FormatAdapter.PASTE, "PFAM"); + DataSourceType.PASTE, FileFormat.Fasta); assertTrue( "Test " + testname + "\nregenerated annotation file did not annotate alignment.", new AnnotationFile().readAnnotationFile(al_new, anfileout, - FormatAdapter.PASTE)); + DataSourceType.PASTE)); // test for consistency in io - StockholmFileTest.testAlignmentEquivalence(al, al_new); + StockholmFileTest.testAlignmentEquivalence(al, al_new, false, false, + false); return; } catch (Exception e) { e.printStackTrace(); } - fail("Test " + Assert.fail("Test " + testname + "\nCouldn't complete Annotation file roundtrip input/output/input test."); } - // @Test + @Test(groups = { "Network" }, enabled = false) public void testJpredwsSettingsRecovery() { - fail("not implemnented"); + Assert.fail("not implemnented"); List opts = new ArrayList(); for (compbio.metadata.Argument rg : (List) jpredws .getRunnerConfig().getArguments()) @@ -240,7 +246,7 @@ public class JpredJabaStructExportImport rg.setValue("292"); } catch (WrongParameterException q) { - fail("Couldn't set the temperature parameter " + Assert.fail("Couldn't set the temperature parameter " + q.getStackTrace()); } opts.add(rg);