X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fjabaws%2FDisorderAnnotExportImport.java;h=e8b6c2bd1caec3eb3322367e03ffc4e3607152d9;hb=90c2f45e60ed604705e81dd8af31bf0bfd3dbdef;hp=bd743e0e1f786c23615e8931a8c79ed30721b9b7;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git
diff --git a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java
index bd743e0..e8b6c2b 100644
--- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java
+++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java
@@ -1,43 +1,64 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jabaws;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
+import jalview.gui.JvOptionPane;
import jalview.io.AnnotationFile;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
import jalview.io.FormatAdapter;
import jalview.io.StockholmFileTest;
import jalview.ws.jws2.AADisorderClient;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import java.util.ArrayList;
+import java.util.List;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/*
+ * All methods in this class are set to the Network group because setUpBeforeClass will fail
+ * if there is no network.
+ */
+@Test(singleThreaded = true)
public class DisorderAnnotExportImport
{
+
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
public static String testseqs = "examples/uniref50.fa";
public static Jws2Discoverer disc;
@@ -48,12 +69,19 @@ public class DisorderAnnotExportImport
public static jalview.gui.AlignFrame af = null;
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
-
- jalview.bin.Cache.initLogger();
+ Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ Cache.initLogger();
disc = JalviewJabawsTestUtils.getJabawsDiscoverer();
+
+ while (disc.isRunning())
+ {
+ // don't get services until discoverer has finished
+ Thread.sleep(100);
+ }
+
iupreds = new ArrayList();
for (Jws2Instance svc : disc.getServices())
{
@@ -65,24 +93,25 @@ public class DisorderAnnotExportImport
assertTrue("Couldn't discover any IUPred services to use to test.",
iupreds.size() > 0);
jalview.io.FileLoader fl = new jalview.io.FileLoader(false);
- af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.FormatAdapter.FILE);
+ af = fl.LoadFileWaitTillLoaded(testseqs, jalview.io.DataSourceType.FILE);
assertNotNull("Couldn't load test data ('" + testseqs + "')", af);
}
- @AfterClass
+ @AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
if (af != null)
{
af.setVisible(false);
af.dispose();
+ af = null;
}
}
/**
* test for patches to JAL-1294
*/
- @Test
+ @Test(groups = { "External", "Network" })
public void testDisorderAnnotExport()
{
disorderClient = new AADisorderClient(iupreds.get(0), af, null, null);
@@ -98,32 +127,32 @@ public class DisorderAnnotExportImport
;
} while (af.getViewport().getCalcManager().isWorking());
AlignmentI orig_alig = af.getViewport().getAlignment();
- // NOTE: Consensus annotation row cannot be exported and reimported faithfully - so we remove them
+ // NOTE: Consensus annotation row cannot be exported and reimported
+ // faithfully - so we remove them
List toremove = new ArrayList();
- for (AlignmentAnnotation aa:orig_alig.getAlignmentAnnotation())
+ for (AlignmentAnnotation aa : orig_alig.getAlignmentAnnotation())
{
if (aa.autoCalculated)
{
toremove.add(aa);
}
}
- for (AlignmentAnnotation aa:toremove)
+ for (AlignmentAnnotation aa : toremove)
{
orig_alig.deleteAnnotation(aa);
}
- testAnnotationFileIO("Testing IUPred Annotation IO", orig_alig);
+ checkAnnotationFileIO("Testing IUPred Annotation IO", orig_alig);
}
- public static void testAnnotationFileIO(String testname, AlignmentI al)
+ static void checkAnnotationFileIO(String testname, AlignmentI al)
{
try
{
- String aligfileout = new FormatAdapter().formatSequences("PFAM",
- al.getSequencesArray());
- String anfileout = new AnnotationFile().printAnnotations(
- al.getAlignmentAnnotation(), al.getGroups(),
- al.getProperties());
+ String aligfileout = FileFormat.Pfam.getWriter(al).print(
+ al.getSequencesArray(), true);
+ String anfileout = new AnnotationFile()
+ .printAnnotationsForAlignment(al);
assertTrue(
"Test "
+ testname
@@ -139,22 +168,23 @@ public class DisorderAnnotExportImport
+ "\n<