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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 3 |
Complexity Density: 0.2 |
|
33 |
|
public class RestClientTest |
34 |
|
{ |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
36 |
1 |
@BeforeClass(alwaysRun = true)... |
37 |
|
public void setUpJvOptionPane() |
38 |
|
{ |
39 |
1 |
JvOptionPane.setInteractiveMode(false); |
40 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
1PASS
|
|
46 |
1 |
@Test(groups = { "Functional" })... |
47 |
|
public void testGetRestClient() |
48 |
|
{ |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
53 |
|
|
54 |
1 |
RestClient[] clients = RestClient.getRestClients(); |
55 |
1 |
System.out.println("Got " + clients.length + " clients."); |
56 |
1 |
int i = 0; |
57 |
1 |
Vector<String> urls = new Vector<String>(); |
58 |
1 |
for (RestClient cl : clients) |
59 |
|
{ |
60 |
1 |
System.out.println("" + (++i) + ": " + cl.service.toString()); |
61 |
1 |
urls.add(cl.service.toString()); |
62 |
|
} |
63 |
1 |
RestClient.setRsbsServices(urls); |
64 |
|
|
65 |
1 |
RestClient[] restClients = RestClient.getRestClients(); |
66 |
1 |
assertEquals("", clients.length, restClients.length); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
2 |
for (i = 0; i < clients.length; i++) |
74 |
|
{ |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
1 |
assertEquals(clients[i].getRestDescription(), |
79 |
|
restClients[i].getRestDescription()); |
80 |
|
} |
81 |
|
} |
82 |
|
} |