1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ext.ensembl; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertTrue; |
24 |
|
|
25 |
|
import jalview.datamodel.AlignmentI; |
26 |
|
|
27 |
|
import java.net.MalformedURLException; |
28 |
|
import java.net.URL; |
29 |
|
import java.util.List; |
30 |
|
|
31 |
|
import org.testng.annotations.BeforeMethod; |
32 |
|
import org.testng.annotations.Test; |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 9 |
Complexity Density: 0.82 |
|
34 |
|
public class EnsemblRestClientTest |
35 |
|
{ |
36 |
|
private EnsemblRestClient sf; |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
4-
|
|
38 |
0 |
@Test(suiteName = "live")... |
39 |
|
public void testIsEnsemblAvailable() |
40 |
|
{ |
41 |
0 |
boolean isAvailable = sf.isEnsemblAvailable(); |
42 |
0 |
if (isAvailable) |
43 |
|
{ |
44 |
0 |
System.out.println("Ensembl is UP!"); |
45 |
|
} |
46 |
|
else |
47 |
|
{ |
48 |
0 |
System.err.println( |
49 |
|
"Ensembl is DOWN or unreachable ******************* BAD!"); |
50 |
|
} |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
0 |
@BeforeMethod(alwaysRun = true)... |
54 |
|
protected void setUp() |
55 |
|
{ |
56 |
0 |
sf = new EnsemblRestClient() |
57 |
|
{ |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0 |
@Override... |
60 |
|
public String getDbName() |
61 |
|
{ |
62 |
0 |
return null; |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0 |
@Override... |
66 |
|
public AlignmentI getSequenceRecords(String queries) throws Exception |
67 |
|
{ |
68 |
0 |
return null; |
69 |
|
} |
70 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
0 |
@Override... |
72 |
|
protected URL getUrl(List<String> ids) throws MalformedURLException |
73 |
|
{ |
74 |
0 |
return null; |
75 |
|
} |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
0 |
@Override... |
78 |
|
protected boolean useGetRequest() |
79 |
|
{ |
80 |
0 |
return false; |
81 |
|
} |
82 |
|
}; |
83 |
|
} |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
4-
|
|
85 |
0 |
@Test(groups = "Network")... |
86 |
|
public void testCheckEnsembl_overload() |
87 |
|
{ |
88 |
0 |
for (int i = 0; i < 20; i++) |
89 |
|
{ |
90 |
0 |
assertTrue(sf.checkEnsembl(), "Error on " + (i + 1) + "th ping"); |
91 |
|
} |
92 |
|
} |
93 |
|
} |