Merge branch 'develop' into trialMerge
[jalview.git] / test / jalview / io / Jalview2xmlTests.java
index 0b72406..de12086 100644 (file)
@@ -77,9 +77,9 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     String inFile = "examples/RF00031_folded.stk";
     String tfile = File.createTempFile("JalviewTest", ".jvp")
             .getAbsolutePath();
-    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
-            FormatAdapter.FILE);
-    assertNotNull("Didn't read input file " + inFile, af);
+    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+            inFile, DataSourceType.FILE);
+    assertTrue("Didn't read input file " + inFile, af != null);
     int olddsann = countDsAnn(af.getViewport());
     assertTrue("Didn't find any dataset annotations", olddsann > 0);
     af.rnahelicesColour_actionPerformed(null);
@@ -87,11 +87,11 @@ public class Jalview2xmlTests extends Jalview2xmlBase
             "Couldn't apply RNA helices colourscheme",
             af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
     assertTrue("Failed to store as a project.",
-            af.saveAlignment(tfile, "Jalview"));
+            af.saveAlignment(tfile, FileFormat.Jalview));
     af.closeMenuItem_actionPerformed(true);
     af = null;
-    af = new FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
-    assertNotNull("Failed to import new project", af);
+    af = new FileLoader().LoadFileWaitTillLoaded(tfile, DataSourceType.FILE);
+    assertTrue("Failed to import new project", af != null);
     int newdsann = countDsAnn(af.getViewport());
     assertTrue(
             "Differing numbers of dataset sequence annotation\nOriginally "
@@ -111,22 +111,23 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii";
     String tfile = File.createTempFile("JalviewTest", ".jvp")
             .getAbsolutePath();
-    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
-            FormatAdapter.FILE);
+    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+            inFile, DataSourceType.FILE);
     assertNotNull("Didn't read input file " + inFile, af);
-    af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null);
+    af.loadJalviewDataFile(inAnnot, DataSourceType.FILE, null, null);
     assertSame("Didn't set T-coffee colourscheme", af.getViewport()
             .getGlobalColourScheme().getClass(), TCoffeeColourScheme.class);
     assertNotNull("Recognise T-Coffee score from string",
-            jalview.schemes.ColourSchemeProperty.getColour(af.getViewport()
+            ColourSchemeProperty.getColour(af.getViewport()
                     .getAlignment(), ColourSchemeProperty.getColourName(af
                     .getViewport().getGlobalColourScheme())));
 
     assertTrue("Failed to store as a project.",
-            af.saveAlignment(tfile, "Jalview"));
+            af.saveAlignment(tfile, FileFormat.Jalview));
     af.closeMenuItem_actionPerformed(true);
     af = null;
-    af = new FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
+    af = new FileLoader().LoadFileWaitTillLoaded(tfile,
+            DataSourceType.FILE);
     assertNotNull("Failed to import new project", af);
     assertSame("Didn't set T-coffee colourscheme for imported project.", af
             .getViewport().getGlobalColourScheme().getClass(),
@@ -141,10 +142,9 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva";
     String tfile = File.createTempFile("JalviewTest", ".jvp")
             .getAbsolutePath();
-    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
-            FormatAdapter.FILE);
+    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile, DataSourceType.FILE);
     assertNotNull("Didn't read input file " + inFile, af);
-    af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null);
+    af.loadJalviewDataFile(inAnnot, DataSourceType.FILE, null, null);
     AlignmentAnnotation[] aa = af.getViewport().getAlignment()
             .getSequenceAt(0).getAnnotation("IUPredWS (Short)");
     assertTrue(
@@ -166,11 +166,11 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     sg.addSequence(af.getViewport().getAlignment().getSequenceAt(2), true);
     af.alignPanel.alignmentChanged();
     assertTrue("Failed to store as a project.",
-            af.saveAlignment(tfile, "Jalview"));
+            af.saveAlignment(tfile, FileFormat.Jalview));
     af.closeMenuItem_actionPerformed(true);
     af = null;
