package jalview.ws.dbsources; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import jalview.analysis.AlignSeq; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.datamodel.SequenceI; import jalview.ext.ensembl.EnsemblGenomes; 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.BeforeTest; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** * A class to verify that remotely fetched data has an expected format and can * be successfully processed by Jalview. This is intended as a first line of * defence and early warning of service affecting changes to data fetched * externally. *
* This is class is not intended to cover remote services e.g. alignment. Nor
* should it duplicate tests already provided by other classes (such as
* PDBFTSRestClientTest). Or maybe we will relocate those tests here...
*/
public class RemoteFormatTest
{
SequenceFetcher sf;
@BeforeTest(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);
}
@DataProvider(name = "AccessionData")
protected Object[][] getAccessions()
{
return new Object[][] { { DBRefSource.UNIPROT, "P30419" },
{ DBRefSource.PDB, "1QIP" }, { DBRefSource.EMBL, "X53828" },
{ DBRefSource.EMBLCDS, "CAA37824" },
{ DBRefSource.ENSEMBL, "ENSG00000157764" },
{ new EnsemblGenomes().getDbSource(), "DDB_G0283883" },
{ new PfamFull().getDbSource(), "PF03760" },
{ new PfamSeed().getDbSource(), "PF03760" },
{ new RfamSeed().getDbSource(), "RF00014" } };
}
@Test(groups = "Network", dataProvider = "AccessionData")
public void testFetchAccession(String dbSource, String accessionId)
throws Exception
{
System.out.println("Fetching " + accessionId + " from " + dbSource);
List