--- /dev/null
+package compbio.test;\r
+\r
+import java.net.ConnectException;\r
+import java.util.Set;\r
+\r
+import javax.xml.ws.WebServiceException;\r
+\r
+import org.testng.Assert;\r
+import org.testng.annotations.BeforeTest;\r
+import org.testng.annotations.Test;\r
+\r
+import compbio.data.msa.Category;\r
+import compbio.data.msa.RegistryWS;\r
+import compbio.metadata.AllTestSuit;\r
+import compbio.ws.client.Jws2Client;\r
+import compbio.ws.client.Services;\r
+import compbio.ws.client.WSTesterTester;\r
+\r
+public class CategoryTester {\r
+\r
+ // test category membership from string constants\r
+ RegistryWS registry = null;\r
+\r
+ @BeforeTest(groups = AllTestSuit.test_group_webservices)\r
+ public void setupTest() {\r
+ try {\r
+ /*\r
+ * registry = Jws2Client .connectToRegistry(\r
+ * "http://webserv1.cluster.lifesci.dundee.ac.uk:8089/jaba");\r
+ */\r
+ registry = Jws2Client.connectToRegistry(WSTesterTester.SERVER);\r
+\r
+ } catch (ConnectException e) {\r
+ e.printStackTrace();\r
+ Assert.fail(e.getMessage());\r
+ } catch (WebServiceException e) {\r
+ e.printStackTrace();\r
+ Assert.fail(e.getMessage());\r
+ }\r
+\r
+ }\r
+\r
+ /*\r
+ * This test will FAIL unless a connection to a running JABAWS web server is\r
+ * made!\r
+ */\r
+ @Test(groups = AllTestSuit.test_group_webservices)\r
+ public void categoryTest() {\r
+ Set<Category> servicecategories = registry.getServiceCategories();\r
+\r
+ boolean found = false;\r
+ for (Category svccategory : servicecategories) {\r
+\r
+ Set<Services> catservices;\r
+\r
+ for (String category : new String[]{Category.CATEGORY_ALIGNMENT,\r
+ Category.CATEGORY_CONSERVATION, Category.CATEGORY_DISORDER}) {\r
+ if (category.equals(svccategory.name)) {\r
+ found = true;\r
+ catservices = svccategory.getServices();\r
+ System.out.println("Found " + catservices.size()\r
+ + " services in category " + category\r
+ + "(service category string " + svccategory + ")");\r
+ }\r
+ }\r
+ }\r
+ if (!found) {\r
+ Assert.fail("Could not match any category to one of the given category constants");\r
+ }\r
+ }\r
+\r
+}\r
public static final String CATEGORY_DISORDER = "Protein Disorder";\r
public static final String CATEGORY_CONSERVATION = "Conservation";\r
\r
- String name;\r
+ public String name;\r
Set<Services> services;\r
\r
private Category(String name, Set<Services> services) {\r
// Default constructor for JAXB\r
}\r
\r
- Set<Services> getServices() {\r
+ public Set<Services> getServices() {\r
return new TreeSet<Services>(services);\r
}\r
\r