From 6ef963034788a3499e25c1bbd8ccf850e18b3f94 Mon Sep 17 00:00:00 2001 From: BobHanson Date: Sun, 22 Mar 2020 08:05:10 -0500 Subject: [PATCH] JAL-3560 from JAL-3563. This commit is expected to be reverted. Just getting back to a branch that Bamboo is compiling. --- .j2s | 2 +- src/jalview/bin/Jalview.java | 107 ++++++++++++++++++++++++-- src/jalview/bin/JalviewJS2.java | 5 +- src/jalview/gui/AlignFrame.java | 4 + src/jalview/gui/Desktop.java | 2 +- src/jalview/project/Jalview2XML.java | 110 ++++++++++++++------------- src/jalview/structure/StructureMapping.java | 7 ++ src/jalview/workers/AlignCalcManager.java | 3 +- test/jalview/bin/CommandLineOperations.java | 19 ++++- test/jalview/project/Jalview2xmlTests.java | 29 +++++-- 10 files changed, 216 insertions(+), 72 deletions(-) diff --git a/.j2s b/.j2s index ea8e54f..51b5c7d 100644 --- a/.j2s +++ b/.j2s @@ -1,4 +1,4 @@ -j2s.compiler.status=enable +j2s.compiler.status=disable j2s.compiler.java.version=11 #a semicolon-separated list of package-level file paths to be excluded diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index ff8d52f..13ac248 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -86,6 +86,7 @@ import java.util.Map; import java.util.Vector; import javax.swing.LookAndFeel; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import groovy.lang.Binding; @@ -148,6 +149,8 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi private boolean noAnnotation; + public static final String TERMINATOR_LINE = "Jalview argument parsing complete."; + public boolean getStartCalculations() { return !noCalculation; @@ -312,6 +315,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi || "true".equals(System.getProperty("java.awt.headless"))) { headless = true; + setSynchronous(true); } if (isJS) @@ -346,7 +350,6 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi System.exit(0); } - // anything else! final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS); @@ -402,11 +405,11 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi try { if (!isJS && Platform.isWin()) - { + { UIManager.setLookAndFeel( headless ? "javax.swing.plaf.metal.MetalLookAndFeel" : UIManager.getSystemLookAndFeelClassName()); -// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (Exception ex) { @@ -460,7 +463,21 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi SequenceOntologyFactory.setSequenceOntology(new SequenceOntology()); } - if (!headless) + if (headless) + { + // If this is not tested, then + + if (aparser.contains(ArgsParser.NOUSAGESTATS)) + { + System.err.println("CMD [-nousagestats] executed successfully!"); + } + if (aparser.contains(ArgsParser.NOQUESTIONNAIRE)) + { + System.err.println("CMD [-noquestionnaire] executed successfully!"); + } + + } + else { desktop = Desktop.getInstance(); desktop.setInBatchMode(true); // indicate we are starting up @@ -527,6 +544,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } parseArguments(aparser, true); + System.err.println(TERMINATOR_LINE); } /** @@ -2170,5 +2188,84 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi // + " " + status); } -} + /** + * flag to allow selected Runnable and Thread processes to run synchronously + * + * JAL-3563 + * + */ + private static boolean isSynchronous = false; + + /** + * Set Jalview to run selected processes synchronously in test and headless + * environments. + * + * JAL-3563 + * + * @param b + * @author Bob Hanson + */ + public static void setSynchronous(boolean b) + { + + isSynchronous = b; + + } + + /** + * Allows optional synchronous running of a Runnable that would otherwise use + * SwingUtilities.invokeLater. + * + * JAL-3563 + * + * @param t + * @author Bob Hanson + */ + public static boolean isSynchronous() + { + return isSynchronous; + } + + /** + * Allows optional synchronous running of a Runnable that would otherwise use + * SwingUtilities.invokeLater. + * + * JAL-3563 + * + * @param t + * @author Bob Hanson + */ + public static void execRunnable(Runnable r) + { + if (isSynchronous()) + { + r.run(); + } + else + { + SwingUtilities.invokeLater(r); + } + } + + /** + * Allows optional synchronous running of a thread that would otherwise be run + * using start(). + * + * JAL-3563 + * + * @param t + * @author Bob Hanson + */ + public static void execThread(Thread t) + { + if (isSynchronous()) + { + t.run(); + } + else + { + t.start(); + } + } +} \ No newline at end of file diff --git a/src/jalview/bin/JalviewJS2.java b/src/jalview/bin/JalviewJS2.java index 0bfc930..508ccc7 100644 --- a/src/jalview/bin/JalviewJS2.java +++ b/src/jalview/bin/JalviewJS2.java @@ -34,10 +34,11 @@ public class JalviewJS2 if (args.length == 0) { args = new String[] { - // "headless", + "headless", "open", "examples/uniref50.fa", "features", - "examples/exampleFeatures.txt" + "examples/exampleFeatures.txt", " -eps", + "test/jalview/bin/test_uniref50_out.eps" // , "noannotation" // , "showoverview" // , "png", "test-bh.png" diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 2371be3..8d7a600 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4167,6 +4167,10 @@ public class AlignFrame extends GAlignFrame */ public void BuildWebServiceMenu() { + if (Jalview.isSynchronous()) + { + return; + } while (buildingMenu) { try diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 9e0c89b..1e58d1b 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -441,7 +441,7 @@ public class Desktop extends GDesktop // it deletes the unneeded Java-only code form the JavaScript version // completely (@j2sIgnore), since it will never be used there. - if (!Platform.isJS()) + if (!Platform.isJS() && !Jalview.isSynchronous()) /** * Java only * diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index b0315e8..2c93ee5 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -35,6 +35,7 @@ import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -189,7 +190,6 @@ import java.util.jar.JarInputStream; import java.util.jar.JarOutputStream; import javax.swing.JInternalFrame; -import javax.swing.SwingUtilities; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Marshaller; @@ -2784,8 +2784,9 @@ public class Jalview2XML { try { + // BH 2019 -- can't wait - SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() @@ -3354,16 +3355,16 @@ public class Jalview2XML * data source provider * @return alignment frame created from view stored in DOM */ - AlignFrame loadFromObject(JalviewModel jalviewModel, String file, + private AlignFrame loadFromObject(JalviewModel jalviewModel, String file, boolean loadTreesAndStructures, jarInputStreamProvider jprovider) { -// Platform.timeCheck("Jalview2XML.loadFromObject0", Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject0", Platform.TIME_MARK); - SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet().get(0); + SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet() + .get(0); List vamsasSeqs = vamsasSet.getSequence(); - // JalviewModelSequence jms = object.getJalviewModelSequence(); // Viewport view = (jms.getViewportCount() > 0) ? jms.getViewport(0) @@ -3394,7 +3395,7 @@ public class Jalview2XML : view.getId() + uniqueSetSuffix); } -// Platform.timeCheck("Jalview2XML.loadFromObject1", Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject1", Platform.TIME_MARK); // //////////////////////////////// // LOAD SEQUENCES @@ -3480,8 +3481,8 @@ public class Jalview2XML } } -// Platform.timeCheck("Jalview2XML.loadFromObject-seq", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-seq", + // Platform.TIME_MARK); // / // Create the alignment object from the sequence set // /////////////////////////////// @@ -3522,8 +3523,8 @@ public class Jalview2XML recoverDatasetFor(vamsasSet, al, isdsal, uniqueSeqSetId); } -// Platform.timeCheck("Jalview2XML.loadFromObject-align", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-align", + // Platform.TIME_MARK); if (referenceseqForView != null) { al.setSeqrep(referenceseqForView); @@ -3536,8 +3537,8 @@ public class Jalview2XML al.setProperty(ssp.getKey(), ssp.getValue()); } -// Platform.timeCheck("Jalview2XML.loadFromObject-setseqprop", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-setseqprop", + // Platform.TIME_MARK); // /////////////////////////////// Hashtable pdbloaded = new Hashtable(); // TODO nothing writes to this?? @@ -3551,7 +3552,7 @@ public class Jalview2XML // now, for 2.10 projects, this is also done if the xml doc includes // dataset sequences not actually present in any particular view. // -// Platform.timeCheck("J2XML features0", Platform.TIME_RESET); + // Platform.timeCheck("J2XML features0", Platform.TIME_RESET); for (int i = 0; i < vamsasSeqs.size(); i++) { JSeq jseq = jseqs.get(i); @@ -3606,9 +3607,9 @@ public class Jalview2XML } // adds feature to datasequence's feature set (since Jalview 2.10) -// Platform.timeCheck(null, Platform.TIME_SET); + // Platform.timeCheck(null, Platform.TIME_SET); al.getSequenceAt(i).addSequenceFeature(sf); -// Platform.timeCheck(null, Platform.TIME_MARK); + // Platform.timeCheck(null, Platform.TIME_MARK); } } if (vamsasSeqs.get(i).getDBRef().size() > 0) @@ -3668,8 +3669,7 @@ public class Jalview2XML { entry.setProperty(prop.getName(), prop.getValue()); } - Desktop.getStructureSelectionManager() - .registerPDBEntry(entry); + Desktop.getStructureSelectionManager().registerPDBEntry(entry); // adds PDBEntry to datasequence's set (since Jalview 2.10) if (al.getSequenceAt(i).getDatasetSequence() != null) { @@ -3684,9 +3684,9 @@ public class Jalview2XML } -// Platform.timeCheck("features done", Platform.TIME_GET); -// Platform.timeCheck("Jalview2XML.loadFromObject-endmultiview", -// Platform.TIME_MARK); + // Platform.timeCheck("features done", Platform.TIME_GET); + // Platform.timeCheck("Jalview2XML.loadFromObject-endmultiview", + // Platform.TIME_MARK); } // end !multipleview // /////////////////////////////// @@ -3720,16 +3720,16 @@ public class Jalview2XML else { // defer to later - frefedSequence.add( - newAlcodMapRef(map.getDnasq(), cf, mapping)); + frefedSequence + .add(newAlcodMapRef(map.getDnasq(), cf, mapping)); } } } al.addCodonFrame(cf); } } -// Platform.timeCheck("Jalview2XML.loadFromObject-seqmap", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-seqmap", + // Platform.TIME_MARK); } // //////////////////////////////// @@ -3790,8 +3790,8 @@ public class Jalview2XML } // Construct new annotation from model. List ae = annotation.getAnnotationElement(); -// System.err.println( -// "Jalview2XML processing " + ae.size() + " annotations"); + // System.err.println( + // "Jalview2XML processing " + ae.size() + " annotations"); jalview.datamodel.Annotation[] anot = null; java.awt.Color firstColour = null; @@ -3936,8 +3936,7 @@ public class Jalview2XML jaa.setCalcId(annotation.getCalcId()); if (annotation.getProperty().size() > 0) { - for (Annotation.Property prop : annotation - .getProperty()) + for (Annotation.Property prop : annotation.getProperty()) { jaa.setProperty(prop.getName(), prop.getValue()); } @@ -3954,8 +3953,8 @@ public class Jalview2XML al.addAnnotation(jaa); } } -// Platform.timeCheck("Jalview2XML.loadFromObject-annot", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-annot", + // Platform.TIME_MARK); } // /////////////////////// // LOAD GROUPS @@ -4020,9 +4019,9 @@ public class Jalview2XML sg.setShowNonconserved(safeBoolean(jGroup.isShowUnconserved())); sg.thresholdTextColour = safeInt(jGroup.getTextColThreshold()); // attributes with a default in the schema are never null - sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram()); - sg.setshowSequenceLogo(jGroup.isShowSequenceLogo()); - sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo()); + sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram()); + sg.setshowSequenceLogo(jGroup.isShowSequenceLogo()); + sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo()); sg.setIgnoreGapsConsensus(jGroup.isIgnoreGapsinConsensus()); if (jGroup.getConsThreshold() != null && jGroup.getConsThreshold().intValue() != 0) @@ -4066,12 +4065,13 @@ public class Jalview2XML if (addAnnotSchemeGroup) { // reconstruct the annotation colourscheme - sg.setColourScheme(constructAnnotationColour( - jGroup.getAnnotationColours(), null, al, jalviewModel, false)); + sg.setColourScheme( + constructAnnotationColour(jGroup.getAnnotationColours(), + null, al, jalviewModel, false)); } } -// Platform.timeCheck("Jalview2XML.loadFromObject-groups", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-groups", + // Platform.TIME_MARK); } if (view == null) { @@ -4111,8 +4111,8 @@ public class Jalview2XML } } -// Platform.timeCheck("Jalview2XML.loadFromObject-viewport", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-viewport", + // Platform.TIME_MARK); } /** * indicate that annotation colours are applied across all groups (pre @@ -4165,47 +4165,47 @@ public class Jalview2XML final AlignFrame af0 = af; final AlignViewport av0 = av; final AlignmentPanel ap0 = ap; -// Platform.timeCheck("Jalview2XML.loadFromObject-beforetree", -// Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadFromObject-beforetree", + // Platform.TIME_MARK); if (loadTreesAndStructures) { if (!jalviewModel.getTree().isEmpty()) { - SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() { -// Platform.timeCheck(null, Platform.TIME_MARK); + // Platform.timeCheck(null, Platform.TIME_MARK); loadTrees(jalviewModel, view, af0, av0, ap0); -// Platform.timeCheck("Jalview2XML.loadTrees", Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadTrees", Platform.TIME_MARK); } }); } if (!jalviewModel.getPcaViewer().isEmpty()) { - SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() { -// Platform.timeCheck(null, Platform.TIME_MARK); + // Platform.timeCheck(null, Platform.TIME_MARK); loadPCAViewers(jalviewModel, ap0); -// Platform.timeCheck("Jalview2XML.loadPCA", Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadPCA", Platform.TIME_MARK); } }); } - SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() { -// Platform.timeCheck(null, Platform.TIME_MARK); + // Platform.timeCheck(null, Platform.TIME_MARK); loadPDBStructures(jprovider, jseqs, af0, ap0); -// Platform.timeCheck("Jalview2XML.loadPDB", Platform.TIME_MARK); + // Platform.timeCheck("Jalview2XML.loadPDB", Platform.TIME_MARK); } }); - SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() @@ -4213,6 +4213,7 @@ public class Jalview2XML loadRnaViewers(jprovider, jseqs, ap0); } }); + } // and finally return. // but do not set holdRepaint true just yet, because this could be the @@ -4773,7 +4774,7 @@ public class Jalview2XML svattrib.getWidth(), svattrib.getHeight()); // try // { - javax.swing.SwingUtilities.invokeLater(new Runnable() + Jalview.execRunnable(new Runnable() { @Override public void run() @@ -4799,7 +4800,8 @@ public class Jalview2XML } } } - }); + }); + // javax.swing.SwingUtilities.invokeLater(r); // } catch (InvocationTargetException ex) // { // warn("Unexpected error when opening Jmol view.", ex); diff --git a/src/jalview/structure/StructureMapping.java b/src/jalview/structure/StructureMapping.java index 4174f5b..4b99911 100644 --- a/src/jalview/structure/StructureMapping.java +++ b/src/jalview/structure/StructureMapping.java @@ -365,4 +365,11 @@ public class StructureMapping return true; } + + @Override + public String toString() + { + return "[StructureMapping " + pdbfile + "\n" + mappingDetails + "]"; + } + } diff --git a/src/jalview/workers/AlignCalcManager.java b/src/jalview/workers/AlignCalcManager.java index 9a3fc8d..77908b6 100644 --- a/src/jalview/workers/AlignCalcManager.java +++ b/src/jalview/workers/AlignCalcManager.java @@ -190,7 +190,8 @@ public class AlignCalcManager implements AlignCalcManagerI { Thread tw = new Thread(worker); tw.setName(worker.getClass().toString()); - tw.start(); + Jalview.execThread(tw); // JAL-3563 + // tw.start(); } } diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index 564e57d..4ffc022 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -203,11 +203,21 @@ public class CommandLineOperations { System.out.println(ln); successfulCMDs.add(ln); + if (ln.equals(Jalview.TERMINATOR_LINE)) + { + break; + } } - while ((ln = worker.getErrorReader().readLine()) != null) + if (worker != null && worker.exit == null) { - System.err.println(ln); + worker.interrupt(); + Thread.currentThread().interrupt(); + worker.process.destroy(); } + // while ((ln = worker.getErrorReader().readLine()) != null) + // { + // System.err.println(ln); + // } } @@ -224,6 +234,11 @@ public class CommandLineOperations { System.out.println(ln); successfulCMDs.add(ln); + if (ln.equals(Jalview.TERMINATOR_LINE)) + { + break; + } + if (++count > 5) { break; diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index 830a759..3c74b9e 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -32,6 +32,7 @@ import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureColourI; import jalview.api.ViewStyleI; +import jalview.bin.Jalview; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.HiddenSequences; @@ -68,6 +69,7 @@ import jalview.schemes.RNAHelicesColour; import jalview.schemes.StrandColourScheme; import jalview.schemes.TCoffeeColourScheme; import jalview.structure.StructureImportSettings; +import jalview.structure.StructureMapping; import jalview.util.matcher.Condition; import jalview.viewmodel.AlignmentViewport; @@ -96,6 +98,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase { JvOptionPane.setInteractiveMode(false); JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + Jalview.setSynchronous(true); } @Test(groups = { "Functional" }) @@ -104,6 +107,7 @@ 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); @@ -119,7 +123,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase assertTrue(af.isSaveAlignmentSuccessful(), "Failed to store as a project."); af.closeMenuItem_actionPerformed(true); - af = null; af = new FileLoader().LoadFileWaitTillLoaded(tfile, DataSourceType.FILE); assertNotNull(af, "Failed to import new project"); @@ -144,6 +147,7 @@ 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); @@ -162,7 +166,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase assertTrue(af.isSaveAlignmentSuccessful(), "Failed to store as a project."); af.closeMenuItem_actionPerformed(true); - af = null; af = new FileLoader().LoadFileWaitTillLoaded(tfile, DataSourceType.FILE); assertNotNull(af, "Failed to import new project"); @@ -180,6 +183,7 @@ 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); @@ -268,6 +272,7 @@ 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."); @@ -286,6 +291,7 @@ 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."); @@ -294,9 +300,10 @@ public class Jalview2xmlTests extends Jalview2xmlBase // count number of PDB mappings the structure selection manager holds - String pdbFile = af.getCurrentView().getStructureSelectionManager() .findFileForPDBId("1A70"); - assertEquals( - af.getCurrentView().getStructureSelectionManager() - .getMapping(pdbFile).length, + StructureMapping[] x = af.getCurrentView() + .getStructureSelectionManager()// + .getMapping(pdbFile); + assertEquals(x.length, 2, "Expected only two mappings for 1A70"); } @@ -306,6 +313,7 @@ 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."); @@ -367,6 +375,7 @@ 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."); @@ -406,7 +415,7 @@ 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); @@ -460,6 +469,7 @@ 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."); @@ -593,6 +603,7 @@ 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."); @@ -714,6 +725,7 @@ 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."); @@ -813,6 +825,7 @@ 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); @@ -906,6 +919,7 @@ 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); @@ -1066,6 +1080,7 @@ 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); @@ -1084,6 +1099,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase Desktop.getInstance().closeAll_actionPerformed(null); // complex project - one dataset, several views on several alignments + // Jalview.setSynchronous(true); AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded( "examples/testdata/projects/manyViews.jvp", DataSourceType.FILE); @@ -1126,6 +1142,7 @@ 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"); -- 1.7.10.2