1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.fts.threedbeacons; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertNull; |
24 |
|
import static org.testng.AssertJUnit.assertEquals; |
25 |
|
import static org.testng.AssertJUnit.assertTrue; |
26 |
|
|
27 |
|
import java.io.IOException; |
28 |
|
import java.net.URL; |
29 |
|
import java.nio.charset.StandardCharsets; |
30 |
|
import java.util.ArrayList; |
31 |
|
import java.util.Collection; |
32 |
|
import java.util.HashSet; |
33 |
|
import java.util.List; |
34 |
|
import java.util.Set; |
35 |
|
|
36 |
|
import org.testng.Assert; |
37 |
|
import org.testng.annotations.AfterMethod; |
38 |
|
import org.testng.annotations.BeforeClass; |
39 |
|
import org.testng.annotations.BeforeMethod; |
40 |
|
import org.testng.annotations.Test; |
41 |
|
|
42 |
|
import jalview.datamodel.Sequence; |
43 |
|
import jalview.fts.api.FTSData; |
44 |
|
import jalview.fts.api.FTSDataColumnI; |
45 |
|
import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI; |
46 |
|
import jalview.fts.core.FTSRestClient; |
47 |
|
import jalview.fts.core.FTSRestRequest; |
48 |
|
import jalview.fts.core.FTSRestResponse; |
49 |
|
import jalview.fts.service.pdb.PDBFTSRestClientTest; |
50 |
|
import jalview.fts.service.threedbeacons.TDB_FTSData; |
51 |
|
import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient; |
52 |
|
import jalview.gui.JvOptionPane; |
53 |
|
import jalview.gui.structurechooser.PDBStructureChooserQuerySource; |
54 |
|
import jalview.gui.structurechooser.TDBResultAnalyser; |
55 |
|
import jalview.gui.structurechooser.ThreeDBStructureChooserQuerySource; |
56 |
|
|
|
|
| 64.6% |
Uncovered Elements: 64 (181) |
Complexity: 38 |
Complexity Density: 0.24 |
|
57 |
|
public class TDBeaconsFTSRestClientTest |
58 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
59 |
1 |
@BeforeClass(alwaysRun = true)... |
60 |
|
public void setUpJvOptionPane() |
61 |
|
{ |
62 |
1 |
JvOptionPane.setInteractiveMode(false); |
63 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
64 |
|
} |
65 |
|
|
66 |
|
private FTSRestClient ftsRestClient; |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
13 |
@BeforeMethod(alwaysRun = true)... |
69 |
|
public void setUp() throws Exception |
70 |
|
{ |
71 |
13 |
ftsRestClient = new FTSRestClient() |
72 |
|
{ |
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
11 |
@Override... |
75 |
|
public String getColumnDataConfigFileName() |
76 |
|
{ |
77 |
11 |
return "/fts/tdbeacons_data_columns.txt"; |
78 |
|
} |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
0 |
@Override... |
81 |
|
public FTSRestResponse executeRequest(FTSRestRequest ftsRequest) |
82 |
|
throws Exception |
83 |
|
{ |
84 |
0 |
return null; |
85 |
|
} |
86 |
|
}; |
87 |
|
} |
88 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
89 |
13 |
@AfterMethod(alwaysRun = true)... |
90 |
|
public void tearDown() throws Exception |
91 |
|
{ |
92 |
|
} |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
4-
|
|
94 |
0 |
@Test... |
95 |
|
public void getAllDefaulDisplayedDataColumns() |
96 |
|
{ |
97 |
|
|
98 |
0 |
Assert.assertNotNull( |
99 |
|
ftsRestClient.getAllDefaultDisplayedFTSDataColumns()); |
100 |
0 |
System.out |
101 |
|
.println(ftsRestClient.getAllDefaultDisplayedFTSDataColumns()); |
102 |
0 |
Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns() |
103 |
|
.isEmpty()); |
104 |
0 |
Assert.assertEquals( |
105 |
|
ftsRestClient.getAllDefaultDisplayedFTSDataColumns().size(), |
106 |
|
15); |
107 |
|
} |
108 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1PASS
|
|
109 |
1 |
@Test(groups = { "Functional" })... |
110 |
|
public void getPrimaryKeyColumIndexTest() |
111 |
|
{ |
112 |
1 |
Collection<FTSDataColumnI> wantedFields = ftsRestClient |
113 |
|
.getAllDefaultDisplayedFTSDataColumns(); |
114 |
1 |
int foundIndex = -1; |
115 |
1 |
try |
116 |
|
{ |
117 |
1 |
Assert.assertEquals(foundIndex, -1); |
118 |
1 |
foundIndex = ftsRestClient.getPrimaryKeyColumIndex(wantedFields, |
119 |
|
false); |
120 |
1 |
Assert.assertEquals(foundIndex, 12); |
121 |
1 |
foundIndex = ftsRestClient.getPrimaryKeyColumIndex(wantedFields, |
122 |
|
true); |
123 |
|
|
124 |
1 |
Assert.assertEquals(foundIndex, 13); |
125 |
|
} catch (Exception e) |
126 |
|
{ |
127 |
0 |
e.printStackTrace(); |
128 |
0 |
Assert.fail("Exception thrown while testing..."); |
129 |
|
} |
130 |
|
} |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
132 |
1 |
@Test(groups = { "Functional" })... |
133 |
|
public void getDataColumnsFieldsAsCommaDelimitedString() |
134 |
|
{ |
135 |
|
|
136 |
1 |
Collection<FTSDataColumnI> wantedFields = ftsRestClient |
137 |
|
.getAllDefaultDisplayedFTSDataColumns(); |
138 |
1 |
String actual = ftsRestClient |
139 |
|
.getDataColumnsFieldsAsCommaDelimitedString(wantedFields); |
140 |
1 |
Assert.assertEquals(actual, |
141 |
|
"uniprot_start,uniprot_end,provider,model_identifier,model_category,model_title,resolution,confidence_avg_local_score,confidence_type,confidence_version,coverage,created,model_url,model_format,model_page_url"); |
142 |
|
} |
143 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
144 |
1 |
@Test(groups = { "Functional" })... |
145 |
|
public void getAllFTSDataColumns() |
146 |
|
{ |
147 |
1 |
Collection<FTSDataColumnI> allFields = ftsRestClient |
148 |
|
.getAllFTSDataColumns(); |
149 |
1 |
Assert.assertNotNull(allFields); |
150 |
|
|
151 |
1 |
Assert.assertEquals(allFields.size(), 20); |
152 |
|
} |
153 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
154 |
1 |
@Test(groups = { "Functional" })... |
155 |
|
public void getSearchableDataColumns() |
156 |
|
{ |
157 |
|
|
158 |
1 |
Collection<FTSDataColumnI> searchableFields = ftsRestClient |
159 |
|
.getSearchableDataColumns(); |
160 |
1 |
Assert.assertNotNull(searchableFields); |
161 |
|
|
162 |
1 |
Assert.assertEquals(searchableFields.size(), 1); |
163 |
|
|
164 |
|
} |
165 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
1PASS
|
|
166 |
1 |
@Test(groups = { "Functional" })... |
167 |
|
public void getPrimaryKeyColumn() |
168 |
|
{ |
169 |
|
|
170 |
1 |
FTSDataColumnI expectedPKColumn; |
171 |
1 |
try |
172 |
|
{ |
173 |
1 |
expectedPKColumn = ftsRestClient.getDataColumnByNameOrCode("Url"); |
174 |
1 |
Assert.assertNotNull(ftsRestClient.getPrimaryKeyColumn()); |
175 |
1 |
Assert.assertEquals(ftsRestClient.getPrimaryKeyColumn(), |
176 |
|
expectedPKColumn); |
177 |
|
} catch (Exception e) |
178 |
|
{ |
179 |
0 |
e.printStackTrace(); |
180 |
0 |
Assert.fail("Exception thrown while testing..."); |
181 |
|
} |
182 |
|
} |
183 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
184 |
1 |
@Test(groups = { "Functional" })... |
185 |
|
public void getDataColumnByNameOrCode() |
186 |
|
{ |
187 |
1 |
try |
188 |
|
{ |
189 |
1 |
FTSDataColumnI foundDataCol = ftsRestClient |
190 |
|
.getDataColumnByNameOrCode("uniprot_accession"); |
191 |
1 |
Assert.assertNotNull(foundDataCol); |
192 |
1 |
Assert.assertEquals(foundDataCol.getName(), "UniProt Accession"); |
193 |
|
} catch (Exception e) |
194 |
|
{ |
195 |
0 |
e.printStackTrace(); |
196 |
0 |
Assert.fail("Exception thrown while testing..."); |
197 |
|
} |
198 |
|
} |
199 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
200 |
1 |
@Test(groups = { "Functional" })... |
201 |
|
public void getDataColumnGroupById() |
202 |
|
{ |
203 |
1 |
FTSDataColumnGroupI foundDataColGroup; |
204 |
1 |
try |
205 |
|
{ |
206 |
1 |
foundDataColGroup = ftsRestClient.getDataColumnGroupById("g2"); |
207 |
1 |
Assert.assertNotNull(foundDataColGroup); |
208 |
1 |
Assert.assertEquals(foundDataColGroup.getName(), "Quality"); |
209 |
|
} catch (Exception e) |
210 |
|
{ |
211 |
0 |
e.printStackTrace(); |
212 |
|
} |
213 |
|
} |
214 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
215 |
1 |
@Test(groups = { "Functional" })... |
216 |
|
public void getDefaultResponsePageSize() |
217 |
|
{ |
218 |
1 |
int defaultResSize = ftsRestClient.getDefaultResponsePageSize(); |
219 |
1 |
Assert.assertEquals(defaultResSize, 100); |
220 |
|
|
221 |
|
} |
222 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
1PASS
|
|
223 |
1 |
@Test(groups = { "Functional" })... |
224 |
|
public void getColumnMinWidthTest() |
225 |
|
{ |
226 |
1 |
try |
227 |
|
{ |
228 |
1 |
FTSDataColumnI foundDataCol = ftsRestClient |
229 |
|
.getDataColumnByNameOrCode("uniprot_accession"); |
230 |
1 |
Assert.assertNotNull(foundDataCol); |
231 |
1 |
int actualColMinWidth = foundDataCol.getMinWidth(); |
232 |
1 |
Assert.assertEquals(actualColMinWidth, 50); |
233 |
|
} catch (Exception e) |
234 |
|
{ |
235 |
0 |
e.printStackTrace(); |
236 |
0 |
Assert.fail("Exception thrown while testing..."); |
237 |
|
} |
238 |
|
} |
239 |
|
|
240 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 2 |
Complexity Density: 0.22 |
1PASS
|
|
241 |
1 |
@Test(groups = { "Functional" })... |
242 |
|
public void getColumnClassTest() |
243 |
|
{ |
244 |
1 |
try |
245 |
|
{ |
246 |
1 |
FTSDataColumnI foundDataCol = ftsRestClient |
247 |
|
.getDataColumnByNameOrCode("uniprot_accession"); |
248 |
1 |
Assert.assertNotNull(foundDataCol); |
249 |
1 |
Assert.assertEquals(foundDataCol.getDataType().getDataTypeClass(), |
250 |
|
String.class); |
251 |
1 |
foundDataCol = ftsRestClient.getDataColumnByNameOrCode("id"); |
252 |
1 |
Assert.assertNotNull(foundDataCol); |
253 |
1 |
Assert.assertEquals(foundDataCol.getDataType().getDataTypeClass(), |
254 |
|
String.class); |
255 |
|
} catch (Exception e) |
256 |
|
{ |
257 |
0 |
e.printStackTrace(); |
258 |
0 |
Assert.fail("Exception thrown while testing..."); |
259 |
|
} |
260 |
|
} |
261 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
262 |
1 |
@Test(groups = { "Functional" })... |
263 |
|
public void coverageForEqualsAndHashFunction() |
264 |
|
{ |
265 |
1 |
Set<FTSDataColumnI> uniqueSet = new HashSet<FTSDataColumnI>(); |
266 |
1 |
Collection<FTSDataColumnI> searchableCols = ftsRestClient |
267 |
|
.getSearchableDataColumns(); |
268 |
1 |
System.out.println(searchableCols); |
269 |
1 |
for (FTSDataColumnI foundCol : searchableCols) |
270 |
|
{ |
271 |
1 |
System.out.println(foundCol.toString()); |
272 |
1 |
uniqueSet.add(foundCol); |
273 |
1 |
uniqueSet.add(foundCol); |
274 |
|
} |
275 |
1 |
Assert.assertTrue(!uniqueSet.isEmpty()); |
276 |
|
|
277 |
|
} |
278 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.33 |
1PASS
|
|
279 |
1 |
@Test(groups = { "Functional" })... |
280 |
|
public void getTDBIdColumIndexTest() |
281 |
|
{ |
282 |
1 |
List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>(); |
283 |
1 |
try |
284 |
|
{ |
285 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
286 |
|
.getDataColumnByNameOrCode("Model id")); |
287 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
288 |
|
.getDataColumnByNameOrCode("uniprot_accession")); |
289 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
290 |
|
.getDataColumnByNameOrCode("Title")); |
291 |
|
} catch (Exception e) |
292 |
|
{ |
293 |
0 |
e.printStackTrace(); |
294 |
|
} |
295 |
1 |
try |
296 |
|
{ |
297 |
1 |
assertEquals(4, TDBeaconsFTSRestClient.getInstance() |
298 |
|
.getPrimaryKeyColumIndex(wantedFields, true)); |
299 |
|
|
300 |
|
|
301 |
|
} catch (Exception e) |
302 |
|
{ |
303 |
0 |
e.printStackTrace(); |
304 |
|
} |
305 |
|
} |
306 |
|
|
307 |
|
private static String[][] mocks = { { "P38398.json", null }, |
308 |
|
{ "P01308.json", null }, |
309 |
|
{ "P0DTD1.json", null }, |
310 |
|
{ "P27787.json", null }, |
311 |
|
{ "Q99814.json", null } |
312 |
|
|
313 |
|
|
314 |
|
}; |
315 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
316 |
10 |
private static void setMockData()... |
317 |
|
{ |
318 |
10 |
try |
319 |
|
{ |
320 |
10 |
mocks[0][1] = PDBFTSRestClientTest.readJsonStringFromFile( |
321 |
|
"test/jalview/fts/threedbeacons/p38398_tdb_fts_query_resp.txt"); |
322 |
|
|
323 |
10 |
mocks[1][1] = PDBFTSRestClientTest.readJsonStringFromFile( |
324 |
|
"test/jalview/fts/threedbeacons/p01308_tdb_fts_query_resp.txt"); |
325 |
|
|
326 |
10 |
mocks[2][1] = PDBFTSRestClientTest.readJsonStringFromFile( |
327 |
|
"test/jalview/fts/threedbeacons/p0dtd1_tdb_fts_query_resp.txt"); |
328 |
|
|
329 |
10 |
mocks[3][1] = PDBFTSRestClientTest.readJsonStringFromFile( |
330 |
|
"test/jalview/fts/threedbeacons/p27787_tdb_fts_query_resp.txt"); |
331 |
10 |
mocks[4][1] = PDBFTSRestClientTest.readJsonStringFromFile( |
332 |
|
"test/jalview/fts/threedbeacons/q99814_tdb_fts_query_resp.txt"); |
333 |
|
|
334 |
|
} catch (IOException e) |
335 |
|
{ |
336 |
0 |
Assert.fail("Couldn't read mock response data", e); |
337 |
|
} |
338 |
|
} |
339 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
340 |
10 |
public static void setMock()... |
341 |
|
{ |
342 |
10 |
setMockData(); |
343 |
10 |
FTSRestClient.createMockFTSRestClient( |
344 |
|
(FTSRestClient) TDBeaconsFTSRestClient.getInstance(), mocks); |
345 |
|
} |
346 |
|
|
347 |
|
private static String dev_url = "https://wwwdev.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/"; |
348 |
|
|
349 |
|
private static String prod_url = "https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/"; |
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
@throws |
359 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
360 |
0 |
@Test(groups = { "Network", "Integration" })... |
361 |
|
public void verifyMockTDBRequest() throws Exception |
362 |
|
{ |
363 |
0 |
setMockData(); |
364 |
0 |
for (String[] otherMock : mocks) |
365 |
|
{ |
366 |
0 |
verifyMockTDBRequest(otherMock[0], otherMock[1]); |
367 |
|
} |
368 |
|
} |
369 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
370 |
0 |
private void verifyMockTDBRequest(String mockRequest,... |
371 |
|
String _mockResponse) throws Exception |
372 |
|
{ |
373 |
0 |
URL tdb_req = new URL(prod_url + mockRequest); |
374 |
0 |
byte[] resp = tdb_req.openStream().readAllBytes(); |
375 |
0 |
String tresp = new String(resp, StandardCharsets.UTF_8); |
376 |
|
|
377 |
|
|
378 |
|
|
379 |
0 |
assertEquals(_mockResponse.trim(), tresp.trim()); |
380 |
|
} |
381 |
|
|
|
|
| 78.8% |
Uncovered Elements: 7 (33) |
Complexity: 4 |
Complexity Density: 0.12 |
1PASS
|
|
382 |
1 |
@Test(groups = { "Functional" })... |
383 |
|
public void testMockTDBRequest() |
384 |
|
{ |
385 |
|
|
386 |
1 |
setMock(); |
387 |
1 |
List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>(); |
388 |
1 |
try |
389 |
|
{ |
390 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
391 |
|
.getDataColumnByNameOrCode("Model Id")); |
392 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
393 |
|
.getDataColumnByNameOrCode("model_url")); |
394 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
395 |
|
.getDataColumnByNameOrCode("provider")); |
396 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
397 |
|
.getDataColumnByNameOrCode("model_category")); |
398 |
1 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
399 |
|
.getDataColumnByNameOrCode("qmean_avg_local_score")); |
400 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
401 |
|
.getDataColumnByNameOrCode("uniprot_start")); |
402 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
403 |
|
.getDataColumnByNameOrCode("uniprot_end")); |
404 |
|
} catch (Exception e1) |
405 |
|
{ |
406 |
1 |
e1.printStackTrace(); |
407 |
|
} |
408 |
1 |
System.out.println("wantedFields >>" + wantedFields); |
409 |
|
|
410 |
1 |
FTSRestRequest request = new FTSRestRequest(); |
411 |
1 |
FTSRestResponse response; |
412 |
|
|
413 |
1 |
request.setResponseSize(100); |
414 |
1 |
request.setFieldToSearchBy(""); |
415 |
1 |
request.setWantedFields(wantedFields); |
416 |
|
|
417 |
1 |
request.setSearchTerm("P00000.json"); |
418 |
|
|
419 |
1 |
try |
420 |
|
{ |
421 |
1 |
response = TDBeaconsFTSRestClient.getInstance() |
422 |
|
.executeRequest(request); |
423 |
|
|
424 |
1 |
assertNull(response); |
425 |
|
} catch (Exception e) |
426 |
|
{ |
427 |
0 |
e.printStackTrace(); |
428 |
0 |
Assert.fail("Unexpected failure during mock 3DBeacons 404 test"); |
429 |
|
} |
430 |
|
|
431 |
|
|
432 |
1 |
request.setSearchTerm("P38398.json"); |
433 |
1 |
System.out.println("request : " + request.getFieldToSearchBy()); |
434 |
|
|
435 |
|
|
436 |
1 |
try |
437 |
|
{ |
438 |
1 |
response = TDBeaconsFTSRestClient.getInstance() |
439 |
|
.executeRequest(request); |
440 |
|
} catch (Exception e) |
441 |
|
{ |
442 |
0 |
e.printStackTrace(); |
443 |
0 |
Assert.fail("Couldn't execute webservice call!"); |
444 |
0 |
return; |
445 |
|
} |
446 |
1 |
assertTrue(response.getSearchSummary() != null); |
447 |
1 |
assertTrue(response.getNumberOfItemsFound() > 3); |
448 |
1 |
System.out.println("Search summary : \n" + response.getSearchSummary()); |
449 |
|
|
450 |
|
|
451 |
|
} |
452 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 3 |
Complexity Density: 0.12 |
1PASS
|
|
453 |
0 |
@Test(groups = { "External", "Network" })... |
454 |
|
public void executeRequestTest() |
455 |
|
{ |
456 |
0 |
List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>(); |
457 |
0 |
try |
458 |
|
{ |
459 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
460 |
|
.getDataColumnByNameOrCode("Model Id")); |
461 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
462 |
|
.getDataColumnByNameOrCode("model_url")); |
463 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
464 |
|
.getDataColumnByNameOrCode("provider")); |
465 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
466 |
|
.getDataColumnByNameOrCode("model_category")); |
467 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
468 |
|
.getDataColumnByNameOrCode("confidence_avg_local_score")); |
469 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
470 |
|
.getDataColumnByNameOrCode("uniprot_start")); |
471 |
0 |
wantedFields.add(TDBeaconsFTSRestClient.getInstance() |
472 |
|
.getDataColumnByNameOrCode("uniprot_end")); |
473 |
|
} catch (Exception e1) |
474 |
|
{ |
475 |
0 |
e1.printStackTrace(); |
476 |
|
} |
477 |
0 |
System.out.println("wantedFields >>" + wantedFields); |
478 |
|
|
479 |
0 |
FTSRestRequest request = new FTSRestRequest(); |
480 |
0 |
request.setResponseSize(100); |
481 |
0 |
request.setFieldToSearchBy(""); |
482 |
0 |
request.setSearchTerm("P01318.json"); |
483 |
0 |
request.setWantedFields(wantedFields); |
484 |
0 |
System.out.println("request : " + request.getFieldToSearchBy()); |
485 |
|
|
486 |
|
|
487 |
0 |
FTSRestResponse response; |
488 |
0 |
try |
489 |
|
{ |
490 |
0 |
response = TDBeaconsFTSRestClient.getInstance() |
491 |
|
.executeRequest(request); |
492 |
|
} catch (Exception e) |
493 |
|
{ |
494 |
0 |
e.printStackTrace(); |
495 |
0 |
Assert.fail("Couldn't execute webservice call!"); |
496 |
0 |
return; |
497 |
|
} |
498 |
0 |
assertTrue(response.getSearchSummary() != null); |
499 |
0 |
assertTrue(response.getNumberOfItemsFound() > 3); |
500 |
0 |
System.out.println("Search summary : \n" + response.getSearchSummary()); |
501 |
|
|
502 |
|
} |
503 |
|
|
504 |
|
} |