1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.rest; |
22 |
|
|
23 |
|
import static org.testng.AssertJUnit.assertEquals; |
24 |
|
|
25 |
|
import jalview.bin.Cache; |
26 |
|
import jalview.gui.JvOptionPane; |
27 |
|
|
28 |
|
import java.util.Vector; |
29 |
|
|
30 |
|
import org.testng.annotations.BeforeClass; |
31 |
|
import org.testng.annotations.Test; |
32 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 3 |
Complexity Density: 0.2 |
|
33 |
|
public class RestClientTest |
34 |
|
{ |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
36 |
0 |
@BeforeClass(alwaysRun = true)... |
37 |
|
public void setUpJvOptionPane() |
38 |
|
{ |
39 |
0 |
JvOptionPane.setInteractiveMode(false); |
40 |
0 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
4-
|
|
46 |
0 |
@Test(groups = { "Functional" })... |
47 |
|
public void testGetRestClient() |
48 |
|
{ |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
0 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
53 |
|
|
54 |
0 |
RestClient[] clients = RestClient.getRestClients(); |
55 |
0 |
System.out.println("Got " + clients.length + " clients."); |
56 |
0 |
int i = 0; |
57 |
0 |
Vector<String> urls = new Vector<String>(); |
58 |
0 |
for (RestClient cl : clients) |
59 |
|
{ |
60 |
0 |
System.out.println("" + (++i) + ": " + cl.service.toString()); |
61 |
0 |
urls.add(cl.service.toString()); |
62 |
|
} |
63 |
0 |
RestClient.setRsbsServices(urls); |
64 |
|
|
65 |
0 |
RestClient[] restClients = RestClient.getRestClients(); |
66 |
0 |
assertEquals("", clients.length, restClients.length); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
0 |
for (i = 0; i < clients.length; i++) |
74 |
|
{ |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
0 |
assertEquals(clients[i].getRestDescription(), |
79 |
|
restClients[i].getRestDescription()); |
80 |
|
} |
81 |
|
} |
82 |
|
} |