JAL-1889 unit test tweaks for running on server
[jalview.git] / test / jalview / gui / AlignViewportTest.java
index 5ed0cac..7801250 100644 (file)
@@ -277,7 +277,7 @@ public class AlignViewportTest
    * Test for JAL-1306 - conservation thread should run even when only Quality
    * (and not Conservation) is enabled in Preferences
    */
-  @Test(groups = { "Functional" })
+  @Test(groups = { "Functional" }, timeOut=2000)
   public void testUpdateConservation_qualityOnly()
   {
     Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
@@ -292,7 +292,24 @@ public class AlignViewportTest
             Boolean.FALSE.toString());
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
-    AlignmentAnnotation[] anns = af.viewport.getAlignment()
+
+    /*
+     * wait for Conservation thread to complete
+     */
+    AlignViewport viewport = af.getViewport();
+    synchronized (this)
+    {
+      while (viewport.getAlignmentConservationAnnotation() != null)
+      {
+        try
+        {
+          wait(50);
+        } catch (InterruptedException e)
+        {
+        }
+      }
+    }
+    AlignmentAnnotation[] anns = viewport.getAlignment()
             .getAlignmentAnnotation();
     assertNotNull("No annotations found", anns);
     assertEquals("More than one annotation found", 1, anns.length);