{
private int numberOfItemsFound;
- private int sequenceLength;
+ private Long sequenceLength;
private String responseTime;
this.searchSummary = searchSummary;
}
- public int getSequenceLength() {
+ public long getSequenceLength() {
return sequenceLength;
}
- public void setSequenceLength(int sequenceLength) {
- this.sequenceLength = sequenceLength;
+ public void setSequenceLength(Long seqLength) {
+ this.sequenceLength = seqLength;
}
/**
clientResponseClass = ClientResponse.class;
}
WebResource webResource;
- webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN)
- .queryParam("ac", query);
+ webResource = client.resource(DEFAULT_THREEDBEACONS_DOMAIN).path(query);
+ URI uri = webResource.getURI();
+// .queryParam("P", query);
// .queryParam("rows", String.valueOf(responseSize))
// .queryParam("P",query);
- URI uri = webResource.getURI();
-
- System.out.println(uri);
+// URI uri = webResource.getURI();
+ System.out.println(uri.toString());
// Execute the REST request
ClientResponse clientResponse = webResource
Map<String, Object> jsonObj = null;
String responseString = null;
- System.out.println("query >>>>>>> " + tdbRestRequest.toString());
+ //System.out.println("query >>>>>>> " + tdbRestRequest.toString());
// Check the response status and report exception if one occurs
int responseStatus = clientResponse.getStatus();
}
- public String setSearchTerm() {
- return null;
+ public String setSearchTerm(String term) {
+ return term;
}
public static FTSRestResponse parseTDBeaconsJsonResponse(
//String seqLength = tdbEntry.get("sequence_length").toString();
//int seqLength = Integer.valueOf(tdbEntry.get("sequence_length").toString());
- int seqLength = (int) ((Map<String, Object>) jsonObj.get("uniprot_entry")).get("sequence_length");
+ Long seqLength = (Long) ((Map<String, Object>) jsonObj.get("uniprot_entry")).get("sequence_length");
result = new ArrayList<>();
List<Object> structures = (List<Object>) jsonObj.get("structures");
int numFound = 0;
@Override
public String getColumnDataConfigFileName()
{
- // TODO Auto-generated method stub
- return null;
+ return "/fts/tdbeacons_data_columns.txt";
}
public static FTSRestClientI getInstance()
package jalview.fts.threedbeacons;
+import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import java.util.ArrayList;
import jalview.fts.core.FTSRestClient;
import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
+import jalview.fts.service.pdb.PDBFTSRestClient;
import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient;
import jalview.gui.JvOptionPane;
//Assert.assertEquals(uniqueSet.size(), 22); -> 1 or 2 currently for 3DB
}
+ @Test(groups = { "Functional" })
+ public void getTDBIdColumIndexTest()
+ {
+ List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
+ try
+ {
+ wantedFields.add(TDBeaconsFTSRestClient.getInstance()
+ .getDataColumnByNameOrCode("id"));
+ wantedFields.add(TDBeaconsFTSRestClient.getInstance()
+ .getDataColumnByNameOrCode("uniprot_accession"));
+ wantedFields.add(TDBeaconsFTSRestClient.getInstance()
+ .getDataColumnByNameOrCode("entry name"));
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ try
+ {
+ assertEquals(1, PDBFTSRestClient.getInstance()
+ .getPrimaryKeyColumIndex(wantedFields, true));
+// assertEquals(4, PDBFTSRestClient.getInstance()
+// .getPrimaryKeyColumIndex(wantedFields, false));
+ } catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
-
+
@Test(groups = { "External", "Network" })
public void executeRequestTest()
{
try
{
wantedFields.add(TDBeaconsFTSRestClient.getInstance()
- .getDataColumnByNameOrCode("model_category"));
+ .getDataColumnByNameOrCode("id"));
wantedFields.add(TDBeaconsFTSRestClient.getInstance()
- .getDataColumnByNameOrCode("provider"));
+ .getDataColumnByNameOrCode("uniprot_accession"));
wantedFields.add(TDBeaconsFTSRestClient.getInstance()
- .getDataColumnByNameOrCode("created"));
+ .getDataColumnByNameOrCode("entry name"));
} catch (Exception e1)
{
e1.printStackTrace();
System.out.println("wantedFields >>" + wantedFields);
FTSRestRequest request = new FTSRestRequest();
- //request.setAllowEmptySeq(false);
- //request.setResponseSize(100);
+ request.setResponseSize(100);
+ request.setFieldToSearchBy("P");
request.setSearchTerm("01308.json");
request.setWantedFields(wantedFields);
System.out.println("request : " + request.getFieldToSearchBy());
Assert.fail("Couldn't execute webservice call!");
return;
}
- //assertTrue(response.getNumberOfItemsFound() > 99);
assertTrue(response.getSearchSummary() != null);
- assertTrue(response.getSearchSummary().size() > 99);
+ assertTrue(response.getNumberOfItemsFound() > 99);
+ System.out.println(response.getSearchSummary().size());
}
}