From: Jim Procter Date: Fri, 19 Aug 2016 10:57:00 +0000 (+0100) Subject: JAL-2154 fix looping structure so for a particular pass (either 2-pass: retrieve... X-Git-Tag: Release_2_10_0~47^2~4^2~43^2~31 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e2c039f9c1d5f08af9bebbab26cd0ae4dbcb7ace;p=jalview.git JAL-2154 fix looping structure so for a particular pass (either 2-pass: retrieve cross-ref+save/recover from project or one pass: retrieve cross-ref and compare string) we do all cross-refs or dbfetches in a pass. --- diff --git a/test/jalview/io/CrossRef2xmlTests.java b/test/jalview/io/CrossRef2xmlTests.java index b330b2d..cc26d7e 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -127,11 +127,11 @@ public class CrossRef2xmlTests extends Jalview2xmlBase : new CrossRef(seqs, dataset) .findXrefSourcesForSequences(dna); + pass2 = 0; + do // second cross ref and recover crossref loop + { for (String db : ptypes) { - pass2 = 0; - do // second cross ref and recover crossref loop - { // counter for splitframe views retrieved via crossref int p = 0; // build next key so we an retrieve all views @@ -192,21 +192,22 @@ public class CrossRef2xmlTests extends Jalview2xmlBase : new CrossRef(xrseqs, dataset) .findXrefSourcesForSequences(avp .getAlignViewport().isNucleotide()); - for (String xrefdb : xrptypes) + pass3 = 0; + do // 3rd cross ref and recover crossref loop { - pass3 = 0; - do // 3rd cross ref and recover crossref loop + for (String xrefdb : xrptypes) { List cra_views2 = new ArrayList(); int q = 0; String nextnextxref = "{" + p + "}" + nextxref + " -> " + xrefdb + "{" + q + "}"; - AlignFrame nextaf = Desktop.getAlignFrameFor(avp - .getAlignViewport()); if (pass3 == 0) { + AlignFrame nextaf = Desktop.getAlignFrameFor(avp + .getAlignViewport()); + cra = new CrossRefAction(nextaf, xrseqs, avp .getAlignViewport().isNucleotide(), xrefdb); cra.run(); @@ -263,11 +264,20 @@ public class CrossRef2xmlTests extends Jalview2xmlBase nextavp); keyseq.add(nextnextxref); } - } while (pass3++ < 2 && pass2 < 1); - } + } // end of loop around showing all xrefdb for crossrf2 + // fetchdb->crossref1->crossref-2->verify for xrefs we + // either loop twice when pass2=0, or just once when pass2=1 + // (recovered project from previous crossref) + } while (pass3++ < 2 && pass2 < 1); } - } while (pass2++ < 2 && pass1 < 1); } + // fetchdb-->crossref1 + // for each xref we try to retrieve xref, store and verify when + // pass1=0, or just retrieve and verify when pass1=1 + } while (pass2++ < 2 && pass1 < 1); + // fetchdb + // for each ref we + // loop twice: first, do the retrieve, second recover from saved project } while (++pass1 < 2); } } @@ -299,22 +309,22 @@ public class CrossRef2xmlTests extends Jalview2xmlBase if (savedProjects != null) { if (savedProjects.get(xrefpath) == null) - { - // write a project file for this view. On the second pass, this will be - // recovered and cross-references verified - try - { - File prfile = File.createTempFile("crossRefTest", ".jvp"); - AlignFrame af = Desktop.getAlignFrameFor(avp.getAlignViewport()); - new Jalview2XML(false).saveAlignment(af, prfile.toString(), - af.getTitle()); - System.out.println("Written view from '" + xrefpath + "' as '" - + prfile.getAbsolutePath() + "'"); - savedProjects.put(xrefpath, prfile); - } catch (IOException q) { - Assert.fail("Unexpected IO Exception", q); - } + // write a project file for this view. On the second pass, this will be + // recovered and cross-references verified + try + { + File prfile = File.createTempFile("crossRefTest", ".jvp"); + AlignFrame af = Desktop.getAlignFrameFor(avp.getAlignViewport()); + new Jalview2XML(false).saveAlignment(af, prfile.toString(), + af.getTitle()); + System.out.println("Written view from '" + xrefpath + "' as '" + + prfile.getAbsolutePath() + "'"); + savedProjects.put(xrefpath, prfile); + } catch (IOException q) + { + Assert.fail("Unexpected IO Exception", q); + } } else {