JAL-4334 failing test using whole of Q29079 accession. Can be trimmed.
[jalview.git] / test / jalview / ws / jabaws / JalviewJabawsTestUtils.java
index 91e9244..8f003cb 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.ws.jabaws;
 
+import jalview.gui.JvOptionPane;
 import jalview.ws.jws2.Jws2Discoverer;
 
 import java.util.Vector;
@@ -32,12 +33,19 @@ import org.testng.annotations.Test;
 public class JalviewJabawsTestUtils
 {
 
-  @BeforeClass
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
+  @BeforeClass(alwaysRun = true)
   public static void setUpBeforeClass() throws Exception
   {
   }
 
-  @AfterClass
+  @AfterClass(alwaysRun = true)
   public static void tearDownAfterClass() throws Exception
   {
   }
@@ -45,11 +53,11 @@ public class JalviewJabawsTestUtils
   /**
    * test servers
    */
-  private static String[] serviceUrls = new String[]
-  { "http://localhost:8080/jabaws",
+  private static String[] serviceUrls = new String[] {
+      "http://localhost:8080/jabaws",
       "http://www.compbio.dundee.ac.uk/jabaws" };
 
-  @Test(enabled = false)
+  @Test(groups = { "Functional" }, enabled = false)
   public void testAnnotExport()
   {
     Assert.fail("Not yet implemented");
@@ -59,6 +67,21 @@ public class JalviewJabawsTestUtils
   {
     return getJabawsDiscoverer(true);
   }
+
+  /**
+   * Returns a service discoverer that queries localhost and compbio urls.
+   * <p>
+   * If using this method, be sure to have read-only Jalview properties, to
+   * avoid writing the test urls to .jalview_properties. This can be done by
+   * either
+   * <ul>
+   * <li>running Jalview main with arguments -props propFileName</li>
+   * <li>calling Cache.loadProperties(filename)</li>
+   * <ul>
+   * 
+   * @param localhost
+   * @return
+   */
   public static Jws2Discoverer getJabawsDiscoverer(boolean localhost)
   {
     jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer
@@ -82,13 +105,12 @@ public class JalviewJabawsTestUtils
     } catch (Exception e)
     {
       e.printStackTrace();
-      Assert.fail("Aborting. Problem discovering services. Tried "
-              + svcurls);
+      Assert.fail(
+              "Aborting. Problem discovering services. Tried " + svcurls);
     }
     Assert.assertTrue(disc.getServices().size() > 0,
             "Failed to discover any services at ");
     return disc;
   }
 
-
 }