Merge branch 'develop' into Jalview-BH/JAL-3026-JAL-3063-JAXB
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 6 Dec 2018 13:26:46 +0000 (13:26 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 6 Dec 2018 13:26:46 +0000 (13:26 +0000)
13 files changed:
src/jalview/appletgui/AppletJmolBinding.java
src/jalview/appletgui/ExtJmol.java
src/jalview/ext/jmol/JalviewJmolBinding.java
test/jalview/ext/rbvi/chimera/ChimeraConnect.java
test/jalview/gui/AlignViewportTest.java
test/jalview/gui/AlignmentPanelTest.java
test/jalview/io/IdentifyFileTest.java
test/jalview/io/cache/JvCacheableInputBoxTest.java
test/jalview/viewmodel/styles/ViewStyleTest.java
utils/checkstyle/README.txt
utils/checkstyle/checkstyle-suppress.xml
utils/checkstyle/checkstyle.xml
utils/checkstyle/import-control.xml

index f3b034e..f1c494e 100644 (file)
@@ -24,7 +24,6 @@ import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.ext.jmol.JalviewJmolBinding;
-import jalview.gui.IProgressIndicator;
 import jalview.io.DataSourceType;
 import jalview.structure.StructureSelectionManager;
 
@@ -174,21 +173,12 @@ class AppletJmolBinding extends JalviewJmolBinding
   @Override
   public int[] resizeInnerPanel(String data)
   {
-    // TODO Auto-generated method stub
     return null;
   }
 
   @Override
   public Map<String, Object> getJSpecViewProperty(String arg0)
   {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  protected IProgressIndicator getIProgressIndicator()
-  {
-    // no progress indicators on the applet
     return null;
   }
 }
index be30b49..5a6d0d0 100644 (file)
@@ -26,7 +26,6 @@ import jalview.api.SequenceRenderer;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.ext.jmol.JalviewJmolBinding;
-import jalview.gui.IProgressIndicator;
 import jalview.io.DataSourceType;
 
 import java.awt.Container;
@@ -66,18 +65,8 @@ public class ExtJmol extends JalviewJmolBinding
   }
 
   @Override
-  protected IProgressIndicator getIProgressIndicator()
-  {
-    // no progress indicators on applet (could access javascript for this)
-    return null;
-  }
-
-  @Override
   public void updateColours(Object source)
   {
-
-    // TODO Auto-generated method stub
-
   }
 
   @Override
@@ -190,7 +179,6 @@ public class ExtJmol extends JalviewJmolBinding
   protected JmolAppConsoleInterface createJmolConsole(
           Container consolePanel, String buttonsToShow)
   {
-    // TODO Auto-generated method stub
     return null;
   }
 
@@ -205,14 +193,11 @@ public class ExtJmol extends JalviewJmolBinding
   @Override
   public void releaseReferences(Object svl)
   {
-    // TODO Auto-generated method stub
-
   }
 
   @Override
   public Map<String, Object> getJSpecViewProperty(String arg0)
   {
-    // TODO Auto-generated method stub
     return null;
   }
 
index babebc5..80eed4f 100644 (file)
@@ -1255,7 +1255,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     return chainNames;
   }
 
-  protected abstract IProgressIndicator getIProgressIndicator();
+  protected IProgressIndicator getIProgressIndicator()
+  {
+    return null;
+  }
 
   public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
   {
index 4d904cf..99394dc 100644 (file)
@@ -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);
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);
index 2819dbf..e84b87a 100644 (file)
@@ -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);
 
   }
index dd4f6ba..5be7968 100644 (file)
@@ -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 },
index 6c79f31..4d25cb5 100644 (file)
@@ -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();
index 26c3574..bc74d8a 100644 (file)
@@ -68,7 +68,7 @@ public class ViewStyleTest
     for (Field field : fields)
     {
       field.setAccessible(true);
-      if (!copyConstructorIgnores(field.getName()))
+      if (!copyConstructorIgnores(field))
       {
         changeValue(vs1, field);
       }
@@ -78,27 +78,36 @@ public class ViewStyleTest
 
     for (Field field1 : fields)
     {
-      final Object value1 = field1.get(vs1);
-      final Object value2 = field1.get(vs2);
-      String msg = "Mismatch in " + field1.getName() + "(" + value1 + "/"
+      if (!copyConstructorIgnores(field1))
+      {
+        final Object value1 = field1.get(vs1);
+        final Object value2 = field1.get(vs2);
+        String msg = "Mismatch in " + field1.getName() + "(" + value1 + "/"
               + value2 + ") - not set in copy constructor?";
-      assertEquals(msg, value1, value2);
+        assertEquals(msg, value1, value2);
+      }
     }
     assertEquals("Hashcode not equals", vs1.hashCode(), vs2.hashCode());
   }
 
   /**
-   * Add any field names in here that we expect to be ignored by the copy
-   * constructor
+   * Add tests here for any fields that we expect to be ignored by 
+   * the copy constructor
    * 
-   * @param name
+   * @param field
    * @return
    */
-  private boolean copyConstructorIgnores(String name)
+  private boolean copyConstructorIgnores(Field field)
   {
     /*
-     * currently none!
+     * just instrumentation added by test coverage while testing
      */
+    String type = field.getClass().toString();
+    if (type.toString().contains("com_atlassian_clover"))
+    {
+      // instrumentation added for test coverage - ignore
+      return true;
+    }
     return false;
   }
 
