From: pvtroshin Date: Wed, 8 Jun 2011 10:09:43 +0000 (+0000) Subject: WStester & registry are completed X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=42a09319d534bfc2e97fc0ddd256aefe4185841b;p=jabaws.git WStester & registry are completed git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4230 e3abac25-378b-4346-85de-24260fe3988d --- diff --git a/webservices/compbio/ws/client/WSTester.java b/webservices/compbio/ws/client/WSTester.java index a0e635b..4db6778 100644 --- a/webservices/compbio/ws/client/WSTester.java +++ b/webservices/compbio/ws/client/WSTester.java @@ -40,16 +40,13 @@ import compbio.data.sequence.FastaSequence; import compbio.data.sequence.ScoreManager; import compbio.data.sequence.SequenceUtil; import compbio.metadata.JobStatus; -import compbio.metadata.JobSubmissionException; import compbio.metadata.Limit; import compbio.metadata.LimitsManager; import compbio.metadata.Option; import compbio.metadata.Preset; import compbio.metadata.PresetManager; -import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.UnsupportedRuntimeException; -import compbio.metadata.WrongParameterException; import compbio.util.FileUtil; import compbio.util.Util; @@ -170,31 +167,15 @@ public class WSTester { writer.println(OK); } succeed = true; - } catch (UnsupportedRuntimeException e) { - writer.println(FAILED); - // If executable is not supported than none of the presets are - // going to work - throw new UnsupportedRuntimeException(e); - } catch (JobSubmissionException e) { - // TODO custom message - writer.println(FAILED); - writer.println(); - writer.println(e.getLocalizedMessage()); - e.printStackTrace(writer); - continue; - } catch (WrongParameterException e) { - // TODO custom message - writer.println(FAILED); - writer.println(); - writer.println(e.getLocalizedMessage()); - e.printStackTrace(writer); - continue; - } catch (ResultNotAvailableException e) { - // TODO custom message - writer.println(FAILED); - writer.println(); - writer.println(e.getLocalizedMessage()); - e.printStackTrace(writer); + } catch (Exception e) { + if (e instanceof UnsupportedRuntimeException) { + // If executable is not supported than none of the presets + // are + // going to work + throw (UnsupportedRuntimeException) e; + } else { + reportException(e); + } continue; } } @@ -245,15 +226,14 @@ public class WSTester { + wservice.getClass() + " is not supported! "); } } catch (UnsupportedRuntimeException e) { - writer.println(e.getLocalizedMessage()); - e.printStackTrace(writer); + reportException(e); return false; } } private boolean testSequenceAnnotationWS(SequenceAnnotation wservice) throws UnsupportedRuntimeException { - writer.println("Calling analyse........."); + writer.print("Calling analyse........."); boolean success = testDefaultAnalyse(loadAlignment(), wservice, null, null); @@ -262,7 +242,7 @@ public class WSTester { List> presets = presetman.getPresets(); if (presets != null && !presets.isEmpty()) { Preset preset = presets.get(0); - writer.println("Calling analyse with Preset........."); + writer.print("Calling analyse with Preset........."); success = testDefaultAnalyse(loadAlignment(), wservice, preset, null); } @@ -287,29 +267,27 @@ public class WSTester { } Thread.sleep(1000); scores = wsproxy.getAnnotation(jobId); - - } catch (JobSubmissionException e) { - writer.println("Exception while submitting job to a web server. " - + "Exception details are below:"); - e.printStackTrace(writer); - } catch (ResultNotAvailableException e) { - writer.println("Exception while waiting for results. " - + "Exception details are below:"); - e.printStackTrace(writer); - } catch (InterruptedException e) { - // ignore and propagate an interruption - Thread.currentThread().interrupt(); - writer.println("Exception while waiting for results. " - + "Exception details are below:"); - e.printStackTrace(writer); - } catch (WrongParameterException e) { - writer.println("Exception while parsing the web method input parameters. " - + "Exception details are below:"); - e.printStackTrace(writer); + if (scores != null) { + writer.println(OK); + } + } catch (Exception e) { + if (e instanceof UnsupportedRuntimeException) { + throw (UnsupportedRuntimeException) e; + } else { + reportException(e); + } } return scores != null; } + private void reportException(Exception e) { + writer.println(FAILED); + writer.println("Exception while waiting for results. " + + "Exception details are below:"); + writer.println(e.getLocalizedMessage()); + e.printStackTrace(writer); + } + private void testMetadata(Metadata msaws) throws UnsupportedRuntimeException { @@ -375,9 +353,7 @@ public class WSTester { if (e instanceof UnsupportedRuntimeException) { throw (UnsupportedRuntimeException) e; } else { - writer.println(FAILED); - writer.println(e.getLocalizedMessage()); - e.printStackTrace(writer); + reportException(e); } } if (al != null) { @@ -385,7 +361,6 @@ public class WSTester { } return succeed; } - /** * Test JWS2 web services *