1 package compbio.test;
\r
3 import java.net.ConnectException;
\r
4 import java.util.Set;
\r
6 import javax.xml.ws.WebServiceException;
\r
8 import org.testng.Assert;
\r
9 import org.testng.annotations.BeforeTest;
\r
10 import org.testng.annotations.Test;
\r
12 import compbio.data.msa.Category;
\r
13 import compbio.data.msa.RegistryWS;
\r
14 import compbio.metadata.AllTestSuit;
\r
15 import compbio.ws.client.Jws2Client;
\r
16 import compbio.ws.client.Services;
\r
17 import compbio.ws.client.WSTesterTester;
\r
19 public class CategoryTester {
\r
21 // test category membership from string constants
\r
22 RegistryWS registry = null;
\r
24 @BeforeTest(groups = AllTestSuit.test_group_webservices)
\r
25 public void setupTest() {
\r
28 * registry = Jws2Client .connectToRegistry(
\r
29 * "http://webserv1.cluster.lifesci.dundee.ac.uk:8089/jaba");
\r
31 registry = Jws2Client.connectToRegistry(WSTesterTester.SERVER);
\r
33 } catch (ConnectException e) {
\r
34 e.printStackTrace();
\r
35 Assert.fail(e.getMessage());
\r
36 } catch (WebServiceException e) {
\r
37 e.printStackTrace();
\r
38 Assert.fail(e.getMessage());
\r
44 * This test will FAIL unless a connection to a running JABAWS web server is
\r
47 @Test(groups = AllTestSuit.test_group_webservices)
\r
48 public void categoryTest() {
\r
49 Set<Category> servicecategories = registry.getServiceCategories();
\r
51 boolean found = false;
\r
52 for (Category svccategory : servicecategories) {
\r
54 Set<Services> catservices;
\r
56 for (String category : new String[]{Category.CATEGORY_ALIGNMENT,
\r
57 Category.CATEGORY_CONSERVATION, Category.CATEGORY_DISORDER}) {
\r
58 if (category.equals(svccategory.name)) {
\r
60 catservices = svccategory.getServices();
\r
61 System.out.println("Found " + catservices.size()
\r
62 + " services in category " + category
\r
63 + "(service category string " + svccategory + ")");
\r
68 Assert.fail("Could not match any category to one of the given category constants");
\r