@@ -210,19 +219,22 @@ public class ViewStyleTest
     Field[] fields = ViewStyle.class.getDeclaredFields();
     for (Field field : fields)
     {
-      field.setAccessible(true);
-      Object oldValue = field.get(vs2);
-      changeValue(vs2, field);
-      assertFalse("equals method ignores " + field.getName(),
+      if (!copyConstructorIgnores(field))
+      {
+        field.setAccessible(true);
+        Object oldValue = field.get(vs2);
+        changeValue(vs2, field);
+        assertFalse("equals method ignores " + field.getName(),
               vs1.equals(vs2));
 
-      if (vs1.hashCode() == vs2.hashCode())
-      {
-        // uncomment next line to see which fields hashCode ignores
-        // System.out.println("hashCode ignores " + field.getName());
+        if (vs1.hashCode() == vs2.hashCode())
+        {
+          // uncomment next line to see which fields hashCode ignores
+          // System.out.println("hashCode ignores " + field.getName());
+        }
+        // restore original value before testing the next field
+        field.set(vs2, oldValue);
       }
-      // restore original value before testing the next field
-      field.set(vs2, oldValue);
     }
   }
 }
index e38064e..54f4e48 100644 (file)
@@ -1,6 +1,8 @@
 Checkstyle for Jalview
 ----------------------
 
+See
+https://issues.jalview.org/browse/JAL-1854
 http://checkstyle.sourceforge.net/
 GNU LGPL
 
@@ -9,8 +11,16 @@ To get the Eclipse Checkstyle plugin
        - Help | Eclipse Marketplace
        - search for checkstyle
        - install eclipse-cs checkstyle plugin
-The current version is 6.19.1 (August 2016).
 
+Change Log
+----------
+See http://checkstyle.sourceforge.net/releasenotes.html
+Aug 2016       Initial version used is 6.19.1
+Dec 2018       Updated to 8.12.0 (latest on Eclipse Marketplace, 8.15 is latest release)
+                       SuppressionCommentFilter relocated (changed in 8.1)
+                       FileContentsHolder removed (changed in 8.2)
+                       Updates to import-control.xml for code changes (htsjdk, stackoverflowusers)
+                       
 Config
 ------
 
@@ -37,6 +47,7 @@ How to use checkstyle
        Option 2: on demand on selected code
                - right-click on a class or package and Checkstyle | Check code with checkstyle
                - (or Clear Checkstyle violations to remove checkstyle warnings)
+               - recommended to use this as a QA step when changing or reviewing code
 
 Checkstyle rules
 ----------------
@@ -64,11 +75,11 @@ Suppressing findings
 Tips
 ----
        Sometimes checkstyle needs a kick before it will refresh its findings.
-       A whitespace edit in checkstyle.xml usually does this. There may be better ways.
+       Click the 'refresh' icon at top right in Eclipse | Preferences | Checkstyle.
        
        Invalid configuration files may result in checkstyle failing with an error reported
        in the Eclipse log file. 
-       Help | Installation Details | Configuration takes you to a screen with a 
+       Eclipse | About | Installation Details | Configuration takes you to a screen with a 
        'View Error Log' button.
        
        Sometimes checkstyle can fail silently. Try 'touching' (editing) config files, failing
index 122b8d0..29a3047 100644 (file)
@@ -26,6 +26,7 @@
     <suppress checks="[a-zA-Z0-9]*" files="[\\/]ext[\\/]edu*"/>
     <suppress checks="[a-zA-Z0-9]*" files="[\\/]ext[\\/]vamsas*"/>
     <suppress checks="[a-zA-Z0-9]*" files="[\\/]org[\\/]jibble*"/>
+    <suppress checks="[a-zA-Z0-9]*" files="[\\/]org[\\/]stackoverflowusers*"/>
     <suppress checks="[a-zA-Z0-9]*" files="[\\/]uk[\\/]ac*"/>
     
     <!-- 
index 85ac8e6..17946f7 100644 (file)
        </module>
 
        <!-- 
-               Allow suppression of rules by comments, e.g.:
-               // CHECKSTYLE.OFF: ParameterNumber
-               ..method declaration
-               // CHECKSTYLE.ON: ParameterNumber
-       -->
-       <module name="SuppressionCommentFilter">
-               <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
-               <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
-               <property name="checkFormat" value="$1"/>
-       </module>
-
-       <!-- 
                Check language bundles have the same keys and no duplicates
                (ensure Checkstyle is configured to scan non-source files)
         -->
                <property name="tabWidth" value="4"/>
 
                <!-- 
-                       Enables parsing of suppressions comments
-                       see http://checkstyle.sourceforge.net/config_filters.html#SuppressionCommentFilter 
+                       Allow suppression of rules by comments, e.g.:
+                       // CHECKSTYLE.OFF: ParameterNumber
+                       ..method declaration
+                       // CHECKSTYLE.ON: ParameterNumber
                -->
-               <module name="FileContentsHolder"/>
+               <module name="SuppressionCommentFilter">
+                       <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
+                       <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
+                       <property name="checkFormat" value="$1"/>
+               </module>
 
        <!-- ****************************** -->
        <!--         NAMING STANDARDS       -->
index c47aaec..478966f 100644 (file)
@@ -94,6 +94,7 @@
                <allow pkg="compbio.metadata" class="jalview.gui.WsJobParameters"/>
                <allow pkg="fr.orsay.lri.varna" class="jalview.gui.AppVarna"/>
                <allow pkg="fr.orsay.lri.varna" class="jalview.gui.AppVarnaBinding"/>
+               <allow pkg="org.stackoverflowusers.file" class="jalview.gui.Desktop"/>
                <allow pkg="uk.ac.vamsas" class="jalview.gui.VamsasApplication"/>
            </subpackage>
                
                <allow pkg="uk.ac.vamsas"/>
                <allow pkg="fr.orsay.lri.varna"/>
                <allow pkg="MCview"/>
+                       <subpackage name="vcf">
+                       <allow pkg="htsjdk\.*" regex="true"/>
+                       </subpackage>       
                </subpackage>       
                                
                <subpackage name="javascript">