Merge branch 'develop' into features/JAL-518_justify_seqs_in_region
[jalview.git] / test / jalview / ws / sifts / SiftsClientTest.java
index 44a6a02..d5b2e0b 100644 (file)
@@ -195,8 +195,11 @@ public class SiftsClientTest
     SiftsSettings.setCacheThresholdInDays("2");
     SiftsSettings.setFailSafePIDThreshold("70");
     PDBfile pdbFile;
+
     pdbFile = new PDBfile(false, false, false,
             "test/jalview/io/" + testPDBId + ".pdb", DataSourceType.FILE);
+    // TODO: this uses a network connection - we should mock the sifts
+    // testPDBId.xml.gz
     siftsClient = new SiftsClient(pdbFile);
   }
 
@@ -206,6 +209,14 @@ public class SiftsClientTest
     siftsClient = null;
   }
 
+  @Test(groups = { "Functional" })
+  public void testSIFTsDownloadURL()
+  {
+    String expectedUrl = "https://ftp.ebi.ac.uk/pub/databases/msd/sifts/split_xml/xy/1xyz.sifts.xml.gz";
+    Assert.assertEquals(SiftsClient.getDownloadUrlFor("1xyz.sifts.xml.gz"),
+            expectedUrl);
+  }
+
   @Test(groups = { "Network" })
   public void getSIFTsFileTest() throws SiftsException, IOException
   {
@@ -215,7 +226,7 @@ public class SiftsClientTest
     long t1 = siftsFile.lastModified();
 
     // re-read file should be returned from cache
-    siftsFile = SiftsClient.downloadSiftsFile(testPDBId);
+    siftsFile = SiftsClient.getSiftsFile(testPDBId);
     FileAssert.assertFile(siftsFile);
     long t2 = siftsFile.lastModified();
     assertEquals(t1, t2);
@@ -368,7 +379,8 @@ public class SiftsClientTest
   {
     SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH");
     DBRefEntry invalidDBRef = new DBRefEntry();
-    invalidDBRef.setAccessionId("BLAR");
+    invalidDBRef.setAccessionId("BLAR"); // note no version is set, so also
+                                         // invalid
     invalidTestSeq.addDBRef(invalidDBRef);
     siftsClient.getValidSourceDBRef(invalidTestSeq);
   }