JAL-2504 update the right feature colour when creating a new feature
[jalview.git] / test / jalview / ws / jabaws / JpredJabaStructExportImport.java
index 49a3064..dc157e2 100644 (file)
@@ -23,9 +23,13 @@ package jalview.ws.jabaws;
 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;
@@ -45,6 +49,7 @@ import javax.swing.JMenuItem;
 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;
@@ -52,6 +57,14 @@ 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,21 +91,13 @@ public class JpredJabaStructExportImport
     }
 
     System.out.println("State of jpredws: " + jpredws);
-
-    if (jpredws == null)
-    {
-      Assert.fail("jpredws is null");
-    }
-
+    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)
@@ -103,7 +107,7 @@ public class JpredJabaStructExportImport
     }
   }
 
-  @Test
+  @Test(groups = { "Network" }, enabled = false)
   public void testJPredStructOneSeqOnly()
   {
     af.selectAllSequenceMenuItem_actionPerformed(null);
@@ -155,7 +159,7 @@ public class JpredJabaStructExportImport
 
   }
 
-  @Test
+  @Test(groups = { "Network" }, enabled = false)
   public void testJPredStructExport()
   {
 
@@ -185,8 +189,8 @@ 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()
               .printAnnotationsForAlignment(al);
@@ -206,16 +210,17 @@ 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, false);
+      StockholmFileTest.testAlignmentEquivalence(al, al_new, false, false,
+              false);
       return;
     } catch (Exception e)
     {
@@ -226,7 +231,7 @@ public class JpredJabaStructExportImport
             + "\nCouldn't complete Annotation file roundtrip input/output/input test.");
   }
 
-  @Test
+  @Test(groups = { "Network" }, enabled = false)
   public void testJpredwsSettingsRecovery()
   {
     Assert.fail("not implemnented");