X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Ffts%2Fthreedbeacons%2FTDBeaconsFTSRestClientTest.java;fp=test%2Fjalview%2Ffts%2Fthreedbeacons%2FTDBeaconsFTSRestClientTest.java;h=be7622296073a1fa232359b36bd954239e1ed470;hb=0b4e71bc98cc0071159b05a0358e1e36b6bb1361;hp=0000000000000000000000000000000000000000;hpb=00974ead1f9b7c9690f33b87bf31c6817446c8aa;p=jalview.git diff --git a/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java new file mode 100644 index 0000000..be76222 --- /dev/null +++ b/test/jalview/fts/threedbeacons/TDBeaconsFTSRestClientTest.java @@ -0,0 +1,76 @@ +package jalview.fts.threedbeacons; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.testng.Assert; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import jalview.fts.api.FTSDataColumnI; +import jalview.fts.core.FTSRestRequest; +import jalview.fts.core.FTSRestResponse; +import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient; +import jalview.gui.JvOptionPane; + +public class TDBeaconsFTSRestClientTest +{ + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + + @BeforeMethod(alwaysRun = true) + public void setUp() throws Exception + { + } + + @AfterMethod(alwaysRun = true) + public void tearDown() throws Exception + { + } + + @Test(groups = { "External", "Network" }) + + public void executeRequestTest() + { + List wantedFields = new ArrayList(); + try + { + wantedFields.add(TDBeaconsFTSRestClient.getInstance() + .getDataColumnByNameOrCode("uniprot_entry")); + } catch (Exception e1) + { + e1.printStackTrace(); + } + System.out.println(wantedFields); + + FTSRestRequest request = new FTSRestRequest(); + //request.setAllowEmptySeq(false); + //request.setResponseSize(100); + request.setSearchTerm("01308.json"); + //request.setWantedFields(wantedFields); + System.out.println(request.toString()); + + FTSRestResponse response; + try + { + response = TDBeaconsFTSRestClient.getInstance().executeRequest(request); + } catch (Exception e) + { + e.printStackTrace(); + Assert.fail("Couldn't execute webservice call!"); + return; + } + //assertTrue(response.getNumberOfItemsFound() > 99); + assertTrue(response.getSearchSummary() != null); + assertTrue(response.getSearchSummary().size() > 99); + } + +}