further work on registry & WSTester nearly there
[jabaws.git] / testsrc / compbio / ws / server / RegistryWSTester.java
1 package compbio.ws.server;\r
2 \r
3 import static org.testng.Assert.assertEquals;\r
4 import static org.testng.Assert.assertNotNull;\r
5 import static org.testng.Assert.assertTrue;\r
6 import static org.testng.Assert.fail;\r
7 \r
8 import java.util.EnumSet;\r
9 \r
10 import org.testng.annotations.Test;\r
11 \r
12 import compbio.metadata.AllTestSuit;\r
13 import compbio.ws.client.Jws2Client;\r
14 import compbio.ws.client.Services;\r
15 import compbio.ws.client.WSTesterTester;\r
16 \r
17 public class RegistryWSTester {\r
18 \r
19         @Test(groups = {AllTestSuit.test_group_windows_only})\r
20         public void testGetSupportedServices() {\r
21                 compbio.data.msa.RegistryWS reg = Jws2Client\r
22                                 .connectToRegistry(WSTesterTester.SERVER);\r
23                 assertEquals(EnumSet.of(Services.AAConWS, Services.JronnWS,\r
24                                 Services.MuscleWS, Services.ClustalWS),\r
25                                 reg.getSupportedServices());\r
26         }\r
27         @Test()\r
28         public void testTestService() {\r
29                 compbio.data.msa.RegistryWS reg = Jws2Client\r
30                                 .connectToRegistry(WSTesterTester.SERVER);\r
31                 assertNotNull(reg.testService(Services.AAConWS));\r
32         }\r
33 \r
34         @Test(dependsOnMethods = {"testTestService"})\r
35         public void testIsOperating() {\r
36                 compbio.data.msa.RegistryWS reg = Jws2Client\r
37                                 .connectToRegistry(WSTesterTester.SERVER);\r
38                 assertTrue(reg.isOperating(Services.AAConWS));\r
39         }\r
40 \r
41         @Test(dependsOnMethods = {"testTestService"})\r
42         public void testGetLastTestedOn() {\r
43                 compbio.data.msa.RegistryWS reg = Jws2Client\r
44                                 .connectToRegistry(WSTesterTester.SERVER);\r
45                 assertNotNull(reg.getLastTestedOn(Services.AAConWS));\r
46         }\r
47 \r
48         @Test(dependsOnMethods = {"testTestService"})\r
49         public void testGetLastTested() {\r
50                 try {\r
51                         Thread.sleep(1000);\r
52                 } catch (InterruptedException e) {\r
53                         e.printStackTrace();\r
54                         fail(e.getMessage());\r
55                 }\r
56                 compbio.data.msa.RegistryWS reg = Jws2Client\r
57                                 .connectToRegistry(WSTesterTester.SERVER);\r
58                 System.out.println(reg.getLastTested(Services.AAConWS));\r
59                 assertTrue(reg.getLastTested(Services.AAConWS) > 0);\r
60         }\r
61 \r
62         @Test()\r
63         public void testTestAllServices() {\r
64                 compbio.data.msa.RegistryWS reg = Jws2Client\r
65                                 .connectToRegistry(WSTesterTester.SERVER);\r
66                 System.out.println(reg.testAllServices());\r
67         }\r
68 }\r