From 4e77e758e10a6b83902b3cc21a669da8bcd0dc8f Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 8 Nov 2018 15:24:06 +0000 Subject: [PATCH] JAL-1889 unit test tweaks for running on server --- test/jalview/ext/rbvi/chimera/ChimeraConnect.java | 2 +- test/jalview/gui/AlignViewportTest.java | 21 ++++++++++++++++++-- test/jalview/gui/AlignmentPanelTest.java | 6 +++--- test/jalview/io/IdentifyFileTest.java | 2 +- test/jalview/io/cache/JvCacheableInputBoxTest.java | 7 +++---- test/jalview/viewmodel/styles/ViewStyleTest.java | 5 +++++ 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/test/jalview/ext/rbvi/chimera/ChimeraConnect.java b/test/jalview/ext/rbvi/chimera/ChimeraConnect.java index 4d904cf..99394dc 100644 --- a/test/jalview/ext/rbvi/chimera/ChimeraConnect.java +++ b/test/jalview/ext/rbvi/chimera/ChimeraConnect.java @@ -41,7 +41,7 @@ public class ChimeraConnect JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); } - @Test(groups = { "Functional" }) + @Test(groups = { "External" }) public void testLaunchAndExit() { final StructureManager structureManager = new StructureManager(true); diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 5ed0cac..7801250 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -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); diff --git a/test/jalview/gui/AlignmentPanelTest.java b/test/jalview/gui/AlignmentPanelTest.java index 2819dbf..e84b87a 100644 --- a/test/jalview/gui/AlignmentPanelTest.java +++ b/test/jalview/gui/AlignmentPanelTest.java @@ -222,7 +222,7 @@ public class AlignmentPanelTest /** * Test that update layout reverts to original (unwrapped) values for endRes - * and endSeq when switching from wrapped to unwrapped mode (JAL-2739) + * when switching from wrapped back to unwrapped mode (JAL-2739) */ @Test(groups = "Functional") public void TestUpdateLayout_endRes() @@ -235,14 +235,14 @@ public class AlignmentPanelTest af.alignPanel.getAlignViewport().setWrapAlignment(true); af.alignPanel.updateLayout(); - // endRes changes + // endRes has changed assertNotEquals(ranges.getEndRes(), endres); // unwrap af.alignPanel.getAlignViewport().setWrapAlignment(false); af.alignPanel.updateLayout(); - // endRes and endSeq back to original values + // endRes back to original value assertEquals(ranges.getEndRes(), endres); } diff --git a/test/jalview/io/IdentifyFileTest.java b/test/jalview/io/IdentifyFileTest.java index dd4f6ba..5be7968 100644 --- a/test/jalview/io/IdentifyFileTest.java +++ b/test/jalview/io/IdentifyFileTest.java @@ -94,7 +94,7 @@ public class IdentifyFileTest { "examples/plantfdx.fa", FileFormat.Fasta }, { "examples/dna_interleaved.phy", FileFormat.Phylip }, { "examples/2GIS.pdb", FileFormat.PDB }, - { "examples/rf00031_folded.stk", FileFormat.Stockholm }, + { "examples/RF00031_folded.stk", FileFormat.Stockholm }, { "examples/testdata/test.rnaml", FileFormat.Rnaml }, { "examples/testdata/test.aln", FileFormat.Clustal }, { "examples/testdata/test.pfam", FileFormat.Pfam }, diff --git a/test/jalview/io/cache/JvCacheableInputBoxTest.java b/test/jalview/io/cache/JvCacheableInputBoxTest.java index dfd7973..010a4b2 100644 --- a/test/jalview/io/cache/JvCacheableInputBoxTest.java +++ b/test/jalview/io/cache/JvCacheableInputBoxTest.java @@ -55,10 +55,9 @@ public class JvCacheableInputBoxTest cacheBox.updateCache(); try { - // This 1ms delay is essential to prevent the - // assertion below from executing before - // cacheBox.updateCache() finishes updating the cache - Thread.sleep(100); + // This delay is to let + // cacheBox.updateCache() finish updating the cache + Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/test/jalview/viewmodel/styles/ViewStyleTest.java b/test/jalview/viewmodel/styles/ViewStyleTest.java index 26c3574..2fcfe1a 100644 --- a/test/jalview/viewmodel/styles/ViewStyleTest.java +++ b/test/jalview/viewmodel/styles/ViewStyleTest.java @@ -114,6 +114,11 @@ public class ViewStyleTest { Class type = field.getType(); + if (type.toString().contains("com_atlassian_clover")) + { + // instrumentation added for test coverage - ignore + return; + } if (type.equals(boolean.class) || type.equals(Boolean.class)) { boolean value = (Boolean) field.get(vs); -- 1.7.10.2