From: gmungoc Date: Wed, 3 May 2017 10:52:24 +0000 (+0100) Subject: JAL-2246 test a Uniprot fetch X-Git-Tag: Release_2_10_2~3^2~110 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b6000a31609b8d7f6b9cca8df5d4878d393e2b24;p=jalview.git JAL-2246 test a Uniprot fetch --- diff --git a/test/jalview/ws/dbsources/RemoteFormatTest.java b/test/jalview/ws/dbsources/RemoteFormatTest.java index a9cad80..c390efc 100644 --- a/test/jalview/ws/dbsources/RemoteFormatTest.java +++ b/test/jalview/ws/dbsources/RemoteFormatTest.java @@ -1,18 +1,28 @@ package jalview.ws.dbsources; +import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.DBRefSource; +import jalview.datamodel.SequenceI; import jalview.fts.api.FTSData; import jalview.fts.api.FTSDataColumnI; import jalview.fts.api.FTSRestClientI; import jalview.fts.core.FTSRestRequest; import jalview.fts.core.FTSRestResponse; import jalview.fts.service.uniprot.UniProtFTSRestClient; +import jalview.ws.SequenceFetcher; +import jalview.ws.seqfetcher.DbSourceProxy; import java.util.ArrayList; import java.util.List; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; /** @@ -27,10 +37,24 @@ import org.testng.annotations.Test; */ public class RemoteFormatTest { + SequenceFetcher sf; + @Test(groups = "Network") - public void testFetchUniprot() + public void testFetchUniprot() throws Exception { - // P00340 + List sps = sf.getSourceProxy(DBRefSource.UNIPROT); + assertFalse(sps.isEmpty()); + AlignmentI response = sps.get(0).getSequenceRecords("P30419"); + assertNotNull(response); + assertEquals(response.getHeight(), 1); + SequenceI sq = response.getSequenceAt(0); + assertTrue("No PDBEntry on sequence.", sq.getAllPDBEntries().size() > 0); + assertTrue("No DBRef on sequence.", sq.getDBRefs().length > 0); + List dbr = sq.getPrimaryDBRefs(); + assertFalse(dbr.isEmpty()); + assertEquals( + "Sequence start/end doesn't match number of residues in sequence", + sq.getEnd() - sq.getStart() + 1, sq.getLength()); } @Test(groups = "Network") @@ -109,4 +133,17 @@ public class RemoteFormatTest assertFalse("Failed to filter out summary header row", header.getSummaryData()[0].toString().equalsIgnoreCase("Entry")); } + + @BeforeMethod(alwaysRun = true) + public void setUp() throws Exception + { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + // ensure 'add annotation from structure' is selected + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); + + sf = new SequenceFetcher(false); + } }