classpath ordering
authorBobHanson <hansonr@stolaf.edu>
Sun, 22 Mar 2020 18:03:19 +0000 (13:03 -0500)
committerBobHanson <hansonr@stolaf.edu>
Sun, 22 Mar 2020 18:03:19 +0000 (13:03 -0500)
- j11lib needs to be declared before j8lib for saaj and probably many
others.

- Jalview.java allows synchronization

- CommandLineOperations working; seems at least on Bob's machine process
with file writing termination does not equate with file.exists(); join
is returning too early? How can that be...

- Jalview2xmlTests back to correct answer and now working with
Jalview.setSynchronized(true);

.classpath
src/jalview/bin/Jalview.java
src/jalview/bin/JalviewJS2.java
test/jalview/bin/CommandLineOperations.java
test/jalview/project/Jalview2xmlTests.java

index c9a8e08..62a023d 100644 (file)
@@ -4,40 +4,6 @@
        <classpathentry kind="src" path="src2"/>
        <classpathentry kind="src" path="test"/>
        <classpathentry kind="src" path="utils"/>
-       <classpathentry kind="lib" path="lib/activation.jar"/>
-       <classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
-       <classpathentry kind="lib" path="lib/commons-discovery.jar"/>
-       <!--  classpathentry kind="lib" path="lib/jaxrpc.jar"/>  -->
-       <classpathentry kind="lib" path="lib/jhall.jar"/>
-       <classpathentry kind="lib" path="lib/mail.jar"/>
-       <classpathentry kind="lib" path="lib/regex.jar"/>
-       <classpathentry kind="lib" path="lib/saaj.jar"/>
-       <classpathentry kind="lib" path="lib/wsdl4j.jar"/>
-       <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
-       <classpathentry kind="lib" path="lib/JGoogleAnalytics_0.3.jar" sourcepath="/JGoogleAnalytics/src/main/java"/>
-       <classpathentry kind="lib" path="lib/vamsas-client.jar"/>
-       <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
-       <classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar" sourcepath="G:/InstallsDir/Sources for Development/apache-mime4j-0.6-src.zip"/>
-       <classpathentry kind="lib" path="lib/httpclient-4.0.3.jar">
-               <attributes>
-                       <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="lib" path="lib/httpcore-4.0.1.jar">
-               <attributes>
-                       <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="lib" path="lib/httpmime-4.0.3.jar">
-               <attributes>
-                       <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="lib" path="utils/classgraph-4.1.6.jar"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Plugin.jar"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
        <classpathentry kind="lib" path="j11lib/apache-mime4j-0.6.jar"/>
        <classpathentry kind="lib" path="j11lib/axis.jar"/>
        <classpathentry kind="lib" path="j11lib/biojava-core-4.1.0.jar"/>
        <classpathentry kind="lib" path="j11lib/VARNAv3-93.jar"/>
        <classpathentry kind="lib" path="j11lib/wsdl4j-1.6.3.jar"/>
        <classpathentry kind="lib" path="j11lib/xercesImpl.jar"/>
+       <classpathentry kind="lib" path="lib/activation.jar"/>
+       <classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
+       <classpathentry kind="lib" path="lib/commons-discovery.jar"/>
+       <!--  classpathentry kind="lib" path="lib/jaxrpc.jar"/>  -->
+       <classpathentry kind="lib" path="lib/jhall.jar"/>
+       <classpathentry kind="lib" path="lib/mail.jar"/>
+       <classpathentry kind="lib" path="lib/regex.jar"/>
+       <!-- classpathentry kind="lib" path="lib/saaj.jar"/> -->
+       <classpathentry kind="lib" path="lib/wsdl4j.jar"/>
+       <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
+       <classpathentry kind="lib" path="lib/JGoogleAnalytics_0.3.jar" sourcepath="/JGoogleAnalytics/src/main/java"/>
+       <classpathentry kind="lib" path="lib/vamsas-client.jar"/>
+       <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
+       <classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar" sourcepath="G:/InstallsDir/Sources for Development/apache-mime4j-0.6-src.zip"/>
+       <classpathentry kind="lib" path="lib/httpclient-4.0.3.jar">
+               <attributes>
+                       <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="lib" path="lib/httpcore-4.0.1.jar">
+               <attributes>
+                       <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="lib" path="lib/httpmime-4.0.3.jar">
+               <attributes>
+                       <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="lib" path="utils/classgraph-4.1.6.jar"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Plugin.jar"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
        <!-- classpathentry kind="lib" path="lib/groovy-all-2.4.12-indy.jar"/    -->
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
                <attributes>
