From b5893211716553a96176a37f7c6e293cd6618559 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 14 May 2015 12:27:56 +0100 Subject: [PATCH] JAL-1270 set Cache properties in setUp to ensure test success --- test/jalview/ext/jmol/PDBFileWithJmolTest.java | 24 +++++++++++++++++------ test/jalview/gui/AnnotationChooserTest.java | 25 ++++++++++++++---------- test/jalview/io/AnnotatedPDBFileInputTest.java | 5 +++++ test/jalview/io/Jalview2xmlTests.java | 20 ++++++++++++------- test/jalview/ws/PDBSequenceFetcherTest.java | 16 +++++++++++---- 5 files changed, 63 insertions(+), 27 deletions(-) diff --git a/test/jalview/ext/jmol/PDBFileWithJmolTest.java b/test/jalview/ext/jmol/PDBFileWithJmolTest.java index c9ab630..ae50bdf 100644 --- a/test/jalview/ext/jmol/PDBFileWithJmolTest.java +++ b/test/jalview/ext/jmol/PDBFileWithJmolTest.java @@ -22,19 +22,22 @@ package jalview.ext.jmol; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.gui.AlignFrame; -import jalview.io.AppletFormatAdapter; -import jalview.io.FileLoader; import java.util.Vector; +import org.junit.Before; import org.junit.Test; import MCview.PDBfile; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.io.AppletFormatAdapter; +import jalview.io.FileLoader; + /** * @author jimp * @@ -47,6 +50,15 @@ public class PDBFileWithJmolTest // "./examples/DNMT1_MOUSE.pdb" // }; + @Before + public void setUp() + { + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); + } + @Test public void testAlignmentLoader() throws Exception { diff --git a/test/jalview/gui/AnnotationChooserTest.java b/test/jalview/gui/AnnotationChooserTest.java index 2b890d2..33ffd32 100644 --- a/test/jalview/gui/AnnotationChooserTest.java +++ b/test/jalview/gui/AnnotationChooserTest.java @@ -3,15 +3,6 @@ package jalview.gui; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; -import jalview.bin.Cache; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.Annotation; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; -import jalview.util.MessageManager; import java.awt.BorderLayout; import java.awt.Checkbox; @@ -28,6 +19,16 @@ import javax.swing.JPanel; import org.junit.Before; import org.junit.Test; +import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.util.MessageManager; + /** * Unit tests for AnnotationChooser * @@ -57,8 +58,12 @@ public class AnnotationChooserTest // pin down annotation sort order for test Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS, SequenceAnnotationOrder.NONE.name()); + final String True = Boolean.TRUE.toString(); Cache.applicationProperties.setProperty( - Preferences.SHOW_AUTOCALC_ABOVE, Boolean.TRUE.toString()); + Preferences.SHOW_AUTOCALC_ABOVE, True); + Cache.applicationProperties.setProperty("SHOW_QUALITY", True); + Cache.applicationProperties.setProperty("SHOW_CONSERVATION", True); + Cache.applicationProperties.setProperty("SHOW_IDENTITY", True); AlignmentI al = new jalview.io.FormatAdapter().readFile(TEST_DATA, AppletFormatAdapter.PASTE, "FASTA"); diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 6a61d2c..ef88ca5 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -12,6 +12,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; @@ -34,6 +35,10 @@ public class AnnotatedPDBFileInputTest @Before public void setup() throws Exception { + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); FileLoader loader = new FileLoader(false); AlignFrame af = loader.LoadFileWaitTillLoaded(pdbStr, FormatAdapter.FILE); diff --git a/test/jalview/io/Jalview2xmlTests.java b/test/jalview/io/Jalview2xmlTests.java index 8b83934..771250b 100644 --- a/test/jalview/io/Jalview2xmlTests.java +++ b/test/jalview/io/Jalview2xmlTests.java @@ -22,8 +22,17 @@ package jalview.io; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + +import java.io.File; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + import jalview.api.AlignmentViewPanel; import jalview.api.ViewStyleI; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; @@ -32,13 +41,6 @@ import jalview.gui.Desktop; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; -import java.io.File; - -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - public class Jalview2xmlTests { @@ -254,6 +256,10 @@ public class Jalview2xmlTests @Test public void viewRefPdbAnnotation() throws Exception { + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( "examples/exampleFile_2_7.jar", FormatAdapter.FILE); assertTrue("Didn't read in the example file correctly.", af != null); diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index 0868ded..778fc18 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -20,16 +20,18 @@ */ package jalview.ws; -import static org.junit.Assert.*; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.ws.seqfetcher.DbSourceProxy; +import static org.junit.Assert.assertTrue; import java.util.List; import org.junit.Before; import org.junit.Test; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceI; +import jalview.ws.seqfetcher.DbSourceProxy; + public class PDBSequenceFetcherTest { @@ -38,6 +40,12 @@ public class PDBSequenceFetcherTest @Before public void setUp() throws Exception { + // ensure 'add annotation from structure' is selected + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); + sf = new SequenceFetcher(false); } -- 1.7.10.2