-    af = new FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE);
-    assertNotNull("Failed to import new project", af);
+    af = new FileLoader().LoadFileWaitTillLoaded(tfile, DataSourceType.FILE);
+    assertTrue("Failed to import new project", af != null);
 
     // check for group and alignment colourschemes
 
@@ -226,7 +226,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     int origCount = Desktop.getAlignFrames() == null ? 0 : Desktop
             .getAlignFrames().length;
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+            "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull("Didn't read in the example file correctly.", af);
     assertTrue("Didn't gather the views in the example file.",
             Desktop.getAlignFrames().length == 1 + origCount);
@@ -239,7 +239,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     StructureImportSettings.setProcessSecondaryStructure(true);
     StructureImportSettings.setVisibleChainAnnotation(true);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+            "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull("Didn't read in the example file correctly.", af);
     AlignmentViewPanel sps = null;
     for (AlignmentViewPanel ap : af.alignPanel.alignFrame.getAlignPanels())
@@ -300,7 +300,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   public void testCopyViewSettings() throws Exception
   {
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+            "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull("Didn't read in the example file correctly.", af);
     AlignmentViewPanel sps = null, groups = null;
     for (AlignmentViewPanel ap : af.alignPanel.alignFrame.getAlignPanels())
@@ -340,7 +340,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     Desktop.instance.closeAll_actionPerformed(null);
 
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+            "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     Assert.assertEquals(Desktop.getAlignFrames().length, 1);
     String afid = af.getViewport().getSequenceSetId();
 
@@ -371,8 +371,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     {
       Assert.assertEquals(Desktop.getAlignFrames().length, 0);
     }
-    af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
-            FormatAdapter.FILE);
+    af = new FileLoader().LoadFileWaitTillLoaded(
+            tfile.getAbsolutePath(), DataSourceType.FILE);
     Assert.assertNotNull(af);
     Assert.assertEquals(
             Desktop.getAlignFrames().length,
@@ -393,7 +393,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     Desktop.instance.closeAll_actionPerformed(null);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
+            "examples/exampleFile_2_7.jar", DataSourceType.FILE);
     assertNotNull("Didn't read in the example file correctly.", af);
     String afid = af.getViewport().getSequenceSetId();
 
@@ -436,8 +436,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase
       Assert.assertEquals(Desktop.getAlignFrames().length, 0);
     }
 
-    af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
-            FormatAdapter.FILE);
+    af = new FileLoader().LoadFileWaitTillLoaded(
+            tfile.getAbsolutePath(), DataSourceType.FILE);
     afid = af.getViewport().getSequenceSetId();
 
     for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
@@ -526,7 +526,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
   {
     Desktop.instance.closeAll_actionPerformed(null);
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/uniref50.fa", FormatAdapter.FILE);
+            "examples/uniref50.fa", DataSourceType.FILE);
     assertNotNull("Didn't read in the example file correctly.", af);
     String afid = af.getViewport().getSequenceSetId();
     // make a second view of the alignment
@@ -604,9 +604,9 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     {
       Assert.assertEquals(Desktop.getAlignFrames().length, 0);
     }
-
-    af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
-            FormatAdapter.FILE);
+  
+    af = new FileLoader().LoadFileWaitTillLoaded(
+            tfile.getAbsolutePath(), DataSourceType.FILE);
     afid = af.getViewport().getSequenceSetId();
 
     for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
@@ -647,7 +647,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     Desktop.instance.closeAll_actionPerformed(null);
     String exampleFile = "examples/3W5V.pdb";
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(exampleFile,
-            FormatAdapter.FILE);
+            DataSourceType.FILE);
     assertNotNull("Didn't read in the example file correctly.", af);
     String afid = af.getViewport().getSequenceSetId();
 
@@ -696,7 +696,7 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     }
 
     AlignFrame restoredFrame = new FileLoader().LoadFileWaitTillLoaded(
-            tfile.getAbsolutePath(), FormatAdapter.FILE);
+            tfile.getAbsolutePath(), DataSourceType.FILE);
     String rfid = restoredFrame.getViewport().getSequenceSetId();
     AlignmentPanel[] rAlignPanels = Desktop.getAlignmentPanels(rfid);
     AlignmentViewPanel rap = rAlignPanels[0];