X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=testsrc%2Fcompbio%2Fdata%2Fmsa%2FCategoryTester.java;fp=testsrc%2Fcompbio%2Fdata%2Fmsa%2FCategoryTester.java;h=00a93f489c476c663915cd6ad284960d2a5b0468;hb=babb6decd107f2769f1fbcce00afcda16bd07110;hp=0000000000000000000000000000000000000000;hpb=8bb35115758f447219bef40d3e7c1f1ac9ba3ed6;p=proteocache.git diff --git a/testsrc/compbio/data/msa/CategoryTester.java b/testsrc/compbio/data/msa/CategoryTester.java new file mode 100644 index 0000000..00a93f4 --- /dev/null +++ b/testsrc/compbio/data/msa/CategoryTester.java @@ -0,0 +1,70 @@ +package compbio.data.msa; + +import java.net.ConnectException; +import java.util.Set; + +import javax.xml.ws.WebServiceException; + +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import compbio.metadata.AllTestSuit; +import compbio.ws.client.Jws2Client; +import compbio.ws.client.Services; +import compbio.ws.client.WSTesterTester; + +public class CategoryTester { + + // test category membership from string constants + RegistryWS registry = null; + + @BeforeTest(groups = AllTestSuit.test_group_webservices) + public void setupTest() { + try { + /* + * registry = Jws2Client .connectToRegistry( + * "http://webserv1.cluster.lifesci.dundee.ac.uk:8089/jaba"); + */ + registry = Jws2Client.connectToRegistry(WSTesterTester.SERVER); + + } catch (ConnectException e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } catch (WebServiceException e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + + } + + /* + * This test will FAIL unless a connection to a running JABAWS web server is + * made! + */ + @Test(groups = AllTestSuit.test_group_webservices) + public void categoryTest() { + Set servicecategories = registry.getServiceCategories(); + + boolean found = false; + for (Category svccategory : servicecategories) { + + Set catservices; + + for (String category : new String[]{Category.CATEGORY_ALIGNMENT, + Category.CATEGORY_CONSERVATION, Category.CATEGORY_DISORDER}) { + if (category.equals(svccategory.name)) { + found = true; + catservices = svccategory.getServices(); + System.out.println("Found " + catservices.size() + + " services in category " + category + + "(service category string " + svccategory + ")"); + } + } + } + if (!found) { + Assert.fail("Could not match any category to one of the given category constants"); + } + } + +}