/**\r
* Align a list of sequences with default settings.\r
* \r
- * Any dataset containing a greater number of sequences or the average\r
- * length of the sequences are greater then defined in the default Limit\r
+ * Any dataset containing a greater number of sequences or when the average\r
+ * length of the sequences are greater then defined in the default Limit,\r
* will not be accepted for an alignment operation and\r
* JobSubmissionException will be thrown.\r
* \r
* List of FastaSequence objects. The programme does not perform\r
* any sequence validity checks. Nor does it checks whether the\r
* sequences names are unique. It is responsibility of the caller\r
- * to validate this information\r
+ * to make sure of this\r
* @return jobId - unique identifier for the job\r
- * @throws JobSubmissionException. This\r
- * exception is thrown when the job could not be submitted due\r
- * to the following reasons: 1) The number of sequences in the\r
+ * @throws JobSubmissionException\r
+ * is thrown when the job could not be submitted due to the\r
+ * following reasons: 1) The number of sequences in the\r
* submission or their average length is greater then defined by\r
* the default Limit. 2) Any problems on the server side e.g. it\r
* is misconfigured or malfunction, is reported via this\r
* exception. In the first case the information on the limit\r
* could be obtained from an exception.\r
* @throws InvalidParameterException\r
- * thrown if input list of fasta sequence is null or empty\r
+ * thrown if input list of FASTA sequences is null or empty\r
* @throws UnsupportedRuntimeException\r
* thrown if server OS does not support native executables for a\r
- * given web service, e.g. JWS2 is deployed on Windows and Mafft\r
- * service is called\r
+ * given web service, e.g. JABAWS is deployed on Windows and\r
+ * Mafft service is called\r
* @throws LimitExceededException\r
- * is throw if the input sequences number or average length\r
- * exceeds what is defined by the limit\r
+ * is throw if the input sequences number or their average\r
+ * length exceeds what is defined by the limit\r
*/\r
String align(\r
@WebParam(name = "fastaSequences") List<FastaSequence> sequences)\r
* @param options\r
* A list of Options\r
* @return jobId - unique identifier for the job\r
- * @throws JobSubmissionException. This\r
- * exception is thrown when the job could not be submitted due\r
- * to the following reasons: 1) The number of sequences in the\r
+ * @throws JobSubmissionException\r
+ * is thrown when the job could not be submitted due to the\r
+ * following reasons: 1) The number of sequences in the\r
* submission or their average length is greater then defined by\r
* the default Limit. 2) Any problems on the server side e.g. it\r
* is misconfigured or malfunction, is reported via this\r
* boundaries. In both cases exception object contain the\r
* information on the violating Option.\r
* @throws InvalidParameterException\r
- * thrown if input list of fasta sequence is null or empty\r
+ * thrown if input list of FASTA sequence is null or empty\r
* @throws UnsupportedRuntimeException\r
* thrown if server OS does not support native executables for a\r
- * given web service, e.g. JWS2 is deployed on Windows and Mafft\r
- * service is called\r
+ * given web service, e.g. JABAWS is deployed on Windows and\r
+ * Mafft service is called\r
* @throws LimitExceededException\r
- * is throw if the input sequences number or average length\r
- * exceeds what is defined by the limit\r
+ * is throw if the input sequences number or their average\r
+ * length exceeds what is defined by the limit\r
*/\r
String customAlign(\r
@WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
JobSubmissionException, WrongParameterException;\r
\r
/**\r
- * Align a list of sequences with preset. @see Preset\r
+ * Align a list of sequences with preset.\r
* \r
* Limit for a presetName is used whether the calculation will be permitted\r
* or denied. If no Limit was defined for a presetName, than default limit\r
* @param preset\r
* A list of Options\r
* @return String - jobId - unique identifier for the job\r
- * @throws JobSubmissionException. This\r
- * exception is thrown when the job could not be submitted due\r
- * to the following reasons: 1) The number of sequences in the\r
+ * @throws JobSubmissionException\r
+ * is thrown when the job could not be submitted due to the\r
+ * following reasons: 1) The number of sequences in the\r
* submission or their average length is greater then defined by\r
* the default Limit. 2) Any problems on the server side e.g. it\r
* is misconfigured or malfunction, is reported via this\r
* boundaries. In both cases exception object contain the\r
* information on the violating Option.\r
* @throws InvalidParameterException\r
- * thrown if input list of fasta sequence is null or empty\r
+ * thrown if input list of FASTA sequence is null or empty\r
* @throws UnsupportedRuntimeException\r
* thrown if server OS does not support native executables for a\r
- * given web service, e.g. JWS2 is deployed on Windows and Mafft\r
- * service is called\r
+ * given web service, e.g. JABAWS is deployed on Windows and\r
+ * Mafft service is called\r
* @throws LimitExceededException\r
* is throw if the input sequences number or average length\r
* exceeds what is defined by the limit\r
+ * @see Preset\r
*/\r
String presetAlign(\r
@WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
JobSubmissionException, WrongParameterException;\r
\r
/**\r
- * Return the result of the job.\r
+ * Return the result of the job. This method waits for the job\r
+ * <code>jobId</code> to complete before return.\r
* \r
* @param jobId\r
* a unique job identifier\r
* @throws ResultNotAvailableException\r
* this exception is throw if the job execution was not\r
* successful or the result of the execution could not be found.\r
- * (e.g. removed). Exception could also be thrown is dues to the\r
+ * (e.g. removed). Exception could also be thrown due to the\r
* lower level problems on the server i.e. IOException,\r
* FileNotFoundException problems as well as\r
* UnknownFileFormatException.\r
* @throws InvalidParameterException\r
- * thrown if jobId is empty or cannot be recognised e.g. in\r
- * invalid format\r
+ * thrown if jobId is empty or is not recognised e.g. in invalid\r
+ * format\r
*/\r
Alignment getResult(@WebParam(name = "jobId") String jobId)\r
throws ResultNotAvailableException;\r
*/\r
public class WSTester {\r
\r
- /**\r
- * Sequences to be used as input for all WS\r
- */\r
- static final String fastaInput = ">Foobar\n"\r
- + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQLLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKA"\r
- + "\n>Barbar\n"\r
- + "ASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAHQLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI"\r
- + "\n>Foofriend\n"\r
- + "MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI\n";\r
+ /**\r
+ * Sequences to be used as input for all WS\r
+ */\r
+ static final String fastaInput = ">Foobar\n"\r
+ + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQLLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKA"\r
+ + "\n>Barbar\n"\r
+ + "ASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAHQLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI"\r
+ + "\n>Foofriend\n"\r
+ + "MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI\n";\r
\r
- static final List<FastaSequence> seqs = loadSeqs();\r
+ static final List<FastaSequence> seqs = loadSeqs();\r
\r
- private static final String FAILED = "FAILED";\r
- private static final String OK = "OK";\r
+ private static final String FAILED = "FAILED";\r
+ private static final String OK = "OK";\r
\r
- /**\r
- * Converting input to a form accepted by WS\r
- * \r
- * @return List of FastaSequence records\r
- */\r
- static List<FastaSequence> loadSeqs() {\r
- try {\r
- return SequenceUtil.readFasta(new ByteArrayInputStream(fastaInput\r
- .getBytes()));\r
- } catch (IOException ignored) {\r
- // Should not happen as a source is not a external stream\r
- ignored.printStackTrace();\r
+ /**\r
+ * Converting input to a form accepted by WS\r
+ * \r
+ * @return List of FastaSequence records\r
+ */\r
+ static List<FastaSequence> loadSeqs() {\r
+ try {\r
+ return SequenceUtil.readFasta(new ByteArrayInputStream(fastaInput\r
+ .getBytes()));\r
+ } catch (IOException ignored) {\r
+ // Should not happen as a source is not a external stream\r
+ ignored.printStackTrace();\r
+ }\r
+ return null;\r
}\r
- return null;\r
- }\r
\r
- /**\r
- * Prints usage\r
- */\r
- static void printUsage() {\r
- System.out.println("Usage: <Class or Jar file name> "\r
- + Jws2Client.hostkey + Jws2Client.pseparator\r
- + "host_and_context " + "<" + Jws2Client.servicekey\r
- + Jws2Client.pseparator + "serviceName>");\r
- System.out.println();\r
- System.out\r
- .println(Jws2Client.hostkey\r
- + Jws2Client.pseparator\r
- + "<host_and_context> - a full URL to the JWS2 web server including context path e.g. http://10.31.1.159:8080/ws");\r
- System.out\r
- .println(Jws2Client.servicekey\r
- + Jws2Client.pseparator\r
- + "<ServiceName> - optional if unspecified all services are tested otherwise one of "\r
- + Arrays.toString(Services.values()));\r
- System.out.println();\r
+ /**\r
+ * Prints usage\r
+ */\r
+ static void printUsage() {\r
+ System.out.println("Usage: <Class or Jar file name> "\r
+ + Jws2Client.hostkey + Jws2Client.pseparator\r
+ + "host_and_context " + "<" + Jws2Client.servicekey\r
+ + Jws2Client.pseparator + "serviceName>");\r
+ System.out.println();\r
+ System.out\r
+ .println(Jws2Client.hostkey\r
+ + Jws2Client.pseparator\r
+ + "<host_and_context> - a full URL to the JABAWS web server including context path e.g. http://10.31.1.159:8080/ws");\r
+ System.out\r
+ .println(Jws2Client.servicekey\r
+ + Jws2Client.pseparator\r
+ + "<ServiceName> - optional if unspecified all services are tested otherwise one of "\r
+ + Arrays.toString(Services.values()));\r
+ System.out.println();\r
\r
- }\r
+ }\r
\r
- /**\r
- * Calls alignment with preset\r
- * \r
- * @param <T>\r
- * @param msaws\r
- * @param presets\r
- * list of the Preset\r
- * @throws UnsupportedRuntimeException\r
- */\r
- static <T> boolean presetAlign(MsaWS<T> msaws, List<Preset<T>> presets)\r
- throws UnsupportedRuntimeException {\r
- boolean succeed = false;\r
- for (Preset<T> preset : presets) {\r
- System.out.print("Aligning with preset '" + preset.getName()\r
- + "'... ");\r
- Alignment al = null;\r
- try {\r
- String taskId = msaws.presetAlign(seqs, preset);\r
- al = msaws.getResult(taskId);\r
- if (al != null) {\r
- System.out.println(OK);\r
+ /**\r
+ * Calls alignment with preset\r
+ * \r
+ * @param <T>\r
+ * @param msaws\r
+ * @param presets\r
+ * list of the Preset\r
+ * @throws UnsupportedRuntimeException\r
+ */\r
+ static <T> boolean presetAlign(MsaWS<T> msaws, List<Preset<T>> presets)\r
+ throws UnsupportedRuntimeException {\r
+ boolean succeed = false;\r
+ for (Preset<T> preset : presets) {\r
+ System.out.print("Aligning with preset '" + preset.getName()\r
+ + "'... ");\r
+ Alignment al = null;\r
+ try {\r
+ String taskId = msaws.presetAlign(seqs, preset);\r
+ al = msaws.getResult(taskId);\r
+ if (al != null) {\r
+ System.out.println(OK);\r
+ }\r
+ succeed = true;\r
+ } catch (UnsupportedRuntimeException e) {\r
+ System.out.println(FAILED);\r
+ // If executable is not supported than none of the presets are\r
+ // going to work\r
+ throw new UnsupportedRuntimeException(e);\r
+ } catch (JobSubmissionException e) {\r
+ // TODO custom message\r
+ System.out.println(FAILED);\r
+ System.out.println();\r
+ e.printStackTrace();\r
+ continue;\r
+ } catch (WrongParameterException e) {\r
+ // TODO custom message\r
+ System.out.println(FAILED);\r
+ System.out.println();\r
+ e.printStackTrace();\r
+ continue;\r
+ } catch (ResultNotAvailableException e) {\r
+ // TODO custom message\r
+ System.out.println(FAILED);\r
+ System.out.println();\r
+ e.printStackTrace();\r
+ continue;\r
+ }\r
}\r
- succeed = true;\r
- } catch (UnsupportedRuntimeException e) {\r
- System.out.println(FAILED);\r
- // If executable is not supported than none of the presets are\r
- // going to work\r
- throw new UnsupportedRuntimeException(e);\r
- } catch (JobSubmissionException e) {\r
- // TODO custom message\r
- System.out.println(FAILED);\r
- System.out.println();\r
- e.printStackTrace();\r
- continue;\r
- } catch (WrongParameterException e) {\r
- // TODO custom message\r
- System.out.println(FAILED);\r
- System.out.println();\r
- e.printStackTrace();\r
- continue;\r
- } catch (ResultNotAvailableException e) {\r
- // TODO custom message\r
- System.out.println(FAILED);\r
- System.out.println();\r
- e.printStackTrace();\r
- continue;\r
- }\r
+ return succeed;\r
}\r
- return succeed;\r
- }\r
\r
- /**\r
- * Call most of web services functions and check the output\r
- * \r
- * @param <T>\r
- * web service type\r
- * @param msaws\r
- * @throws UnsupportedRuntimeException\r
- * is thrown if the connection to a web service was made, but\r
- * the web service is not functional. e.g. when native\r
- * executable does not exists for a server platform\r
- */\r
- static <T> boolean checkService(MsaWS<T> msaws)\r
- throws UnsupportedRuntimeException {\r
+ /**\r
+ * Call most of web services functions and check the output\r
+ * \r
+ * @param <T>\r
+ * web service type\r
+ * @param msaws\r
+ * @throws UnsupportedRuntimeException\r
+ * is thrown if the connection to a web service was made, but\r
+ * the web service is not functional. e.g. when native\r
+ * executable does not exists for a server platform\r
+ */\r
+ static <T> boolean checkService(MsaWS<T> msaws)\r
+ throws UnsupportedRuntimeException {\r
\r
- boolean succeed = testDefaultAlignment(msaws);\r
+ boolean succeed = testDefaultAlignment(msaws);\r
\r
- // If exception above is thrown than the tests below is not run\r
+ // If exception above is thrown than the tests below is not run\r
\r
- PresetManager<T> pmanager = msaws.getPresets();\r
- if (pmanager != null && pmanager.getPresets().size() > 0) {\r
- System.out.println("Testing alignment with presets:");\r
- List<Preset<T>> plist = pmanager.getPresets();\r
- succeed = !succeed ? presetAlign(msaws, plist) : succeed;\r
- }\r
+ PresetManager<T> pmanager = msaws.getPresets();\r
+ if (pmanager != null && pmanager.getPresets().size() > 0) {\r
+ System.out.println("Testing alignment with presets:");\r
+ List<Preset<T>> plist = pmanager.getPresets();\r
+ succeed = !succeed ? presetAlign(msaws, plist) : succeed;\r
+ }\r
\r
- System.out.print("Querying presets...");\r
+ System.out.print("Querying presets...");\r
\r
- if (pmanager != null && pmanager.getPresets().size() > 0) {\r
- System.out.println(OK);\r
- } else {\r
- System.out.println("UNSUPPORTED");\r
- }\r
+ if (pmanager != null && pmanager.getPresets().size() > 0) {\r
+ System.out.println(OK);\r
+ } else {\r
+ System.out.println("UNSUPPORTED");\r
+ }\r
\r
- System.out.print("Querying Parameters...");\r
- RunnerConfig<T> options = msaws.getRunnerOptions();\r
- if (options != null && options.getArguments().size() > 0) {\r
- System.out.println(OK);\r
- } else {\r
- System.out.println(FAILED);\r
- succeed = false;\r
- }\r
+ System.out.print("Querying Parameters...");\r
+ RunnerConfig<T> options = msaws.getRunnerOptions();\r
+ if (options != null && options.getArguments().size() > 0) {\r
+ System.out.println(OK);\r
+ } else {\r
+ System.out.println(FAILED);\r
+ succeed = false;\r
+ }\r
\r
- System.out.print("Querying Limits...");\r
- LimitsManager<T> limits = msaws.getLimits();\r
- if (limits != null && limits.getLimits().size() > 0) {\r
- System.out.println(OK);\r
- } else {\r
- System.out.println("UNSUPPORTED");\r
- }\r
+ System.out.print("Querying Limits...");\r
+ LimitsManager<T> limits = msaws.getLimits();\r
+ if (limits != null && limits.getLimits().size() > 0) {\r
+ System.out.println(OK);\r
+ } else {\r
+ System.out.println("UNSUPPORTED");\r
+ }\r
\r
- System.out.print("Querying Local Engine Limits...");\r
- Limit<T> localLimit = msaws\r
- .getLimit(PresetManager.LOCAL_ENGINE_LIMIT_PRESET);\r
- if (localLimit != null) {\r
- System.out.println(OK);\r
- } else {\r
- System.out.println("UNSUPPORTED");\r
+ System.out.print("Querying Local Engine Limits...");\r
+ Limit<T> localLimit = msaws\r
+ .getLimit(PresetManager.LOCAL_ENGINE_LIMIT_PRESET);\r
+ if (localLimit != null) {\r
+ System.out.println(OK);\r
+ } else {\r
+ System.out.println("UNSUPPORTED");\r
+ }\r
+ return succeed;\r
}\r
- return succeed;\r
- }\r
\r
- /**\r
- * Align using default settings\r
- * \r
- * @param <T>\r
- * @param msaws\r
- * @throws UnsupportedRuntimeException\r
- */\r
- static <T> boolean testDefaultAlignment(MsaWS<T> msaws)\r
- throws UnsupportedRuntimeException {\r
- System.out.print("Testing alignment with default parameters:");\r
- Alignment al = null;\r
- boolean succeed = false;\r
- try {\r
- String taskId = msaws.align(seqs);\r
- System.out.print("\nQuerying job status...");\r
- JobStatus status = msaws.getJobStatus(taskId);\r
- while (status != JobStatus.FINISHED) {\r
- Thread.sleep(1000);\r
- status = msaws.getJobStatus(taskId);\r
- }\r
- System.out.println(OK);\r
- System.out.print("Retrieving results...");\r
- al = msaws.getResult(taskId);\r
- succeed = true;\r
- } catch (ResultNotAvailableException e) {\r
- System.out.println(FAILED);\r
- e.printStackTrace();\r
- } catch (JobSubmissionException e) {\r
- System.out.println(FAILED);\r
- System.out.println();\r
- e.printStackTrace();\r
- } catch (InterruptedException e) {\r
- System.out.println(FAILED);\r
- System.out.println();\r
- e.printStackTrace();\r
- }\r
- if (al != null) {\r
- System.out.println(OK);\r
+ /**\r
+ * Align using default settings\r
+ * \r
+ * @param <T>\r
+ * @param msaws\r
+ * @throws UnsupportedRuntimeException\r
+ */\r
+ static <T> boolean testDefaultAlignment(MsaWS<T> msaws)\r
+ throws UnsupportedRuntimeException {\r
+ System.out.print("Testing alignment with default parameters:");\r
+ Alignment al = null;\r
+ boolean succeed = false;\r
+ try {\r
+ String taskId = msaws.align(seqs);\r
+ System.out.print("\nQuerying job status...");\r
+ JobStatus status = msaws.getJobStatus(taskId);\r
+ while (status != JobStatus.FINISHED) {\r
+ Thread.sleep(1000);\r
+ status = msaws.getJobStatus(taskId);\r
+ }\r
+ System.out.println(OK);\r
+ System.out.print("Retrieving results...");\r
+ al = msaws.getResult(taskId);\r
+ succeed = true;\r
+ } catch (ResultNotAvailableException e) {\r
+ System.out.println(FAILED);\r
+ e.printStackTrace();\r
+ } catch (JobSubmissionException e) {\r
+ System.out.println(FAILED);\r
+ System.out.println();\r
+ e.printStackTrace();\r
+ } catch (InterruptedException e) {\r
+ System.out.println(FAILED);\r
+ System.out.println();\r
+ e.printStackTrace();\r
+ }\r
+ if (al != null) {\r
+ System.out.println(OK);\r
+ }\r
+ return succeed;\r
}\r
- return succeed;\r
- }\r
\r
- /**\r
- * Connect to a WS using the host and the service name\r
- * \r
- * @param <T>\r
- * @param host\r
- * @param service\r
- * @return\r
- */\r
- static <T> MsaWS<T> connect(String host, Services service) {\r
- MsaWS<T> msaws = null;\r
- try {\r
- System.out.print("Connecting to service " + service + " on " + host\r
- + " ... ");\r
- msaws = Jws2Client.connect(host, service);\r
- System.out.println(OK);\r
- } catch (WebServiceException e) {\r
- System.out.println(FAILED);\r
+ /**\r
+ * Connect to a WS using the host and the service name\r
+ * \r
+ * @param <T>\r
+ * @param host\r
+ * @param service\r
+ * @return\r
+ */\r
+ static <T> MsaWS<T> connect(String host, Services service) {\r
+ MsaWS<T> msaws = null;\r
+ try {\r
+ System.out.print("Connecting to service " + service + " on " + host\r
+ + " ... ");\r
+ msaws = Jws2Client.connect(host, service);\r
+ System.out.println(OK);\r
+ } catch (WebServiceException e) {\r
+ System.out.println(FAILED);\r
+ }\r
+ return msaws;\r
}\r
- return msaws;\r
- }\r
\r
- /**\r
- * Test JWS2 web services\r
- * \r
- * @param <T>\r
- * web service type\r
- * @param args\r
- * -h=<Your web application server host name, port and JWS2\r
- * context path>\r
- * \r
- * -s=<ServiceName> which is optional. If service name is not\r
- * provided then all known JWS2 web services are tested\r
- * @throws IOException\r
- */\r
- public static <T> void main(String[] args) throws IOException {\r
+ /**\r
+ * Test JWS2 web services\r
+ * \r
+ * @param <T>\r
+ * web service type\r
+ * @param args\r
+ * -h=<Your web application server host name, port and JWS2\r
+ * context path>\r
+ * \r
+ * -s=<ServiceName> which is optional. If service name is not\r
+ * provided then all known JWS2 web services are tested\r
+ * @throws IOException\r
+ */\r
+ public static <T> void main(String[] args) throws IOException {\r
\r
- if (args == null || args.length < 1) {\r
- printUsage();\r
- System.exit(0);\r
- }\r
- String host = Jws2Client.getHost(args);\r
- String serviceName = Jws2Client.getServiceName(args);\r
- if (!Jws2Client.validURL(host)) {\r
- System.out\r
- .println("<host_and_context> parameter is not provided or is incorrect!");\r
- System.exit(1);\r
- }\r
- boolean succeed = false;\r
- MsaWS<T> msaws = null;\r
- if (serviceName != null) {\r
- Services service = Services.getService(serviceName);\r
- if (service == null) {\r
- System.out.println("Service '" + serviceName\r
- + "' is not supported. Valid values are: "\r
- + Arrays.toString(Services.values()));\r
- System.out.println();\r
- printUsage();\r
- System.exit(1);\r
- }\r
+ if (args == null || args.length < 1) {\r
+ printUsage();\r
+ System.exit(0);\r
+ }\r
+ String host = Jws2Client.getHost(args);\r
+ String serviceName = Jws2Client.getServiceName(args);\r
+ if (!Jws2Client.validURL(host)) {\r
+ System.out\r
+ .println("<host_and_context> parameter is not provided or is incorrect!");\r
+ System.exit(1);\r
+ }\r
+ boolean succeed = false;\r
+ MsaWS<T> msaws = null;\r
+ if (serviceName != null) {\r
+ Services service = Services.getService(serviceName);\r
+ if (service == null) {\r
+ System.out.println("Service '" + serviceName\r
+ + "' is not supported. Valid values are: "\r
+ + Arrays.toString(Services.values()));\r
+ System.out.println();\r
+ printUsage();\r
+ System.exit(1);\r
+ }\r
\r
- msaws = connect(host, service);\r
- if (msaws == null) {\r
- System.exit(1);\r
- }\r
- try {\r
- succeed = checkService(msaws);\r
- } catch (UnsupportedRuntimeException ignored) {\r
- System.exit(1);\r
- } finally {\r
- ((Closeable) msaws).close();\r
- }\r
- reportResults(service, succeed);\r
- System.exit(0);\r
- }\r
+ msaws = connect(host, service);\r
+ if (msaws == null) {\r
+ System.exit(1);\r
+ }\r
+ try {\r
+ succeed = checkService(msaws);\r
+ } catch (UnsupportedRuntimeException ignored) {\r
+ System.exit(1);\r
+ } finally {\r
+ ((Closeable) msaws).close();\r
+ }\r
+ reportResults(service, succeed);\r
+ System.exit(0);\r
+ }\r
\r
- System.out\r
- .println("<ServiceName> is not provided checking all known services...");\r
+ System.out\r
+ .println("<ServiceName> is not provided checking all known services...");\r
\r
- for (Services serv : Services.values()) {\r
- System.out.println();\r
- msaws = connect(host, serv);\r
- if (msaws == null) {\r
- continue;\r
- }\r
- try {\r
- succeed = checkService(msaws);\r
- } catch (UnsupportedRuntimeException ignored) {\r
- System.out.println("Service " + serv + " IS NOT FUNCTIONAL");\r
- continue;\r
- } finally {\r
- ((Closeable) msaws).close();\r
- }\r
- reportResults(serv, succeed);\r
- }\r
+ for (Services serv : Services.values()) {\r
+ System.out.println();\r
+ msaws = connect(host, serv);\r
+ if (msaws == null) {\r
+ continue;\r
+ }\r
+ try {\r
+ succeed = checkService(msaws);\r
+ } catch (UnsupportedRuntimeException ignored) {\r
+ System.out.println("Service " + serv + " IS NOT FUNCTIONAL");\r
+ continue;\r
+ } finally {\r
+ ((Closeable) msaws).close();\r
+ }\r
+ reportResults(serv, succeed);\r
+ }\r
\r
- }\r
+ }\r
\r
- private static void reportResults(Services serv, boolean succeed) {\r
- if (succeed) {\r
- System.out.println("Check is completed. The Service " + serv\r
- + " IS WORKING");\r
- } else {\r
- System.out.println("Check is completed. The Service " + serv\r
- + " HAS SOME PROBLEMS");\r
+ private static void reportResults(Services serv, boolean succeed) {\r
+ if (succeed) {\r
+ System.out.println("Check is completed. The Service " + serv\r
+ + " IS WORKING");\r
+ } else {\r
+ System.out.println("Check is completed. The Service " + serv\r
+ + " HAS SOME PROBLEMS");\r
+ }\r
}\r
- }\r
}\r