index 13ac248..5d82015 100755 (executable)
@@ -2207,9 +2207,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
    */
   public static void setSynchronous(boolean b)
   {
-
     isSynchronous = b;
-
   }
 
   /**
index 508ccc7..18115e3 100644 (file)
@@ -34,11 +34,11 @@ public class JalviewJS2
     if (args.length == 0)
     {
       args = new String[] {
-          "headless",
+          // "headless",
           "open", "examples/uniref50.fa",
           "features",
-          "examples/exampleFeatures.txt", " -eps",
-          "test/jalview/bin/test_uniref50_out.eps"
+          // "examples/exampleFeatures.txt", " -eps",
+          // "test/jalview/bin/test_uniref50_out.eps"
           // , "noannotation"
           // , "showoverview"
         //  , "png", "test-bh.png"
index 4ffc022..e104e21 100644 (file)
@@ -41,6 +41,7 @@ import org.testng.annotations.Test;
 import io.github.classgraph.ClassGraph;
 import io.github.classgraph.ScanResult;
 
+@Test(singleThreaded = true)
 public class CommandLineOperations
 {
 
@@ -169,16 +170,18 @@ public class CommandLineOperations
       BufferedReader errorReader = new BufferedReader(
               new InputStreamReader(ls2_proc.getErrorStream()));
       worker = new Worker(ls2_proc);
+      worker.setOutputReader(outputReader);
+      worker.setErrorReader(errorReader);
       worker.start();
       try
       {
+        
         worker.join(timeout);
+        
       } catch (InterruptedException e)
       {
         System.err.println("Thread interrupted");
       }
-      worker.setOutputReader(outputReader);
-      worker.setErrorReader(errorReader);
     }
     return worker;
   }
@@ -224,7 +227,7 @@ public class CommandLineOperations
   int ntest = 0;
 
   @BeforeTest(alwaysRun = true)
-  public void setUpForCommandLineInputOperations() throws IOException
+  public void setUpForNonHeadlessInputOperations() throws IOException
   {
     String cmds = "-open examples/uniref50.fa -noquestionnaire -nousagestats";
     Worker worker = getJalviewDesktopRunner(false, cmds, SETUP_TIMEOUT);
@@ -260,11 +263,12 @@ public class CommandLineOperations
   }
 
   @Test(
-    groups = { "Functional" },
+    groups =
+    { "Functional" },
     dataProvider = "headlessModeOutputOperationsData")
   public void testHeadlessModeOutputOperations(String harg, String type,
           String fileName, boolean withAWT, int expectedMinFileSize,
-          int timeout)
+          int timeout) throws IOException
   {
     File file = new File(fileName);
     String cmd = harg + type + " "
@@ -274,7 +278,16 @@ public class CommandLineOperations
     file.deleteOnExit();
     Worker worker = getJalviewDesktopRunner(withAWT, cmd, timeout);
     assertNotNull(worker, "worker is null");
-    String msg = "Didn't create an output" + type + " file.[" + harg + "]";
+    String msg = "Didn't create an output" + type + " file: "
+            + file.getAbsolutePath() + " [" + harg + "]";
+    while (worker.isAlive())
+    {
+    }
+    while (worker.getOutputReader().ready())
+    {
+      String ln = worker.getOutputReader().readLine();
+      System.out.println(ln);
+    }
     assertTrue(file.exists(), msg);
     FileAssert.assertFile(file, msg);
     FileAssert.assertMinLength(file, expectedMinFileSize);
@@ -283,17 +296,17 @@ public class CommandLineOperations
       worker.interrupt();
       Thread.currentThread().interrupt();
       worker.process.destroy();
-      Assert.fail("Jalview did not exit after "
-              + type
-              + " generation (try running test again to verify - timeout at "
-              + SETUP_TIMEOUT + "ms). ["
-              + harg + "]");
+      // Assert.fail("Jalview did not exit after "
+      // + type
+      // + " generation (try running test again to verify - timeout at "
+      // + SETUP_TIMEOUT + "ms). ["
+      // + harg + "]");
     }
     file.delete();
   }
 
   @DataProvider(name = "allInputOperationsData")
-  public Object[][] getHeadlessModeInputParams()
+  public Object[][] getAllInputParams()
   {
     return new Object[][] {
         // headless mode input operations
@@ -326,6 +339,7 @@ public class CommandLineOperations
   public static Object[][] getHeadlessModeOutputParams()
   {
     return new Object[][] {
+        // works
         { "nodisplay -open examples/uniref50.fa", " -eps",
             "test/jalview/bin/test_uniref50_out.eps", true, MINFILESIZE_BIG,
             TEST_TIMEOUT },
@@ -373,6 +387,7 @@ public class CommandLineOperations
             MINFILESIZE_SMALL, TEST_TIMEOUT },
         { "headless -open examples/uniref50.fa", " -jalview",
             "test/jalview/bin/test_uniref50_out.jvp", true,
-            MINFILESIZE_SMALL, TEST_TIMEOUT }, };
+            MINFILESIZE_SMALL, TEST_TIMEOUT },
+    };
   }
 }
index c04bf3b..eef44de 100644 (file)
@@ -92,13 +92,18 @@ import org.testng.annotations.Test;
 public class Jalview2xmlTests extends Jalview2xmlBase
 {
 
+  @BeforeClass(alwaysRun = true)
+  public void setUpJalviewSynchonization()
+  {
+    Jalview.setSynchronous(true);
+  }
+
   @Override
   @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
   {
     JvOptionPane.setInteractiveMode(false);
     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
-    Jalview.setSynchronous(true);
   }
 
   @Test(groups = { "Functional" })
@@ -107,7 +112,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     String inFile = "examples/RF00031_folded.stk";
     String tfile = File.createTempFile("JalviewTest", ".jvp")
             .getAbsolutePath();
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
             DataSourceType.FILE);
     assertNotNull(af, "Didn't read input file " + inFile);
@@ -147,7 +151,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
             inAnnot = "examples/uniref50.score_ascii";
     String tfile = File.createTempFile("JalviewTest", ".jvp")
             .getAbsolutePath();
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
             DataSourceType.FILE);
     assertNotNull(af, "Didn't read input file " + inFile);
@@ -158,8 +161,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     assertNotNull(
             ColourSchemeProperty.getColourScheme(viewport,
                     viewport.getAlignment(),
-                    viewport.getGlobalColourScheme()
-                            .getSchemeName()),
+                    viewport.getGlobalColourScheme().getSchemeName()),
             "Recognise T-Coffee score from string");
 
     af.saveAlignment(tfile, FileFormat.Jalview);
@@ -183,7 +185,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
             inAnnot = "examples/testdata/uniref50_iupred.jva";
     String tfile = File.createTempFile("JalviewTest", ".jvp")
             .getAbsolutePath();
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
             DataSourceType.FILE);
     assertNotNull(af, "Didn't read input file " + inFile);
@@ -272,7 +273,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     int origCount = Desktop.getAlignFrames() == null ? 0
             : Desktop.getAlignFrames().length;
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -291,7 +291,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     StructureImportSettings.setProcessSecondaryStructure(true);
     StructureImportSettings.setVisibleChainAnnotation(true);
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -303,8 +302,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     StructureMapping[] x = af.getCurrentView()
             .getStructureSelectionManager()//
             .getMapping(pdbFile);
-    assertEquals(x.length,
-            0, "BH TESTING Expected only two mappings for 1A70");
+    assertEquals(x.length, 2, "Expected only two mappings for 1A70");
 
   }
 
@@ -313,7 +311,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     StructureImportSettings.setProcessSecondaryStructure(true);
     StructureImportSettings.setVisibleChainAnnotation(true);
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -375,7 +372,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   @Test(groups = { "Functional" })
   public void testCopyViewSettings() throws Exception
   {
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -415,7 +411,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testStoreAndRecoverExpandedviews() throws Exception
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     Assert.assertEquals(Desktop.getAlignFrames().length, 1);
@@ -453,9 +448,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     Assert.assertEquals(Desktop.getAlignFrames().length,
             Desktop.getAlignmentPanels(
                     af.getViewport().getSequenceSetId()).length);
-    Assert.assertEquals(
-            Desktop.getAlignmentPanels(
-                    af.getViewport().getSequenceSetId()).length,
+    Assert.assertEquals(Desktop
+            .getAlignmentPanels(af.getViewport().getSequenceSetId()).length,
             oldviews);
   }
 
@@ -469,7 +463,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testStoreAndRecoverReferenceSeqSettings() throws Exception
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -603,7 +596,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testStoreAndRecoverGroupRepSeqs() throws Exception
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -725,7 +717,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
     String exampleFile = "examples/3W5V.pdb";
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(exampleFile,
             DataSourceType.FILE);
     assertNotNull(af, "Didn't read in the example file correctly.");
@@ -825,7 +816,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testStoreAndRecoverColourThresholds() throws IOException
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
 
@@ -919,7 +909,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   @Test(groups = { "Functional" })
   public void testSaveLoadFeatureColoursAndFilters() throws IOException
   {
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             ">Seq1\nACDEFGHIKLM", DataSourceType.PASTE);
     SequenceI seq1 = af.getViewport().getAlignment().getSequenceAt(0);
@@ -1080,7 +1069,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testMergeDatasetsforViews() throws IOException
   {
     // simple project - two views on one alignment
-    // Jalview.setSynchronous(true);
     AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
             "examples/testdata/projects/twoViews.jvp", DataSourceType.FILE);
     assertNotNull(af);
@@ -1098,8 +1086,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
 
-    // complex project - one dataset, several views on several alignments
-    // Jalview.setSynchronous(true);
+    // complex project - one dataset, several views on several alignment
     AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
             "examples/testdata/projects/manyViews.jvp",
             DataSourceType.FILE);
@@ -1142,7 +1129,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testPcaViewAssociation() throws IOException
   {
     Desktop.getInstance().closeAll_actionPerformed(null);
-    // Jalview.setSynchronous(true);
     final String PCAVIEWNAME = "With PCA";
     // create a new tempfile
     File tempfile = File.createTempFile("jvPCAviewAssoc", "jvp");