public HealthReport checkActivityHealth() { return new HealthReport("AsynchEchoActivity", "Everything is hunky dorey", Status.OK); }
@Test public void testStatusHighestIncludingSubReports() { report = new HealthReport("parent","set to ok",Status.OK); assertEquals("should be OK",Status.OK,report.getStatus()); report.getSubReports().add(new HealthReport("child1","set to warning",Status.WARNING)); assertEquals("should be WARNING",Status.WARNING,report.getStatus()); report.getSubReports().add(new HealthReport("child1","set to severe",Status.SEVERE)); assertEquals("should be SEVERE",Status.SEVERE,report.getStatus()); }
@Test public void testActivityHealthReportStringStatus() { report = new HealthReport("the subject","a string",Status.SEVERE); assertEquals("a string",report.getMessage()); assertEquals(Status.SEVERE,report.getStatus()); assertEquals("the subject",report.getSubject()); assertEquals("the subreports should be an empty list",0,report.getSubReports().size()); }
/** * Determines the overall Status. This is the most severe status of this report and all its sub reports. * @return the overall status */ public Status getStatus() { Status result = status; for (HealthReport report : subReports) { if (report.getStatus().compareTo(result)>0) result=report.getStatus(); } return result; }
@Test public void testGetSubreports() { List<HealthReport> subreports = report.getSubReports(); assertEquals("There should be 1 report",1,subreports.size()); assertEquals("Wrong subject","sub subject",subreports.get(0).getSubject()); }
@Test public void testGetSubject() { assertEquals("a subject",report.getSubject()); }
@Test public void testGetMessage() { assertEquals("a message",report.getMessage()); }
@Test public void testActivityHealthReportStringStatus() { report = new HealthReport("the subject","a string",Status.SEVERE); assertEquals("a string",report.getMessage()); assertEquals(Status.SEVERE,report.getStatus()); assertEquals("the subject",report.getSubject()); assertEquals("the subreports should be an empty list",0,report.getSubReports().size()); }
/** * Determines the overall Status. This is the most severe status of this report and all its sub reports. * @return the overall status */ public Status getStatus() { Status result = status; for (HealthReport report : subReports) { if (report.getStatus().compareTo(result)>0) result=report.getStatus(); } return result; }
@Test public void testGetSubreports() { List<HealthReport> subreports = report.getSubReports(); assertEquals("There should be 1 report",1,subreports.size()); assertEquals("Wrong subject","sub subject",subreports.get(0).getSubject()); }
@Test public void testGetSubject() { assertEquals("a subject",report.getSubject()); }
@Test public void testGetMessage() { assertEquals("a message",report.getMessage()); }
int code = pingURL((HttpURLConnection) connection, 15000); if (code != 200) { report = new HealthReport("WSDL Test", "Pinging the WSDL did not responded with " + code + " rather than 200", Status.WARNING); } else { report = new HealthReport("WSDL Test", "The WSDL [" + wsdl + "] responded OK", Status.OK); report = new HealthReport("WSDL Test","The WSDL is not HTTP based which may affect workflow portability",Status.WARNING); report = new HealthReport("WSDL Test", "There was a problem with the WSDL URL:" + e.getMessage(), Status.SEVERE); } catch (SocketTimeoutException e) { report = new HealthReport( "WSDL Test", "Reading the WSDL tool longer than 15 seconds to get a response", Status.WARNING); } catch (IOException e) { report = new HealthReport("WSDL Test", "There was an error opening the WSDL:" + e.getMessage(), Status.WARNING);
@Test public void testStatusHighestIncludingSubReports() { report = new HealthReport("parent","set to ok",Status.OK); assertEquals("should be OK",Status.OK,report.getStatus()); report.getSubReports().add(new HealthReport("child1","set to warning",Status.WARNING)); assertEquals("should be WARNING",Status.WARNING,report.getStatus()); report.getSubReports().add(new HealthReport("child1","set to severe",Status.SEVERE)); assertEquals("should be SEVERE",Status.SEVERE,report.getStatus()); }
/** * the overall status is SEVERE if all sub reports are SEVERE, OK if all are OK, otherwise WARNING. * return */ @Override public Status getStatus() { Status result = super.getStatus(); int severeCount = 0; for (HealthReport report : getSubReports()) { if (report.getStatus()!=Status.OK) { result = Status.WARNING; } if (report.getStatus()==Status.SEVERE) severeCount++; } if (severeCount==getSubReports().size()) result=Status.SEVERE; return result; }
private HealthReport testStyleAndUse(WSDLParser parser, String operationName) { HealthReport report; String style = parser.getStyle().toLowerCase(); String use = "?"; try { use = parser.getUse(operationName).toLowerCase(); if (use.equals("literal") && style.equals("rpc")) { report = new HealthReport("Style and Use", "RPC/Literal is not officially supported by Taverna", Status.SEVERE); } else { report = new HealthReport("Style and Use", style + "/" + use + " is OK", Status.OK); } } catch (UnknownOperationException e) { report = new HealthReport("Style and Use", "Unable to find use for operation:" + operationName, Status.SEVERE); } return report; }
private Status highestStatus(List<HealthReport> reports) { Status status = Status.OK; for (HealthReport report : reports) { if (report.getStatus().equals(Status.WARNING) && status.equals(Status.OK)) status = report.getStatus(); if (report.getStatus().equals(Status.SEVERE)) status = Status.SEVERE; } return status; }
public HealthReport checkHealth(XMLInputSplitterActivity activity) { String xml = activity.getConfiguration().getWrappedTypeXML(); Element element; try { element = new SAXBuilder().build(new StringReader(xml)).getRootElement(); } catch (JDOMException e) { return new HealthReport("XMLInputSplitter Activity","Error reading the configuration XML:"+e.getMessage(),Status.SEVERE); } catch (IOException e) { return new HealthReport("XMLInputSplitter Activity","Error reading the configuration XML:"+e.getMessage(),Status.SEVERE); } TypeDescriptor typeDescriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element); if (typeDescriptor==null) { return new HealthReport("XMLInputSplitter Activity","The datatype is NULL",Status.SEVERE); } else { return new HealthReport("XMLInputSplitter Activity","The datatype is declared OK",Status.OK); } }
/** * the overall status is SEVERE if all sub reports are SEVERE, OK if all are OK, otherwise WARNING. * return */ @Override public Status getStatus() { Status result = super.getStatus(); int severeCount = 0; for (HealthReport report : getSubReports()) { if (report.getStatus()!=Status.OK) { result = Status.WARNING; } if (report.getStatus()==Status.SEVERE) severeCount++; } if (severeCount==getSubReports().size()) result=Status.SEVERE; return result; }
public HealthReport checkHealth(XMLOutputSplitterActivity activity) { String xml = activity.getConfiguration().getWrappedTypeXML(); Element element; try { element = new SAXBuilder().build(new StringReader(xml)).getRootElement(); } catch (JDOMException e) { return new HealthReport("XMLOutputSplitter Activity","Error reading the configuration XML:"+e.getMessage(),Status.SEVERE); } catch (IOException e) { return new HealthReport("XMLOutputSplitter Activity","Error reading the configuration XML:"+e.getMessage(),Status.SEVERE); } TypeDescriptor typeDescriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element); if (typeDescriptor==null) { return new HealthReport("XMLOutputSplitter Activity","The datatype is NULL",Status.SEVERE); } else { return new HealthReport("XMLOutputSplitter Activity","The datatype is declared OK",Status.OK); } }