public HealthReport checkActivityHealth() { return new HealthReport("AsynchEchoActivity", "Everything is hunky dorey", Status.OK); }
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);
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; }
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); } }
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); } }
@Before public void setUp() throws Exception { List<HealthReport> subreports = new ArrayList<HealthReport>(); subreports.add(new HealthReport("sub subject","this is a subreport",Status.OK)); report = new HealthReport("a subject","a message",Status.WARNING,subreports); }
@Before public void setUp() throws Exception { activityReports = new ArrayList<HealthReport>(); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.OK)); report = new ProcessorHealthReport("processor subject",activityReports); }
@Before public void setUp() throws Exception { List<HealthReport> subreports = new ArrayList<HealthReport>(); subreports.add(new HealthReport("sub subject","this is a subreport",Status.OK)); report = new HealthReport("a subject","a message",Status.WARNING,subreports); }
public HealthReport checkHealth(CaGridActivity activity) { List<HealthReport> reports = new ArrayList<HealthReport>(); WSDLParser parser; try { parser = new WSDLParser(activity.getConfiguration().getWsdl()); reports.add(testWSDL(activity.getConfiguration().getWsdl())); reports.add(testEndpoint(parser, activity.getConfiguration() .getOperation())); reports.add(testStyleAndUse(parser, activity.getConfiguration() .getOperation())); } catch (ParserConfigurationException e) { reports.add(new HealthReport("CaGrid Activity","Error whilst parsing the WSDL:"+e.getMessage(),Status.SEVERE)); } catch (WSDLException e) { reports.add(new HealthReport("CaGrid Activity","Error whilst parsing the WSDL:"+e.getMessage(),Status.SEVERE)); } catch (IOException e) { reports.add(new HealthReport("CaGrid Activity","Communication error whilst parsing the WSDL:"+e.getMessage(),Status.SEVERE)); } catch (SAXException e) { reports.add(new HealthReport("CaGrid Activity","XML error whilst parsing the WSDL:"+e.getMessage(),Status.SEVERE)); } Status status = highestStatus(reports); HealthReport report = new HealthReport("CaGrid Activity", "", status, reports); return report; }
message = "Error connecting : " + e.getMessage(); return new HealthReport("Biomart Activity [" + location + "]", message, status);
@SuppressWarnings("unchecked") public HealthReport checkHealth(Processor subject) { List<HealthReport> activityReports = new ArrayList<HealthReport>(); for (Activity<?> a : subject.getActivityList()) { List<HealthChecker<?>> checkers = HealthCheckerFactory .getInstance().getHealthCheckersForObject(a); if (checkers.size() > 0) { List<HealthReport> reports = new ArrayList<HealthReport>(); for (HealthChecker checker : checkers) { reports.add(checker.checkHealth(a)); } if (reports.size() == 1) { activityReports.add(reports.get(0)); } else { activityReports.add(new HealthReport("Activity tests...", "", Status.OK, reports)); } } } HealthReport processorHealthReport = new ProcessorHealthReport( subject.getLocalName() + " Processor", activityReports); return processorHealthReport; }
@SuppressWarnings("unchecked") public HealthReport checkHealth(Processor subject) { List<HealthReport> activityReports = new ArrayList<HealthReport>(); for (Activity<?> a : subject.getActivityList()) { List<HealthChecker<?>> checkers = HealthCheckerFactory .getInstance().getHealthCheckersForObject(a); if (checkers.size() > 0) { List<HealthReport> reports = new ArrayList<HealthReport>(); for (HealthChecker checker : checkers) { reports.add(checker.checkHealth(a)); } if (reports.size() == 1) { activityReports.add(reports.get(0)); } else { activityReports.add(new HealthReport("Activity tests...", "", Status.OK, reports)); } } } HealthReport processorHealthReport = new ProcessorHealthReport( subject.getLocalName() + " Processor", activityReports); return processorHealthReport; }
@Test public void testGetStatusAllOK() { List<HealthReport> activityReports = new ArrayList<HealthReport>(); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.OK)); ProcessorHealthReport report = new ProcessorHealthReport("processor subject",activityReports); assertEquals("the status should be OK",Status.OK,report.getStatus()); }
@Test public void testGetStatusAllSevere() { List<HealthReport> activityReports = new ArrayList<HealthReport>(); activityReports.add(new HealthReport("","",Status.SEVERE)); activityReports.add(new HealthReport("","",Status.SEVERE)); activityReports.add(new HealthReport("","",Status.SEVERE)); ProcessorHealthReport report = new ProcessorHealthReport("",activityReports); assertEquals("the status should be SEVERE",Status.SEVERE,report.getStatus()); }
@Test public void testGetStatusContainsWarning() { List<HealthReport> activityReports = new ArrayList<HealthReport>(); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.WARNING)); ProcessorHealthReport report = new ProcessorHealthReport("processor subject",activityReports); assertEquals("the status should be WARNING",Status.WARNING,report.getStatus()); }
@Test public void testGetStatusContainsSevere() { List<HealthReport> activityReports = new ArrayList<HealthReport>(); activityReports.add(new HealthReport("","",Status.OK)); activityReports.add(new HealthReport("","",Status.SEVERE)); activityReports.add(new HealthReport("","",Status.OK)); ProcessorHealthReport report = new ProcessorHealthReport("",activityReports); assertEquals("the status should be WARNING",Status.WARNING,report.getStatus()); }
@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 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()); }
@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()); }