Slight refactoring
[jabaws.git] / webservices / compbio / ws / client / WSTester.java
index 4f721fe..def8efe 100644 (file)
@@ -26,9 +26,12 @@ import java.io.ByteArrayInputStream;
 import java.io.Closeable;\r
 import java.io.IOException;\r
 import java.io.PrintWriter;\r
+import java.net.ConnectException;\r
 import java.util.Arrays;\r
 import java.util.List;\r
 \r
+import javax.xml.ws.WebServiceException;\r
+\r
 import org.apache.log4j.Logger;\r
 \r
 import compbio.data.msa.JABAService;\r
@@ -116,6 +119,15 @@ public class WSTester {
        private final PrintWriter writer;\r
        private final String hostname;\r
 \r
+       /**\r
+        * Construct an instance of JABAWS tester\r
+        * \r
+        * @param hostname\r
+        *            - fully qualified host and context name of JABAWS e.g.\r
+        *            http://nanna.cluster.lifesci.dundee.ac.uk:8080/jaba\r
+        * @param writer\r
+        *            a PrintWriter instance to writer test log to.\r
+        */\r
        public WSTester(String hostname, PrintWriter writer) {\r
                if (Util.isEmpty(hostname)) {\r
                        throw new NullPointerException("Hostname must be provided!");\r
@@ -403,7 +415,17 @@ public class WSTester {
 \r
        }\r
 \r
-       public boolean checkService(Services service) {\r
+       /**\r
+        * Test JABA web service\r
+        * \r
+        * @param service\r
+        *            the service to test\r
+        * @return true if the service works as expected, false otherwise\r
+        * @throws WebServiceException\r
+        * @throws ConnectException\r
+        */\r
+       public boolean checkService(Services service) throws ConnectException,\r
+                       WebServiceException {\r
                JABAService ws = Jws2Client.connect(hostname, service);\r
                if (ws == null) {\r
                        writer.println("Cannot estabilish the connection to host "\r