JAL-1270 set Cache properties in setUp to ensure test success
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 14 May 2015 11:27:56 +0000 (12:27 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 14 May 2015 11:27:56 +0000 (12:27 +0100)
test/jalview/ext/jmol/PDBFileWithJmolTest.java
test/jalview/gui/AnnotationChooserTest.java
test/jalview/io/AnnotatedPDBFileInputTest.java
test/jalview/io/Jalview2xmlTests.java
test/jalview/ws/PDBSequenceFetcherTest.java

index c9ab630..ae50bdf 100644 (file)
@@ -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
   {
index 2b890d2..33ffd32 100644 (file)
@@ -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");
index 6a61d2c..ef88ca5 100644 (file)
@@ -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);
index 8b83934..771250b 100644 (file)
@@ -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);
index 0868ded..778fc18 100644 (file)
  */
 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);
   }